Skip to content

Commit 9098948

Browse files
committed
fix: Splitting tests in different jobs
1 parent 3f290f6 commit 9098948

File tree

1 file changed

+97
-30
lines changed

1 file changed

+97
-30
lines changed

.github/workflows/ci.yaml

Lines changed: 97 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ jobs:
175175
wait-for-processing: true
176176
- name: Report status
177177
run: cargo clippy --all-features --workspace --lib --bins --no-deps -- -D warnings --allow deprecated
178-
test:
178+
test-unit:
179+
name: Unit Tests
179180
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files == 'true' }}
180181
permissions:
181182
contents: read
182183
needs:
183184
- changed_files
184185
runs-on: ubuntu-latest
185186
steps:
186-
# Checkout the repository
187187
- name: Harden the runner (Audit all outbound calls)
188188
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
189189
with:
@@ -202,7 +202,6 @@ jobs:
202202
- name: Install TypeScript and ts-node
203203
run: |
204204
npm install -g typescript ts-node
205-
# Verify installation
206205
ts-node --version
207206
tsc --version
208207
- name: free disk space
@@ -221,41 +220,19 @@ jobs:
221220
uses: ./.github/actions/prepare
222221
with:
223222
components: llvm-tools-preview
224-
225-
# Get the output of the prepare composite action
226223
- name: Get cache-hit output
227224
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
228225
- name: Install cargo hack and cargo-llvm-cov
229226
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
230227
with:
231228
tool: cargo-hack,cargo-llvm-cov
232-
- name: Build
233-
run: cargo test --no-run --locked
234-
235-
# Unit tests coverage
236229
- name: Run Unit Tests and Generate Coverage Report
237230
env:
238231
LLVM_PROFILE_FILE: unit.profraw
239232
RUSTFLAGS: -Cinstrument-coverage
240233
RUST_TEST_THREADS: 1
234+
CARGO_PROFILE_DEV_DEBUG: 1
241235
run: cargo hack llvm-cov --locked --lib --no-cfg-coverage --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path unit-lcov.info
242-
# Integration tests coverage
243-
- name: Run Integration Tests and Generate Coverage Report
244-
env:
245-
LLVM_PROFILE_FILE: integration.profraw
246-
RUSTFLAGS: -Cinstrument-coverage
247-
RUST_TEST_THREADS: 1
248-
run: cargo hack llvm-cov --locked --no-cfg-coverage --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path integration-lcov.info --test integration
249-
250-
# Properties tests coverage
251-
- name: Run Properties Tests
252-
env:
253-
LLVM_PROFILE_FILE: properties.profraw
254-
RUSTFLAGS: -Cinstrument-coverage
255-
RUST_TEST_THREADS: 1
256-
run: cargo hack llvm-cov --locked --no-cfg-coverage --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path properties-lcov.info --test properties
257-
258-
# Upload unit coverage
259236
- name: Upload Unit Coverage to Codecov
260237
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
261238
with:
@@ -264,8 +241,53 @@ jobs:
264241
files: unit-lcov.info
265242
flags: unittests
266243
fail_ci_if_error: true
267-
268-
# Upload integration coverage
244+
test-integration:
245+
name: Integration Tests
246+
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files == 'true' }}
247+
permissions:
248+
contents: read
249+
needs:
250+
- changed_files
251+
runs-on: ubuntu-latest
252+
steps:
253+
- name: Harden the runner (Audit all outbound calls)
254+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
255+
with:
256+
egress-policy: audit
257+
- name: Checkout Code
258+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
259+
- name: Setup Node.js
260+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
261+
with:
262+
node-version: '20'
263+
- name: Install pnpm and plugin dependencies
264+
run: |
265+
npm install -g pnpm
266+
cd plugins
267+
pnpm install
268+
- name: Install TypeScript and ts-node
269+
run: |
270+
npm install -g typescript ts-node
271+
ts-node --version
272+
tsc --version
273+
- name: Prepare
274+
id: init
275+
uses: ./.github/actions/prepare
276+
with:
277+
components: llvm-tools-preview
278+
- name: Get cache-hit output
279+
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
280+
- name: Install cargo hack and cargo-llvm-cov
281+
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
282+
with:
283+
tool: cargo-hack,cargo-llvm-cov
284+
- name: Run Integration Tests and Generate Coverage Report
285+
env:
286+
LLVM_PROFILE_FILE: integration.profraw
287+
RUSTFLAGS: -Cinstrument-coverage
288+
RUST_TEST_THREADS: 1
289+
CARGO_PROFILE_DEV_DEBUG: 1
290+
run: cargo hack llvm-cov --locked --no-cfg-coverage --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path integration-lcov.info --test integration
269291
- name: Upload Integration Coverage to Codecov
270292
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
271293
with:
@@ -274,8 +296,53 @@ jobs:
274296
files: integration-lcov.info
275297
flags: integration
276298
fail_ci_if_error: true
277-
278-
# Upload properties coverage
299+
test-properties:
300+
name: Properties Tests
301+
if: ${{ github.event.pull_request.draft == false && needs.changed_files.outputs.changed-tests-files == 'true' }}
302+
permissions:
303+
contents: read
304+
needs:
305+
- changed_files
306+
runs-on: ubuntu-latest
307+
steps:
308+
- name: Harden the runner (Audit all outbound calls)
309+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
310+
with:
311+
egress-policy: audit
312+
- name: Checkout Code
313+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
314+
- name: Setup Node.js
315+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
316+
with:
317+
node-version: '20'
318+
- name: Install pnpm and plugin dependencies
319+
run: |
320+
npm install -g pnpm
321+
cd plugins
322+
pnpm install
323+
- name: Install TypeScript and ts-node
324+
run: |
325+
npm install -g typescript ts-node
326+
ts-node --version
327+
tsc --version
328+
- name: Prepare
329+
id: init
330+
uses: ./.github/actions/prepare
331+
with:
332+
components: llvm-tools-preview
333+
- name: Get cache-hit output
334+
run: 'echo "Cache hit >>>>>: ${{ steps.init.outputs.cache-hit }}"'
335+
- name: Install cargo hack and cargo-llvm-cov
336+
uses: taiki-e/install-action@92e6dd1c202153a204d471a3c509bf1e03dcfa44 # v2.62.61
337+
with:
338+
tool: cargo-hack,cargo-llvm-cov
339+
- name: Run Properties Tests and Generate Coverage Report
340+
env:
341+
LLVM_PROFILE_FILE: properties.profraw
342+
RUSTFLAGS: -Cinstrument-coverage
343+
RUST_TEST_THREADS: 1
344+
CARGO_PROFILE_DEV_DEBUG: 1
345+
run: cargo hack llvm-cov --locked --no-cfg-coverage --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path properties-lcov.info --test properties
279346
- name: Upload Properties Coverage to Codecov
280347
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
281348
with:

0 commit comments

Comments
 (0)