@@ -10,19 +10,20 @@ permissions:
1010 id-token : write
1111
1212jobs :
13- act :
14- name : Act - Run the continuous integration workflow
13+ # Test without container (original behavior)
14+ act-without-container :
15+ name : Act - Run the continuous integration workflow (without container)
1516 uses : ./.github/workflows/continuous-integration.yml
1617 with :
1718 build : |
1819 {
1920 "artifact": "dist"
2021 }
2122
22- assert :
23- name : Assert - Ensure build artifact has been uploaded
23+ assert-without-container :
24+ name : Assert - Ensure build artifact has been uploaded (without container)
2425 runs-on : ubuntu-latest
25- needs : act
26+ needs : act-without-container
2627 steps :
2728 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2829 - uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
3233
3334 - name : Check the build artifacts
3435 run : test -f dist/test.txt
36+
37+ # Test with container
38+ build-test-container :
39+ name : Build - Build test container image
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
43+
44+ - name : Create Dockerfile for testing
45+ run : |
46+ cat > Dockerfile.test << 'EOF'
47+ FROM node:20-alpine
48+ WORKDIR /workspace
49+ COPY tests/npm/package.json tests/npm/package-lock.json ./
50+ RUN npm ci
51+ COPY tests/npm/ ./
52+ EOF
53+
54+ - name : Build test container
55+ run : |
56+ docker build -f Dockerfile.test -t test-ci-container:${{ github.sha }} .
57+
58+ - name : Save container image
59+ run : |
60+ docker save test-ci-container:${{ github.sha }} -o /tmp/test-ci-container.tar
61+
62+ - name : Upload container image
63+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
64+ with :
65+ name : test-container-image
66+ path : /tmp/test-ci-container.tar
67+ retention-days : 1
68+
69+ act-with-container :
70+ name : Act - Run the continuous integration workflow (with container)
71+ runs-on : ubuntu-latest
72+ needs : build-test-container
73+ steps :
74+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
75+
76+ - name : Download container image
77+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
78+ with :
79+ name : test-container-image
80+ path : /tmp
81+
82+ - name : Load container image
83+ run : |
84+ docker load -i /tmp/test-ci-container.tar
85+
86+ - name : Run lint in container
87+ run : |
88+ docker run --rm test-ci-container:${{ github.sha }} npm run lint
89+
90+ - name : Run test in container
91+ run : |
92+ docker run --rm test-ci-container:${{ github.sha }} npm run test:ci
93+
94+ - name : Verify container mode behavior
95+ run : |
96+ echo "Container mode test completed successfully"
0 commit comments