generated from Arquisoft/dede_0
-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (141 loc) · 4.38 KB
/
asw2122.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# This is a basic workflow to help you get started with Actions
name: CI for ASW2122
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
jobs:
unit-test-webapp:
runs-on: ubuntu-latest
defaults:
run:
working-directory: webapp
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm ci
- run: npm test
- uses: codecov/codecov-action@v2
unit-test-restapi:
runs-on: ubuntu-latest
defaults:
run:
working-directory: restapi
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Create env file 📝
run: |
touch .env
echo MONGO_URI_TEST=${{ secrets.MONGO_URI_TEST }} >> .env
echo MONGO_URI=${{ secrets.MONGO_URI }} >> .env
cat .env
- run: npm ci
- run: npm test
- uses: codecov/codecov-action@v2
e2e-tests:
needs: [unit-test-webapp, unit-test-restapi]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Create env file 📝
run: |
cd restapi
touch .env
echo MONGO_URI_TEST=${{ secrets.MONGO_URI_TEST }} >> .env
cat .env
- run: npm --prefix webapp install
- run: npm --prefix restapi install
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest
needs: [e2e-tests]
steps:
- uses: actions/checkout@v2
- name: Create env file 📝
run: |
cd webapp
touch .env
echo REACT_APP_API_URI="https://dede2b-restapi.herokuapp.com" >> .env
cat .env
- name: Publish to Registry
uses: elgohr/[email protected]
with:
name: arquisoft/dede_es2b/webapp
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: webapp
docker-push-restapi:
name: Push restapi Docker Image to GitHub Packages
runs-on: ubuntu-latest
needs: [e2e-tests]
steps:
- uses: actions/checkout@v2
- name: Create env file 📝
run: |
cd restapi
touch .env
echo MONGO_URI_TEST=${{ secrets.MONGO_URI_TEST }} >> .env
echo CORS_OPTIONS1="http://dede2b-webapp.herokuapp.com" >> .env
echo CORS_OPTIONS2="https://dede2b-webapp.herokuapp.com" >> .env
cat .env
- name: Publish to Registry
uses: elgohr/[email protected]
with:
name: arquisoft/dede_es2b/restapi
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: restapi
deploy-webapp:
needs: [e2e-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create env file 📝
run: |
cd webapp
touch .env
echo REACT_APP_API_URI="https://dede2b-restapi.herokuapp.com" >> .env
cat .env
- uses: akhileshns/[email protected] # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "dede2b-webapp" #Must be unique in Heroku
heroku_email: ${{secrets.HEROKU_EMAIL}}
usedocker: true
appdir: "webapp"
env_file: .env
deploy-restapi:
needs: [e2e-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create env file 📝
run: |
cd restapi
touch .env
echo MONGO_URI_TEST=${{ secrets.MONGO_URI_TEST }} >> .env
echo MONGO_URI=${{ secrets.MONGO_URI }} >> .env
echo CORS_OPTIONS1="http://dede2b-webapp.herokuapp.com" >> .env
echo CORS_OPTIONS2="https://dede2b-webapp.herokuapp.com" >> .env
cat .env
- uses: akhileshns/[email protected] # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "dede2b-restapi" #Must be unique in Heroku
heroku_email: ${{secrets.HEROKU_EMAIL}}
usedocker: true
appdir: "restapi"
env_file: .env