@@ -2,89 +2,107 @@ name: CI Pipeline
22
33on :
44 push :
5- branches : [ main, develop ]
5+ branches : [main, develop]
66 pull_request :
7- branches : [ main, develop ]
7+ branches : [main, develop]
8+ workflow_dispatch :
9+
10+ permissions :
11+ contents : read
812
913jobs :
1014 backend-test :
1115 name : Backend Tests
12- runs-on : ubuntu-latest
16+ runs-on : truenas-website
17+ timeout-minutes : 30
1318
1419 steps :
15- - uses : actions/checkout@v4
16-
17- - name : Set up JDK 21
18- uses : actions/setup-java@v4
19- with :
20- java-version : ' 21'
21- distribution : ' temurin'
22- cache : maven
23-
24- - name : Run Backend Tests
25- run : ./mvnw test
26-
27- - name : Upload Test Results
28- if : always()
29- uses : actions/upload-artifact@v4
30- with :
31- name : backend-test-results
32- path : target/surefire-reports/
20+ - uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
21+
22+ - name : Set up JDK 21
23+ uses : actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
24+ with :
25+ java-version : ' 21'
26+ distribution : temurin
27+ cache : maven
28+
29+ - name : Set up Node.js 24
30+ uses : actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
31+ with :
32+ node-version : ' 24'
33+ cache : npm
34+ cache-dependency-path : frontend/package-lock.json
35+
36+ - name : Run Backend Tests
37+ run : ./mvnw --batch-mode test
38+
39+ - name : Upload Test Results
40+ if : always()
41+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
42+ with :
43+ name : backend-test-results
44+ path : target/surefire-reports/
45+ if-no-files-found : ignore
46+ retention-days : 7
3347
3448 frontend-build :
3549 name : Frontend Build
36- runs-on : ubuntu-latest
50+ runs-on : truenas-website
51+ timeout-minutes : 20
3752
3853 steps :
39- - uses : actions/checkout@v4
40-
41- - name : Set up Node.js
42- uses : actions/setup-node@v4
43- with :
44- node-version : ' 20'
45- cache : ' npm'
46- cache-dependency-path : frontend/package-lock.json
47-
48- - name : Install Dependencies
49- working-directory : ./frontend
50- run : npm ci
51-
52- - name : Build Frontend
53- working-directory : ./frontend
54- run : npm run build
55-
56- - name : Upload Build Artifacts
57- uses : actions/upload-artifact@v4
58- with :
59- name : frontend-build
60- path : src/main/resources/static/
54+ - uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
55+
56+ - name : Set up Node.js 24
57+ uses : actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
58+ with :
59+ node-version : ' 24'
60+ cache : npm
61+ cache-dependency-path : frontend/package-lock.json
62+
63+ - name : Install Dependencies
64+ working-directory : ./frontend
65+ run : npm ci
66+
67+ - name : Build Frontend
68+ working-directory : ./frontend
69+ run : npm run build
70+
71+ - name : Upload Build Artifacts
72+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
73+ with :
74+ name : frontend-build
75+ path : target/generated-resources/static/
76+ if-no-files-found : error
77+ retention-days : 7
6178
6279 docker-build :
63- name : Docker Build Test
64- runs-on : ubuntu-latest
80+ name : Docker Build
81+ runs-on : truenas-website
6582 needs : [backend-test, frontend-build]
83+ timeout-minutes : 40
6684
6785 steps :
68- - uses : actions/checkout@v4
69-
70- - name : Set up Docker Buildx
71- uses : docker/setup-buildx-action@v3
72-
73- - name : Build Docker Image
74- uses : docker/build-push-action@v5
75- with :
76- context : .
77- file : ./Dockerfile
78- push : false
79- load : true
80- tags : website:ci-test
81- cache-from : type=gha
82- cache-to : type=gha,mode=max
83-
84- - name : Test Docker Image
85- run : |
86- docker run -d -p 8080:8080 --name test-app website:ci-test
87- sleep 30
88- curl -f http://localhost:8080/api/client/info || exit 1
89- docker stop test-app
90- docker rm test-app
86+ - uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
87+
88+ - name : Set up authenticated remote BuildKit
89+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
90+ with :
91+ driver : remote
92+ endpoint : tcp://buildkit:1234
93+ driver-opts : |
94+ cacert=/run/buildkit/tls/ca.pem
95+ cert=/run/buildkit/tls/client.pem
96+ key=/run/buildkit/tls/client.key
97+
98+ - name : Build and Smoke Test Runtime Image
99+ uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
100+ with :
101+ context : .
102+ file : ./Dockerfile
103+ target : smoke-test
104+ platforms : linux/amd64
105+ push : false
106+ cache-from : type=gha,version=2,scope=truenas-15ed4a3293d99fba
107+ cache-to : type=gha,version=2,mode=max,scope=truenas-15ed4a3293d99fba
108+ no-cache-filters : smoke-test
0 commit comments