-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__test-workflow-continuous-integration.yml
More file actions
163 lines (150 loc) · 5.31 KB
/
__test-workflow-continuous-integration.yml
File metadata and controls
163 lines (150 loc) · 5.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Internal - Test Continuous integration workflow
on:
workflow_call:
permissions: {}
jobs:
act-without-container:
name: Act - Run the continuous integration workflow (without container)
uses: ./.github/workflows/continuous-integration.yml
permissions:
contents: read
packages: read
pull-requests: write
security-events: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
with:
working-directory: tests/npm
build: |
{
"artifact": "dist"
}
assert-without-container:
name: Assert - Ensure build artifact has been uploaded (without container)
runs-on: ubuntu-latest
needs: act-without-container
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
artifact-ids: ${{ needs.act-without-container.outputs.build-artifact-id }}
path: "/"
- name: Check the build artifacts
run: test -f tests/npm/dist/test.txt
act-without-container-and-github-reports:
name: Act - Run the continuous integration workflow (without container and GitHub reports)
uses: ./.github/workflows/continuous-integration.yml
permissions:
contents: read
packages: read
pull-requests: write
security-events: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
with:
working-directory: tests/npm
build: |
{
"artifact": "dist"
}
test: |
{"coverage": "github"}
arrange-with-container:
name: Arrange - Build container image for CI workflow
permissions:
id-token: write
contents: read
packages: write
issues: read
pull-requests: read
uses: hoverkraft-tech/ci-github-container/.github/workflows/docker-build-images.yml@df8b445f6cc9661dcb282d897d7146a82e5f2960 # 0.31.0
with:
sign: false
images: |
[{
"name": "ci-npm",
"context": ".",
"dockerfile": "./tests/npm/Dockerfile",
"build-args": { "APP_PATH": "./tests/npm/" },
"target": "ci",
"platforms": ["linux/amd64"]
}]
secrets:
oci-registry-password: ${{ secrets.GITHUB_TOKEN }}
act-with-container:
name: Act - Run the continuous integration workflow (with container)
uses: ./.github/workflows/continuous-integration.yml
needs: arrange-with-container
permissions:
contents: read
packages: read
pull-requests: write
security-events: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
with:
container: ${{ fromJSON(needs.arrange-with-container.outputs.built-images).ci-npm.images[0] }}
working-directory: /usr/src/app/
build: |
{
"artifact": "dist"
}
test: |
{"coverage": "codecov"}
assert-with-container:
name: Assert - Ensure build artifact has been uploaded (with container)
runs-on: ubuntu-latest
needs: act-with-container
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
artifact-ids: ${{ needs.act-with-container.outputs.build-artifact-id }}
path: ${{ runner.temp }}
- name: Check the build artifacts
run: test -f ${{ runner.temp }}/usr/src/app/dist/test.txt
act-with-container-advanced:
name: Act - Run the continuous integration workflow (with container and advanced options)
uses: ./.github/workflows/continuous-integration.yml
needs: arrange-with-container
permissions:
contents: read
packages: read
pull-requests: write
security-events: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
with:
container: |
{
"image": "${{ fromJSON(needs.arrange-with-container.outputs.built-images).ci-npm.images[0] }}",
"env": {
"NODE_ENV": "test",
"CI": "true"
},
"options": "--cpus 1",
"credentials": {
"username": "${{ github.actor }}"
}
}
working-directory: /usr/src/app/
build: |
{
"artifact": "dist"
}
test: |
{"coverage": "codecov"}
secrets:
container-password: ${{ secrets.GITHUB_TOKEN }}
assert-with-container-advanced:
name: Assert - Ensure build artifact has been uploaded (with container advanced)
runs-on: ubuntu-latest
needs: act-with-container-advanced
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
artifact-ids: ${{ needs.act-with-container-advanced.outputs.build-artifact-id }}
path: ${{ runner.temp }}
- name: Check the build artifacts
run: test -f ${{ runner.temp }}/usr/src/app/dist/test.txt