Skip to content

Run unit and e2e tests in parallel #19161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
push:
branches:
- master

pull_request:
branches:
- master
jobs:
cache:
uses: ./.github/workflows/cache-shared-deps.yml
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/test-target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ defaults:

jobs:
run:
name: "${{ inputs.job-name }}"
strategy:
matrix:
test_type: ['unit', 'e2e']
runs-on: ${{ fromJson(inputs.runner) }}
name: "${{ inputs.job-name }} - ${{ matrix.test_type }}"

env:
FORCE_COLOR: "1"
Expand Down Expand Up @@ -121,8 +124,8 @@ jobs:
# 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
JOB_NAME=$(echo "${{ inputs.job-name }}" | sed 's/^\./Dot/')

echo "TEST_RESULTS_DIR=$TEST_RESULTS_BASE_DIR/$JOB_NAME" >> $GITHUB_ENV
echo "TRACE_CAPTURE_FILE=$TRACE_CAPTURE_BASE_DIR/$JOB_NAME" >> $GITHUB_ENV
echo "TEST_RESULTS_DIR=$TEST_RESULTS_BASE_DIR/$JOB_NAME/${{ matrix.test_type }}" >> $GITHUB_ENV
echo "TRACE_CAPTURE_FILE=$TRACE_CAPTURE_BASE_DIR/$JOB_NAME/${{ matrix.test_type }}" >> $GITHUB_ENV

- name: Set up Windows
if: runner.os == 'Windows'
Expand Down Expand Up @@ -215,11 +218,11 @@ jobs:
env:
PYTHONUNBUFFERED: "1"
run: |-
mkdir "${{ env.TRACE_CAPTURE_BASE_DIR }}"
mkdir -p "${{ env.TRACE_CAPTURE_BASE_DIR }}"
python .ddev/ci/scripts/traces.py capture --port "${{ inputs.trace-agent-port }}" --record-file "${{ env.TRACE_CAPTURE_FILE }}" > "${{ env.TRACE_CAPTURE_LOG }}" 2>&1 &

- name: Run Unit & Integration tests
if: inputs.standard && !inputs.minimum-base-package
if: matrix.test_type == 'unit' && !inputs.minimum-base-package
env:
DDEV_TEST_ENABLE_TRACING: "${{ inputs.repo == 'core' && '1' || '0' }}"
run: |
Expand All @@ -239,7 +242,7 @@ jobs:
fi

- name: Run Unit & Integration tests with minimum version of base package
if: inputs.standard && inputs.minimum-base-package
if: matrix.test_type == 'unit' && inputs.minimum-base-package
run: |
if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then
set +e # Disable immediate exit
Expand All @@ -257,7 +260,7 @@ jobs:
fi

- name: Run E2E tests with latest base package
if: inputs.standard && inputs.repo == 'core' && !inputs.minimum-base-package
if: matrix.test_type == 'e2e' && inputs.repo == 'core' && !inputs.minimum-base-package
env:
DD_API_KEY: "${{ secrets.DD_API_KEY }}"
run: |
Expand Down Expand Up @@ -295,7 +298,7 @@ jobs:
fi

- name: Run E2E tests
if: inputs.standard && inputs.repo != 'core'
if: matrix.test_type == 'e2e' && inputs.repo != 'core'
env:
DD_API_KEY: "${{ secrets.DD_API_KEY }}"
run: |
Expand Down Expand Up @@ -387,7 +390,7 @@ jobs:
if: inputs.repo == 'core' && always()
uses: actions/upload-artifact@v4
with:
name: "${{ inputs.traces-artifact-name }}-${{ inputs.target }}-${{ inputs.platform }}"
name: "${{ inputs.traces-artifact-name }}-${{ inputs.target }}-${{ inputs.platform }}-${{ matrix.test_type }}"
path: "${{ env.TRACE_CAPTURE_FILE }}"

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

- name: Upload coverage data
Expand Down
Loading