-
-
Notifications
You must be signed in to change notification settings - Fork 254
165 lines (157 loc) · 5.11 KB
/
checks.yml
File metadata and controls
165 lines (157 loc) · 5.11 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
164
165
name: Checks
on:
push:
branches: [main]
paths-ignore:
- "mkdocs.yml"
- "docs/**"
- "README.md"
pull_request:
branches: [main]
paths-ignore:
- "mkdocs.yml"
- "docs/**"
- "README.md"
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.sha }}"
cancel-in-progress: true
jobs:
detect-modules:
name: Detect packages to check
runs-on: ubuntu-22.04
outputs:
modules: ${{ steps.set-modified-modules.outputs.modules }}
modules_count: ${{ steps.set-modified-modules-count.outputs.modules_count }}
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: changed-files
name: Get changed files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
- id: set-modified-modules
name: Set all modified modules
env:
ALL_CHANGED_FILES: "${{ steps.changed-files.outputs.all_changed_files }}"
run: echo "modules=$(./.github/scripts/changed-modules.sh)" >> $GITHUB_OUTPUT
- id: set-modified-modules-count
name: Set all modified modules count
run: echo "modules_count=$(echo ${{ toJSON(steps.set-modified-modules.outputs.modules) }} | jq '. | length')" >> $GITHUB_OUTPUT
- name: Print out the modules to be used
run: |
echo "${{ steps.set-modified-modules-count.outputs.modules_count }} modules in the build"
echo "${{ steps.set-modified-modules.outputs.modules }}"
lint:
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
name: "Lint"
needs:
- detect-modules
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
runs-on: ubuntu-22.04
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Install Node and Dependencies
id: npm-install-modules
uses: ./.github/actions/npm-setup
with:
runner: ubuntu-22.04
node-version: 24.x
workspace: "${{ matrix.module }}"
- name: Code linting
env:
WORKSPACE_PATH: ${{ steps.npm-install-modules.outputs.workspace_path }}
run: npm run lint:ci
compile:
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
name: Compile
needs:
- detect-modules
- lint
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
runs-on: ubuntu-22.04
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Install Node and Dependencies
id: npm-install
uses: ./.github/actions/npm-setup
with:
runner: ubuntu-22.04
node-version: 24.x
workspace: "${{ matrix.module }}"
- name: Compile
run: |
npm run build --ignore-scripts --workspace packages/testcontainers -- --project tsconfig.json
if [ "${{ matrix.module }}" != "testcontainers" ]; then
npm run build --ignore-scripts --workspace ${{ steps.npm-install.outputs.workspace_path }} -- --project tsconfig.json --noEmit
fi
smoke-test:
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
needs:
- detect-modules
- lint
- compile
name: Smoke tests
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x, 24.x]
runs-on: ubuntu-22.04
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Install Node ${{ matrix.node-version }} and Dependencies
uses: ./.github/actions/npm-setup
with:
runner: ubuntu-22.04
node-version: ${{ matrix.node-version }}
workspace: "testcontainers"
- name: Build testcontainers
run: npm run build --workspace packages/testcontainers
- name: Remove dev dependencies
run: npm prune --omit=dev --workspace packages/testcontainers
- name: Run CommonJS module smoke test
run: node packages/testcontainers/smoke-test.js
- name: Run ES module smoke test
run: node packages/testcontainers/smoke-test.mjs
test:
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
name: Tests
needs:
- detect-modules
- lint
- compile
- smoke-test
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
node-version: [20.x, 22.x, 24.x]
container-runtime: [docker, podman]
uses: ./.github/workflows/test-template.yml
with:
runner: ubuntu-22.04
node-version: ${{ matrix.node-version }}
container-runtime: ${{ matrix.container-runtime }}
workspace: "${{ matrix.module }}"
end:
if: ${{ needs.detect-modules.outputs.modules_count > 0 }}
name: Checks complete
needs:
- detect-modules
- lint
- compile
- smoke-test
- test
runs-on: ubuntu-22.04
steps:
- name: Check if any jobs failed
if: ${{ failure() || cancelled() }}
run: exit 1
- run: echo "All tests completed successfully!"