Skip to content

Commit a01fb8d

Browse files
committed
ci: Cache for bump
1 parent 79d0a24 commit a01fb8d

File tree

2 files changed

+58
-10
lines changed

2 files changed

+58
-10
lines changed

.github/workflows/bump-version.yml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,75 @@ jobs:
2323
run: |
2424
echo "GIST_SECRET=${{ secrets.GIST_SECRET }}" >> $GITHUB_ENV
2525
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"
2633
- name: Test and build
2734
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'
2835
- name: Upload test coverage badge
2936
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
3138
id: cache-dependencies-save
3239
uses: actions/cache/save@v4
3340
with:
3441
path: |
3542
.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 }}
4491
bump-version:
4592
name: "Bump version"
4693
needs:
47-
- build-and-test
94+
- run-e2e-test
4895
runs-on: ubuntu-latest
4996
permissions:
5097
contents: "write"

tools/scripts/prepare-for-angular.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ writeFileSync(
1414
promisify(exec)(
1515
`nx run json-api-nestjs-sdk:compile-for-angular`
1616
).then(r => {
17+
console.log(r)
1718
writeFileSync(LIB_ANGULAR_MODULE_PATH, readFileSync(ANGULAR_MODULE_PATH))
1819
}).finally(() => {
1920
unlinkSync(TEMP_FILE_PATH)

0 commit comments

Comments
 (0)