-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (79 loc) · 2.87 KB
/
pr.yaml
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
name: Test New Changes
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
check-file-changes:
runs-on: ubuntu-latest
outputs:
client_modified: ${{ steps.check_client_files.outputs.client_modified }}
server_modified: ${{ steps.check_server_files.outputs.server_modified }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: check client files
id: check_client_files
run: |
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
while IFS= read -r file
do
echo $file
if [[ $file == packages/client/* ]]; then
echo "Files in the 'client' package have been modified."
echo "::set-output name=client_modified::true"
break
else
echo "::set-output name=client_modified::false"
fi
done < files.txt
- name: check server files
id: check_server_files
run: |
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
while IFS= read -r file
do
echo $file
if [[ $file == packages/server/* ]]; then
echo "Files in the 'server' package have been modified."
echo "::set-output name=server_modified::true"
break
else
echo "::set-output name=server_modified::false"
fi
done < files.txt
server-test-suite:
runs-on: ubuntu-latest
needs: check-file-changes
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 2
if: needs.check-file-changes.outputs.server_modified == 'true'
- name: Install dependencies
if: needs.check-file-changes.outputs.server_modified == 'true'
run: yarn workspace server install --immutable --immutable-cache --check-cache
- name: Run test suite
if: needs.check-file-changes.outputs.server_modified == 'true'
run: yarn workspace server test --verbose
client-test-suite:
runs-on: ubuntu-latest
needs: check-file-changes
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 2
if: needs.check-file-changes.outputs.client_modified == 'true'
- name: Install dependencies
if: needs.check-file-changes.outputs.client_modified == 'true'
run: yarn workspace client install --immutable --immutable-cache --check-cache
- name: Run test suite
if: needs.check-file-changes.outputs.client_modified == 'true'
run: yarn workspace client test --verbose