File tree Expand file tree Collapse file tree 5 files changed +111
-46
lines changed Expand file tree Collapse file tree 5 files changed +111
-46
lines changed Original file line number Diff line number Diff line change 1+ name : Build
2+
3+ on :
4+ workflow_call :
5+
6+ jobs :
7+ build :
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 : Cache build frontend
36+ uses : actions/cache@v3
37+ id : cache-build-frontend
38+ with :
39+ path : apps/frontend
40+ key : ${{ runner.os }}-frontend-${{ github.sha }}
41+
42+ - name : Run build production application
43+ run : npm run frontend:build
44+
45+ - name : Cache build backend
46+ uses : actions/cache@v3
47+ id : cache-build-backend
48+ with :
49+ path : apps/backend
50+ key : ${{ runner.os }}-backend-${{ github.sha }}
51+
52+ - name : Run build backend server
53+ run : npm run backend:build
Original file line number Diff line number Diff line change 1212 CI : false
1313
1414jobs :
15+ test :
16+ uses : ./.github/workflows/test.yml
17+
1518 build :
16- runs-on : ubuntu-22.04
17- steps :
18- - name : Checkout source code
19- uses : actions/checkout@v3
20-
21- - name : Setup Node
22- uses : actions/setup-node@v3
23- with :
24- node-version : 18.x
25-
26- - name : Get version from package.json
27- id : package-version
28- run : |
29- echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
30- echo "Project Version: $VERSION"
31-
32- - name : Cache node_modules
33- uses : actions/cache@v3
34- id : cache-npm-packages
35- with :
36- path : node_modules
37- key : ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
38-
39- - name : Install NPM dependencies
40- if : steps.cache-npm-packages.outputs.cache-hit != 'true'
41- run : npm clean-install
42-
43- - name : Cache build frontend
44- uses : actions/cache@v3
45- id : cache-build-frontend
46- with :
47- path : apps/frontend
48- key : ${{ runner.os }}-frontend-${{ github.sha }}
49-
50- - name : Run build production application
51- run : npm run frontend:build
52-
53- - name : Cache build backend
54- uses : actions/cache@v3
55- id : cache-build-backend
56- with :
57- path : apps/backend
58- key : ${{ runner.os }}-backend-${{ github.sha }}
59-
60- - name : Run build backend server
61- run : npm run backend:build
19+ uses : ./.github/workflows/build.yml
20+ needs : test
6221
6322 deploy :
6423 runs-on : ubuntu-22.04
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 : Pull Request checks
2+
3+ on :
4+ pull_request :
5+
6+ jobs :
7+ build :
8+ uses : ./.github/workflows/build.yml
9+
10+ test :
11+ uses : ./.github/workflows/test.yml
12+
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