forked from airqo-platform/AirQo-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (66 loc) · 2.17 KB
/
run-tests.yml
File metadata and controls
80 lines (66 loc) · 2.17 KB
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
name: run-tests
on:
pull_request:
branches:
- staging
jobs:
check:
name: check for changed frontends
outputs:
run_next_platform: ${{ steps.check_files.outputs.run_next_platform }} # next platform
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: check modified frontends
id: check_files
run: |
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
echo "run_next_platform=false" >>$GITHUB_OUTPUT
while IFS= read -r file
do
if [[ $file == platform/* ]]; then
echo "run_next_platform=true" >>$GITHUB_OUTPUT
fi
done < files.txt
### next-platform changes ###
next-platform:
name: test-next-platform
needs: [check]
if: needs.check.outputs.run_next_platform == 'true'
runs-on: ubuntu-latest
container: cypress/browsers:node16.14.0-chrome99-ff97
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Google login
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SA_CREDENTIALS }}
- name: Setup Cloud SDK(gcloud)
uses: google-github-actions/setup-gcloud@v0
- name: Create .env file
run: |
gcloud secrets versions access latest --secret="sta-env-next-platform" > platform/.env
echo "INSTRUMENT_CODE=1" >> platform/.env
- name: Cypress run
uses: cypress-io/github-action@v4
with:
working-directory: ./platform/
build: yarn build
start: yarn start
browser: chrome
record: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG: code-coverage
- name: Deploy code coverage report 🚀
uses: codecov/codecov-action@v3
with:
directory: ./platform/coverage/lcov-report