@@ -23,28 +23,75 @@ jobs:
23
23
run : |
24
24
echo "GIST_SECRET=${{ secrets.GIST_SECRET }}" >> $GITHUB_ENV
25
25
echo "GIST_ID=${{ secrets.GIST_ID }}" >> $GITHUB_ENV
26
+ - name : Restore cached .nx
27
+ id : cache-nx-restore
28
+ uses : actions/cache/restore@v4
29
+ with :
30
+ path : |
31
+ .nx
32
+ key : ${{ runner.os }}-nx-master"
26
33
- name : Test and build
27
34
run : npx nx affected -t test build --parallel=3 --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source'
28
35
- name : Upload test coverage badge
29
36
run : npx nx affected -t upload-badge --parallel=3 --exclude='json-api-front,json-api-server,shared-utils,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source'
30
- - name : Cache npm dependencies
37
+ - name : Save cached .nx
31
38
id : cache-dependencies-save
32
39
uses : actions/cache/save@v4
33
40
with :
34
41
path : |
35
42
.nx
36
- .angular
37
- key : ${{ runner.os }}-npm-dependencies-${{ hashFiles('package-lock.json') }}
38
- # env:
39
- # GIST_SECRET: ${{ secrets.GIST_SECRET }}
40
- # GIST_ID: ${{ secrets.GIST_ID }}
41
- # - run: npm nx affected -t e2e-ci --parallel=1
42
- # - run: npm nx affected -t deploy --no-agents
43
-
43
+ key : ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
44
+ run-e2e-test :
45
+ runs-on : ubuntu-latest
46
+ name : Try run e2e test
47
+ needs :
48
+ - build-and-test
49
+ services :
50
+ # Label used to access the service container
51
+ postgres :
52
+ # Docker Hub image
53
+ image : postgres
54
+ # Provide the password for postgres
55
+ env :
56
+ POSTGRES_PASSWORD : postgres
57
+ POSTGRES_DB : json-api-db
58
+ # Set health checks to wait until postgres has started
59
+ options : >-
60
+ --health-cmd pg_isready
61
+ --health-interval 10s
62
+ --health-timeout 5s
63
+ --health-retries 5
64
+ ports :
65
+ # Maps tcp port 5432 on service container to the host
66
+ - 5432:5432
67
+ steps :
68
+ - uses : actions/checkout@v4
69
+ with :
70
+ fetch-depth : 0
71
+ - name : Npm install
72
+ uses : ./.github/actions
73
+ - name : Restore cached .nx
74
+ id : cache-nx-restore
75
+ uses : actions/cache/restore@v4
76
+ with :
77
+ path : |
78
+ .nx
79
+ key : ${{ runner.os }}-nx-master"
80
+ - run : git branch --track main origin/master
81
+ - run : npm run typeorm migration:run
82
+ - run : npm run seed:run
83
+ - run : npx nx affected -t e2e --parallel=1
84
+ - name : Save cached .nx
85
+ id : cache-dependencies-save
86
+ uses : actions/cache/save@v4
87
+ with :
88
+ path : |
89
+ .nx
90
+ key : ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
44
91
bump-version :
45
92
name : " Bump version"
46
93
needs :
47
- - build-and -test
94
+ - run-e2e -test
48
95
runs-on : ubuntu-latest
49
96
permissions :
50
97
contents : " write"
0 commit comments