-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (116 loc) · 3.87 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Test application generation
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
prettier-check:
name: Prettier check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Run prettier check
run: npm run format:check
test-schematics:
name: Test schematics
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Run schematics tests
run: npm run test
generate-application:
name: Generate application
needs: [test-schematics, prettier-check]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Install schematics CLI
run: npm install --location=global @angular-devkit/schematics-cli@latest
- name: Build schematics
run: npm run build
- name: Link npm package
run: npm link
- name: Generate application
run: janush --name=janush-auto-generated-app --types={web,cloud} --modules={authentication,api,usersManagement} --e2e --e2e-module=Cypress --skip-install --is-auto-generated
- name: Upload generated application
uses: actions/upload-artifact@master
with:
name: janush-auto-generated-app
path: janush-auto-generated-app
test-web:
name: Test web
needs: [generate-application]
runs-on: ubuntu-latest
steps:
- name: Download generated application
uses: actions/download-artifact@master
with:
name: janush-auto-generated-app
path: janush-auto-generated-app
- name: Install dependencies
working-directory: ./janush-auto-generated-app/web
run: npm install
- name: Run tests
working-directory: ./janush-auto-generated-app/web
run: npm run test -- --watchAll=false
env:
CI: true
test-cloud:
name: Test cloud
needs: [generate-application]
runs-on: ubuntu-latest
steps:
- name: Download generated application
uses: actions/download-artifact@master
with:
name: janush-auto-generated-app
path: janush-auto-generated-app
- name: Install dependencies
working-directory: ./janush-auto-generated-app/cloud
run: npm install
- name: Run tests
working-directory: ./janush-auto-generated-app/cloud
run: npm run test -- --watchAll=false
env:
CI: true
push-to-dedicated-repo:
name: Push to dedicated repo
if: github.ref == 'refs/heads/main'
needs: [test-web, test-cloud]
runs-on: ubuntu-latest
steps:
- name: Download generated application
uses: actions/download-artifact@master
with:
name: janush-auto-generated-app
path: janush-auto-generated-app
- name: Push to dedicated repo
env:
BOT_PERSONAL_ACCESS_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
run: |
cd janush-auto-generated-app
git config --global user.name JanushBot
git config --global user.email [email protected]
git init -b main
git add .
git commit -m "Automatically generated by JanushBot (SHA: $GITHUB_SHA)"
git push https://${BOT_PERSONAL_ACCESS_TOKEN}@github.com/codeandpepper/janush.app.git main --force
- name: Wait until janush.app pipeline is done
uses: convictional/[email protected]
with:
owner: codeandpepper
repo: janush.app
github_token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
workflow_file_name: main.yml
wait_interval: 30