Skip to content

Commit 5806560

Browse files
committed
Run unit and e2e tests in parallel.
1 parent 2501d5a commit 5806560

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

.github/workflows/master.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
branches:
66
- master
7-
7+
pull_request:
8+
branches:
9+
- master
810
jobs:
911
cache:
1012
uses: ./.github/workflows/cache-shared-deps.yml

.github/workflows/test-target.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ defaults:
9292

9393
jobs:
9494
run:
95-
name: "${{ inputs.job-name }}"
95+
strategy:
96+
matrix:
97+
test_type: ['unit', 'e2e']
9698
runs-on: ${{ fromJson(inputs.runner) }}
99+
name: "${{ inputs.job-name }} - ${{ matrix.test_type }}"
97100

98101
env:
99102
FORCE_COLOR: "1"
@@ -121,8 +124,8 @@ jobs:
121124
# We want to replace leading dots as they will make directories hidden, which will cause them to be ignored by upload-artifact and EnricoMi/publish-unit-test-result-action
122125
JOB_NAME=$(echo "${{ inputs.job-name }}" | sed 's/^\./Dot/')
123126
124-
echo "TEST_RESULTS_DIR=$TEST_RESULTS_BASE_DIR/$JOB_NAME" >> $GITHUB_ENV
125-
echo "TRACE_CAPTURE_FILE=$TRACE_CAPTURE_BASE_DIR/$JOB_NAME" >> $GITHUB_ENV
127+
echo "TEST_RESULTS_DIR=$TEST_RESULTS_BASE_DIR/$JOB_NAME/${{ matrix.test_type }}" >> $GITHUB_ENV
128+
echo "TRACE_CAPTURE_FILE=$TRACE_CAPTURE_BASE_DIR/$JOB_NAME/${{ matrix.test_type }}" >> $GITHUB_ENV
126129
127130
- name: Set up Windows
128131
if: runner.os == 'Windows'
@@ -215,11 +218,11 @@ jobs:
215218
env:
216219
PYTHONUNBUFFERED: "1"
217220
run: |-
218-
mkdir "${{ env.TRACE_CAPTURE_BASE_DIR }}"
221+
mkdir -p "${{ env.TRACE_CAPTURE_BASE_DIR }}"
219222
python .ddev/ci/scripts/traces.py capture --port "${{ inputs.trace-agent-port }}" --record-file "${{ env.TRACE_CAPTURE_FILE }}" > "${{ env.TRACE_CAPTURE_LOG }}" 2>&1 &
220223
221224
- name: Run Unit & Integration tests
222-
if: inputs.standard && !inputs.minimum-base-package
225+
if: matrix.test_type == 'unit' && !inputs.minimum-base-package
223226
env:
224227
DDEV_TEST_ENABLE_TRACING: "${{ inputs.repo == 'core' && '1' || '0' }}"
225228
run: |
@@ -239,7 +242,7 @@ jobs:
239242
fi
240243
241244
- name: Run Unit & Integration tests with minimum version of base package
242-
if: inputs.standard && inputs.minimum-base-package
245+
if: matrix.test_type == 'unit' && inputs.minimum-base-package
243246
run: |
244247
if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then
245248
set +e # Disable immediate exit
@@ -257,7 +260,7 @@ jobs:
257260
fi
258261
259262
- name: Run E2E tests with latest base package
260-
if: inputs.standard && inputs.repo == 'core' && !inputs.minimum-base-package
263+
if: matrix.test_type == 'e2e' && inputs.repo == 'core' && !inputs.minimum-base-package
261264
env:
262265
DD_API_KEY: "${{ secrets.DD_API_KEY }}"
263266
run: |
@@ -295,7 +298,7 @@ jobs:
295298
fi
296299
297300
- name: Run E2E tests
298-
if: inputs.standard && inputs.repo != 'core'
301+
if: matrix.test_type == 'e2e' && inputs.repo != 'core'
299302
env:
300303
DD_API_KEY: "${{ secrets.DD_API_KEY }}"
301304
run: |
@@ -387,7 +390,7 @@ jobs:
387390
if: inputs.repo == 'core' && always()
388391
uses: actions/upload-artifact@v4
389392
with:
390-
name: "${{ inputs.traces-artifact-name }}-${{ inputs.target }}-${{ inputs.platform }}"
393+
name: "${{ inputs.traces-artifact-name }}-${{ inputs.target }}-${{ inputs.platform }}-${{ matrix.test_type }}"
391394
path: "${{ env.TRACE_CAPTURE_FILE }}"
392395

393396
- name: Finalize test results
@@ -402,7 +405,7 @@ jobs:
402405
if: always()
403406
uses: actions/upload-artifact@v4
404407
with:
405-
name: "test-results-${{ inputs.target }}-${{ inputs.platform }}"
408+
name: "test-results-${{ inputs.target }}-${{ inputs.platform }}-${{ matrix.test_type }}"
406409
path: "${{ env.TEST_RESULTS_BASE_DIR }}"
407410

408411
- name: Upload coverage data

0 commit comments

Comments
 (0)