-
Notifications
You must be signed in to change notification settings - Fork 22
84 lines (67 loc) · 2.18 KB
/
data-proxy-test.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
name: data-proxy-code-tests
on:
pull_request:
branches:
- main
- staging
- master
jobs:
check:
name: check for changes in data-proxy
outputs:
run_data-proxy_tests: ${{ steps.check_files.outputs.run_data-proxy_tests }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: check modified app folder
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_data-proxy_tests=false" >>$GITHUB_OUTPUT
while IFS= read -r file
do
echo $file
if [[ $file == src/data-proxy/* ]]; then
echo "run_data-proxy_tests=true" >>$GITHUB_OUTPUT
fi
done < files.txt
drive:
name: data-proxy code tests
needs: [check]
if: needs.check.outputs.run_data-proxy_tests == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/data-proxy
steps:
- name: Checkout
uses: actions/[email protected]
- name: Authenticate to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_SA_CREDENTIALS }}
- name: Set up gcloud Cloud SDK environment
uses: google-github-actions/[email protected]
- name: Add .env files
run: |
gcloud secrets versions access latest --secret="sta-env-data-proxy" > .env
gcloud secrets versions access latest --secret="prod-env-data-proxy" > .env
- name: Node setup
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install requirements
run: npm install
- name: Run tests and collect coverage
run: npm run test-coverage
continue-on-error: true
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}