File tree Expand file tree Collapse file tree 5 files changed +52
-16
lines changed
Expand file tree Collapse file tree 5 files changed +52
-16
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,6 @@ name: Build
22
33on :
44 workflow_call :
5- inputs :
6- node-version :
7- required : false
8- type : string
9- default : ' 18.x'
105
116jobs :
127 build :
Original file line number Diff line number Diff line change 1212 CI : false
1313
1414jobs :
15- run-build :
16- uses : ./.github/workflows/build-reusable.yml
15+ test :
16+ uses : ./.github/workflows/test.yml
17+
18+ build :
19+ uses : ./.github/workflows/build.yml
20+ needs : test
1721
1822 deploy :
1923 runs-on : ubuntu-22.04
20- needs : run- build
24+ needs : build
2125 steps :
2226 - name : Checkout source code
2327 uses : actions/checkout@v3
Original file line number Diff line number Diff line change 99 workflow_dispatch :
1010
1111jobs :
12+ test :
13+ uses : ./.github/workflows/test.yml
14+
1215 build :
1316 name : Build image
1417 runs-on : ubuntu-22.04
18+ needs : test
1519
1620 steps :
1721 - name : Set env variables
Original file line number Diff line number Diff line change 1- name : Build and test Pull Request
1+ name : Pull Request checks
22
33on :
44 pull_request :
55
66jobs :
7- run- build :
8- uses : ./.github/workflows/build-reusable .yml
7+ build :
8+ uses : ./.github/workflows/build.yml
99
1010 test :
11- runs-on : ubuntu-22.04
12- needs : run-build
13- steps :
14- - name : Run unit tests
15- run : npm run frontend:test
11+ uses : ./.github/workflows/test.yml
1612
Original file line number Diff line number Diff line change 1+ name : Unit tests
2+
3+ on :
4+ workflow_call :
5+
6+ jobs :
7+ test :
8+ runs-on : ubuntu-22.04
9+ steps :
10+ - name : Checkout source code
11+ uses : actions/checkout@v3
12+
13+ - name : Setup Node
14+ uses : actions/setup-node@v3
15+ with :
16+ node-version : 18.x
17+
18+ - name : Get version from package.json
19+ id : package-version
20+ run : |
21+ echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
22+ echo "Project Version: $VERSION"
23+
24+ - name : Cache node_modules
25+ uses : actions/cache@v3
26+ id : cache-npm-packages
27+ with :
28+ path : node_modules
29+ key : ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
30+
31+ - name : Install NPM dependencies
32+ if : steps.cache-npm-packages.outputs.cache-hit != 'true'
33+ run : npm clean-install
34+
35+ - name : Run frontend unit tests
36+ run : npm run frontend:test
37+
You can’t perform that action at this time.
0 commit comments