[ci] Merge test jobs into a single generic job (#48175)
This commit is contained in:
parent
15b9805704
commit
8fc6970b90
|
@ -32,10 +32,8 @@ jobs:
|
||||||
runs-on: 'ubuntu-20.04'
|
runs-on: 'ubuntu-20.04'
|
||||||
outputs:
|
outputs:
|
||||||
lint-jobs: ${{ steps.project-jobs.outputs.lint-jobs }}
|
lint-jobs: ${{ steps.project-jobs.outputs.lint-jobs }}
|
||||||
default-test-jobs: ${{ steps.project-jobs.outputs.default-test-jobs }}
|
test-jobs: ${{ steps.project-jobs.outputs.test-jobs }}
|
||||||
e2e-test-jobs: ${{ steps.project-jobs.outputs.e2e-test-jobs }}
|
report-jobs: ${{ steps.project-jobs.outputs.report-jobs }}
|
||||||
api-test-jobs: ${{ steps.project-jobs.outputs.api-test-jobs }}
|
|
||||||
performance-test-jobs: ${{ steps.project-jobs.outputs.performance-test-jobs }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v4'
|
- uses: 'actions/checkout@v4'
|
||||||
name: 'Checkout'
|
name: 'Checkout'
|
||||||
|
@ -69,7 +67,6 @@ jobs:
|
||||||
}
|
}
|
||||||
|
|
||||||
let trigger = ${{ toJson( inputs.trigger ) }};
|
let trigger = ${{ toJson( inputs.trigger ) }};
|
||||||
|
|
||||||
if ( trigger ) {
|
if ( trigger ) {
|
||||||
githubEvent = trigger;
|
githubEvent = trigger;
|
||||||
}
|
}
|
||||||
|
@ -100,42 +97,16 @@ jobs:
|
||||||
- name: 'Lint'
|
- name: 'Lint'
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
||||||
|
|
||||||
project-default-test-jobs:
|
project-test-jobs:
|
||||||
name: "Test - ${{ matrix.projectName }} - ${{ matrix.name }} ${{ matrix.optional && ' (optional)' || '' || ''}}"
|
name: "${{ matrix.name }}"
|
||||||
runs-on: 'ubuntu-20.04'
|
runs-on: 'ubuntu-20.04'
|
||||||
needs: 'project-jobs'
|
needs: 'project-jobs'
|
||||||
if: ${{ needs.project-jobs.outputs.default-test-jobs != '[]' }}
|
if: ${{ needs.project-jobs.outputs.test-jobs != '[]' }}
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include: ${{ fromJSON( needs.project-jobs.outputs.default-test-jobs ) }}
|
|
||||||
steps:
|
|
||||||
- uses: 'actions/checkout@v4'
|
|
||||||
name: 'Checkout'
|
|
||||||
- uses: './.github/actions/setup-woocommerce-monorepo'
|
|
||||||
name: 'Setup Monorepo'
|
|
||||||
id: 'setup-monorepo'
|
|
||||||
with:
|
|
||||||
install: '${{ matrix.projectName }}...'
|
|
||||||
build: '${{ matrix.projectName }}'
|
|
||||||
- name: 'Start Test Environment'
|
|
||||||
id: 'prepare-test-environment'
|
|
||||||
if: ${{ matrix.testEnv.shouldCreate }}
|
|
||||||
env: ${{ matrix.testEnv.envVars }}
|
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'
|
|
||||||
- name: 'Test'
|
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
|
||||||
|
|
||||||
project-e2e-test-jobs:
|
|
||||||
name: "E2E - ${{ matrix.name }} ${{ matrix.optional && ' (optional)' || ''}}"
|
|
||||||
runs-on: 'ubuntu-20.04'
|
|
||||||
needs: 'project-jobs'
|
|
||||||
if: ${{ needs.project-jobs.outputs.e2e-test-jobs != '[]' }}
|
|
||||||
env: ${{ matrix.testEnv.envVars }}
|
env: ${{ matrix.testEnv.envVars }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include: ${{ fromJSON( needs.project-jobs.outputs.e2e-test-jobs ) }}
|
include: ${{ fromJSON( needs.project-jobs.outputs.test-jobs ) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: 'actions/checkout@v4'
|
- uses: 'actions/checkout@v4'
|
||||||
name: 'Checkout'
|
name: 'Checkout'
|
||||||
|
@ -144,8 +115,8 @@ jobs:
|
||||||
name: 'Install Monorepo'
|
name: 'Install Monorepo'
|
||||||
id: 'install-monorepo'
|
id: 'install-monorepo'
|
||||||
with:
|
with:
|
||||||
install: '${{ matrix.projectName }}...'
|
install: '${{ matrix.projectName }}...'
|
||||||
build: 'false'
|
build: 'false'
|
||||||
|
|
||||||
- uses: './.github/actions/setup-woocommerce-monorepo'
|
- uses: './.github/actions/setup-woocommerce-monorepo'
|
||||||
if: ${{ github.ref_type != 'tag' }}
|
if: ${{ github.ref_type != 'tag' }}
|
||||||
|
@ -155,127 +126,60 @@ jobs:
|
||||||
install: 'false'
|
install: 'false'
|
||||||
build: ${{ matrix.projectName }}
|
build: ${{ matrix.projectName }}
|
||||||
|
|
||||||
- name: Get commit message
|
|
||||||
id: get_commit_message
|
|
||||||
env:
|
|
||||||
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
||||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
||||||
run: |
|
|
||||||
if [[ "${{ github.event_name }}" == "push" ]]; then
|
|
||||||
COMMIT_MESSAGE=`echo "$HEAD_COMMIT_MESSAGE" | head -1`
|
|
||||||
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
||||||
COMMIT_MESSAGE="$PR_TITLE"
|
|
||||||
else
|
|
||||||
COMMIT_MESSAGE="${{ github.event_name }}"
|
|
||||||
fi
|
|
||||||
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> "$GITHUB_OUTPUT"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: 'Update wp-env config'
|
- name: 'Update wp-env config'
|
||||||
if: ${{ github.ref_type == 'tag' }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
env:
|
env:
|
||||||
RELEASE_TAG: ${{ github.ref_name }}
|
RELEASE_TAG: ${{ github.ref_name }}
|
||||||
ARTIFACT_NAME: ${{ github.ref_name == 'nightly' && 'woocommerce-trunk-nightly.zip' || 'woocommerce.zip' }}
|
ARTIFACT_NAME: ${{ github.ref_name == 'nightly' && 'woocommerce-trunk-nightly.zip' || 'woocommerce.zip' }}
|
||||||
working-directory: ${{ matrix.projectPath }}
|
working-directory: ${{ matrix.projectPath }}
|
||||||
run: node ./tests/e2e-pw/bin/override-wp-env-plugins.js
|
run: node ./tests/e2e-pw/bin/override-wp-env-plugins.js
|
||||||
|
|
||||||
- name: 'Start Test Environment'
|
- name: 'Start Test Environment'
|
||||||
id: 'prepare-test-environment'
|
id: 'prepare-test-environment'
|
||||||
if: ${{ matrix.testEnv.shouldCreate }}
|
if: ${{ matrix.testEnv.shouldCreate }}
|
||||||
|
env: ${{ matrix.testEnv.envVars }}
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'
|
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'
|
||||||
|
|
||||||
|
- name: 'Get commit message'
|
||||||
|
id: 'get_commit_message'
|
||||||
|
env:
|
||||||
|
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
COMMIT_MESSAGE=`echo "$HEAD_COMMIT_MESSAGE" | head -1`
|
||||||
|
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
COMMIT_MESSAGE="$PR_TITLE"
|
||||||
|
else
|
||||||
|
COMMIT_MESSAGE="${{ github.event_name }}"
|
||||||
|
fi
|
||||||
|
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> "$GITHUB_OUTPUT"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: 'Run tests'
|
- name: 'Run tests'
|
||||||
env:
|
env:
|
||||||
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_CORE_E2E_TOKEN }}
|
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_CORE_E2E_TOKEN }}
|
||||||
BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.get_commit_message.outputs.COMMIT_MESSAGE }}
|
BUILDKITE_ANALYTICS_MESSAGE: ${{ steps.get_commit_message.outputs.COMMIT_MESSAGE }}
|
||||||
|
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }} # required by Metrics tests
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
||||||
|
|
||||||
- name: 'Upload artifacts'
|
- name: 'Upload artifacts'
|
||||||
if: ${{ always() }}
|
if: ${{ always() && matrix.report.resultsPath != '' }}
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: all-blob-e2e-reports-${{ strategy.job-index }}
|
name: '${{ matrix.report.resultsBlobName }}-${{ strategy.job-index }}'
|
||||||
path: ${{ matrix.projectPath }}/tests/e2e-pw/test-results
|
path: '${{ matrix.projectPath }}/${{ matrix.report.resultsPath }}'
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
compression-level: 9
|
compression-level: 9
|
||||||
|
|
||||||
project-api-test-jobs:
|
|
||||||
name: "API - ${{ matrix.name }} ${{ matrix.optional && ' (optional)' || ''}}"
|
|
||||||
runs-on: 'ubuntu-20.04'
|
|
||||||
needs: 'project-jobs'
|
|
||||||
if: ${{ needs.project-jobs.outputs.api-test-jobs != '[]' }}
|
|
||||||
env: ${{ matrix.testEnv.envVars }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include: ${{ fromJSON( needs.project-jobs.outputs.api-test-jobs ) }}
|
|
||||||
steps:
|
|
||||||
- uses: 'actions/checkout@v4'
|
|
||||||
name: 'Checkout'
|
|
||||||
|
|
||||||
- uses: './.github/actions/setup-woocommerce-monorepo'
|
|
||||||
name: 'Setup Monorepo'
|
|
||||||
id: 'setup-monorepo'
|
|
||||||
with:
|
|
||||||
install: '${{ matrix.projectName }}...'
|
|
||||||
build: '${{ matrix.projectName }}'
|
|
||||||
|
|
||||||
- name: 'Start Test Environment'
|
|
||||||
id: 'prepare-test-environment'
|
|
||||||
if: ${{ matrix.testEnv.shouldCreate }}
|
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'
|
|
||||||
|
|
||||||
- name: 'Run tests'
|
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
|
||||||
|
|
||||||
- name: 'Upload artifacts'
|
|
||||||
if: ${{ always() }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: all-blob-api-reports-${{ strategy.job-index }}
|
|
||||||
path: ${{ matrix.projectPath }}/tests/api-core-tests/test-results/allure-results
|
|
||||||
retention-days: 1
|
|
||||||
compression-level: 9
|
|
||||||
|
|
||||||
project-performance-test-jobs:
|
|
||||||
name: "Performance - ${{ matrix.name }} ${{ matrix.optional && ' (optional)' || ''}}"
|
|
||||||
runs-on: 'ubuntu-20.04'
|
|
||||||
needs: 'project-jobs'
|
|
||||||
if: ${{ needs.project-jobs.outputs.performance-test-jobs != '[]' }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include: ${{ fromJSON( needs.project-jobs.outputs.performance-test-jobs ) }}
|
|
||||||
env:
|
|
||||||
WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: 'actions/checkout@v4'
|
|
||||||
name: 'Checkout'
|
|
||||||
|
|
||||||
- uses: './.github/actions/setup-woocommerce-monorepo'
|
|
||||||
name: 'Setup Monorepo'
|
|
||||||
id: 'setup-monorepo'
|
|
||||||
with:
|
|
||||||
install: '${{ matrix.projectName }}...'
|
|
||||||
build: '${{ matrix.projectName }}'
|
|
||||||
|
|
||||||
- name: 'Start Test Environment'
|
|
||||||
id: 'prepare-test-environment'
|
|
||||||
if: ${{ matrix.testEnv.shouldCreate }}
|
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.testEnv.start }}'
|
|
||||||
|
|
||||||
- name: 'Run tests'
|
|
||||||
env:
|
|
||||||
CODEVITALS_PROJECT_TOKEN: ${{ secrets.CODEVITALS_PROJECT_TOKEN }}
|
|
||||||
run: 'pnpm --filter="${{ matrix.projectName }}" ${{ matrix.command }}'
|
|
||||||
|
|
||||||
- name: 'Archive metrics results'
|
- name: 'Archive metrics results'
|
||||||
if: ${{ success() && matrix.name == 'Metrics' }}
|
if: ${{ success() && startsWith(matrix.name, 'Metrics') }} # this seems too fragile, we should update the reporting path and use the generic upload step above
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@v4
|
||||||
|
env:
|
||||||
|
WP_ARTIFACTS_PATH: ${{ github.workspace }}/artifacts
|
||||||
with:
|
with:
|
||||||
name: metrics-results
|
name: metrics-results
|
||||||
path: ${{ env.WP_ARTIFACTS_PATH }}/*.performance-results*.json
|
path: ${{ env.WP_ARTIFACTS_PATH }}/*.performance-results*.json
|
||||||
|
|
||||||
evaluate-project-jobs:
|
evaluate-project-jobs:
|
||||||
# In order to add a required status check we need a consistent job that we can grab onto.
|
# In order to add a required status check we need a consistent job that we can grab onto.
|
||||||
|
@ -289,10 +193,7 @@ jobs:
|
||||||
[
|
[
|
||||||
'project-jobs',
|
'project-jobs',
|
||||||
'project-lint-jobs',
|
'project-lint-jobs',
|
||||||
'project-default-test-jobs',
|
'project-test-jobs',
|
||||||
'project-e2e-test-jobs',
|
|
||||||
'project-api-test-jobs',
|
|
||||||
'project-performance-test-jobs',
|
|
||||||
]
|
]
|
||||||
if: ${{ always() && github.event_name == 'pull_request' }}
|
if: ${{ always() && github.event_name == 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -321,10 +222,7 @@ jobs:
|
||||||
[
|
[
|
||||||
'project-jobs',
|
'project-jobs',
|
||||||
'project-lint-jobs',
|
'project-lint-jobs',
|
||||||
'project-default-test-jobs',
|
'project-test-jobs',
|
||||||
'project-e2e-test-jobs',
|
|
||||||
'project-api-test-jobs',
|
|
||||||
'project-performance-test-jobs',
|
|
||||||
]
|
]
|
||||||
if: ${{ always() && github.event_name != 'pull_request' }}
|
if: ${{ always() && github.event_name != 'pull_request' }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -342,20 +240,32 @@ jobs:
|
||||||
SLACK_CHANNEL: ${{ secrets.TEST_REPORTS_SLACK_CHANNEL }}
|
SLACK_CHANNEL: ${{ secrets.TEST_REPORTS_SLACK_CHANNEL }}
|
||||||
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
INPUT_TRIGGER: ${{ inputs.trigger }}
|
INPUT_TRIGGER: ${{ inputs.trigger }}
|
||||||
|
RUN_TYPE: ${{ github.ref_type == 'tag' && (github.ref_name == 'nightly' && 'nightly-checks' || 'release-checks') || '' }}
|
||||||
run: |
|
run: |
|
||||||
COMMIT_MESSAGE=`echo "$HEAD_COMMIT_MESSAGE" | head -1`
|
COMMIT_MESSAGE=`echo "$HEAD_COMMIT_MESSAGE" | head -1`
|
||||||
|
|
||||||
pnpm utils slack-test-report -c "${{ needs.project-jobs.result }}" -r "$INPUT_TRIGGER Build jobs matrix" -m "$COMMIT_MESSAGE"
|
if [[ -n "${INPUT_TRIGGER}" ]]; then
|
||||||
pnpm utils slack-test-report -c "${{ needs.project-lint-jobs.result }}" -r "$INPUT_TRIGGER Linting" -m "$COMMIT_MESSAGE"
|
CHECKS_TYPE="${INPUT_TRIGGER}"
|
||||||
pnpm utils slack-test-report -c "${{ needs.project-default-test-jobs.result }}" -r "$INPUT_TRIGGER Tests" -m "$COMMIT_MESSAGE"
|
else
|
||||||
pnpm utils slack-test-report -c "${{ needs.project-e2e-test-jobs.result }}" -r "$INPUT_TRIGGER e2e tests" -m "$COMMIT_MESSAGE"
|
CHECKS_TYPE="${RUN_TYPE}"
|
||||||
pnpm utils slack-test-report -c "${{ needs.project-api-test-jobs.result }}" -r "$INPUT_TRIGGER Api tests" -m "$COMMIT_MESSAGE"
|
fi
|
||||||
pnpm utils slack-test-report -c "${{ needs.project-performance-test-jobs.result }}" -r "$INPUT_TRIGGER Performance tests" -m "$COMMIT_MESSAGE"
|
|
||||||
|
|
||||||
e2e-test-reports:
|
pnpm utils slack-test-report -c "${{ needs.project-jobs.result }}" -r "$CHECKS_TYPE Build jobs matrix" -m "$COMMIT_MESSAGE"
|
||||||
name: 'Report e2e tests results'
|
pnpm utils slack-test-report -c "${{ needs.project-lint-jobs.result }}" -r "$CHECKS_TYPE Linting" -m "$COMMIT_MESSAGE"
|
||||||
needs: [project-e2e-test-jobs]
|
pnpm utils slack-test-report -c "${{ needs.project-test-jobs.result }}" -r "$CHECKS_TYPE Tests" -m "$COMMIT_MESSAGE"
|
||||||
if: ${{ ! cancelled() && needs.project-e2e-test-jobs.result != 'skipped' }}
|
|
||||||
|
test-reports:
|
||||||
|
name: 'Publish reports - ${{ matrix.report }}'
|
||||||
|
needs:
|
||||||
|
[
|
||||||
|
'project-jobs',
|
||||||
|
'project-test-jobs',
|
||||||
|
]
|
||||||
|
if: ${{ always() && needs.project-jobs.outputs.report-jobs != '[]' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
report: ${{ fromJSON( needs.project-jobs.outputs.report-jobs ) }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -370,8 +280,8 @@ jobs:
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: ./out
|
path: ./out
|
||||||
pattern: all-blob-e2e-reports-*
|
pattern: ${{ matrix.report }}-*
|
||||||
run-id: project-e2e-test-jobs
|
run-id: project-test-jobs
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: 'Generate Allure report'
|
- name: 'Generate Allure report'
|
||||||
|
@ -381,16 +291,17 @@ jobs:
|
||||||
- name: 'Archive reports'
|
- name: 'Archive reports'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: e2e-test-report
|
name: ${{ matrix.report }}
|
||||||
path: ./out
|
path: ./out
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
- name: 'Send workflow dispatch'
|
- name: 'Publish report to dashboard'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
GH_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
RUN_ID: ${{ github.run_id }}
|
RUN_ID: ${{ github.run_id }}
|
||||||
|
if: ${{ contains(matrix.report, 'e2e') }} # temporary until we adapt the woocommerce-test-reports side to not care about the test type
|
||||||
run: |
|
run: |
|
||||||
if [ "$GITHUB_EVENT_NAME" == pull_request ]; then
|
if [ "$GITHUB_EVENT_NAME" == pull_request ]; then
|
||||||
gh workflow run publish-test-reports-pr.yml \
|
gh workflow run publish-test-reports-pr.yml \
|
||||||
|
@ -416,63 +327,3 @@ jobs:
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
run: |
|
run: |
|
||||||
echo "::notice::🔗🔗 The e2e report for this run is available at https://woocommerce.github.io/woocommerce-test-reports/pr/${{ github.event.pull_request.number }}/e2e"
|
echo "::notice::🔗🔗 The e2e report for this run is available at https://woocommerce.github.io/woocommerce-test-reports/pr/${{ github.event.pull_request.number }}/e2e"
|
||||||
|
|
||||||
api-test-reports:
|
|
||||||
name: 'Report API tests results'
|
|
||||||
needs: [project-api-test-jobs]
|
|
||||||
if: ${{ ! cancelled() && needs.project-api-test-jobs.result != 'skipped'}}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: 'Install Allure CLI'
|
|
||||||
env:
|
|
||||||
DESTINATION_PATH: ../
|
|
||||||
run: ./.github/workflows/scripts/install-allure.sh
|
|
||||||
|
|
||||||
- name: 'Download blob reports from artifacts'
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: ./out/allure-results
|
|
||||||
pattern: all-blob-api-reports-*
|
|
||||||
run-id: project-api-test-jobs
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: 'Generate Allure report'
|
|
||||||
id: generate_allure_report
|
|
||||||
run: allure generate --clean ./out/allure-results --output ./out/allure-report
|
|
||||||
|
|
||||||
- name: 'Archive reports'
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: api-test-report
|
|
||||||
path: ./out
|
|
||||||
if-no-files-found: ignore
|
|
||||||
retention-days: 5
|
|
||||||
|
|
||||||
- name: 'Publish reports'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.REPORTS_TOKEN }}
|
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
RUN_ID: ${{ github.run_id }}
|
|
||||||
run: |
|
|
||||||
if [ "$GITHUB_EVENT_NAME" == pull_request ]; then
|
|
||||||
gh workflow run publish-test-reports-pr.yml \
|
|
||||||
-f run_id=$RUN_ID \
|
|
||||||
-f api_artifact=api-test-report \
|
|
||||||
-f pr_number=$PR_NUMBER \
|
|
||||||
-f commit_sha=$GITHUB_SHA \
|
|
||||||
-f s3_root=public \
|
|
||||||
--repo woocommerce/woocommerce-test-reports
|
|
||||||
elif [ "$GITHUB_EVENT_NAME" == push ]; then
|
|
||||||
gh workflow run publish-test-reports-trunk-merge.yml \
|
|
||||||
-f run_id=$RUN_ID \
|
|
||||||
-f artifact=api-test-report \
|
|
||||||
-f pr_number=$PR_NUMBER \
|
|
||||||
-f commit_sha=$GITHUB_SHA \
|
|
||||||
-f test_type="api" \
|
|
||||||
--repo woocommerce/woocommerce-test-reports
|
|
||||||
else
|
|
||||||
echo "No report will be created for '$GITHUB_EVENT_NAME' event"
|
|
||||||
fi
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
const { REPOSITORY, RUN_ID, GITHUB_TOKEN, TEST_MODE } = process.env;
|
const { REPOSITORY, RUN_ID, GITHUB_TOKEN, TEST_MODE } = process.env;
|
||||||
const IGNORED_JOBS = [
|
const IGNORED_JOBS = [
|
||||||
'Evaluate Project Job Statuses',
|
'Evaluate Project Job Statuses',
|
||||||
'Report e2e tests results',
|
'Report tests results',
|
||||||
'Report API tests results',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const isJobRequired = ( job ) => {
|
const isJobRequired = ( job ) => {
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
CI: merge test jobs
|
|
@ -250,7 +250,12 @@
|
||||||
"pull_request",
|
"pull_request",
|
||||||
"push",
|
"push",
|
||||||
"release-checks"
|
"release-checks"
|
||||||
]
|
],
|
||||||
|
"report": {
|
||||||
|
"resultsBlobName": "core-e2e-report",
|
||||||
|
"resultsPath": "tests/e2e-pw/test-results",
|
||||||
|
"allure": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Core e2e tests - Gutenberg stable",
|
"name": "Core e2e tests - Gutenberg stable",
|
||||||
|
@ -266,6 +271,7 @@
|
||||||
"changes": [],
|
"changes": [],
|
||||||
"events": [
|
"events": [
|
||||||
"daily-e2e",
|
"daily-e2e",
|
||||||
|
"nightly-checks",
|
||||||
"release-checks"
|
"release-checks"
|
||||||
],
|
],
|
||||||
"testEnv": {
|
"testEnv": {
|
||||||
|
@ -286,8 +292,7 @@
|
||||||
"changes": [],
|
"changes": [],
|
||||||
"events": [
|
"events": [
|
||||||
"daily-e2e",
|
"daily-e2e",
|
||||||
"release-checks",
|
"release-checks"
|
||||||
"nightly-checks"
|
|
||||||
],
|
],
|
||||||
"testEnv": {
|
"testEnv": {
|
||||||
"start": "env:test"
|
"start": "env:test"
|
||||||
|
@ -364,6 +369,10 @@
|
||||||
"config": {
|
"config": {
|
||||||
"disableHpos": true
|
"disableHpos": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"report": {
|
||||||
|
"resultsBlobName": "all-blob-e2e-reports-non-hpos",
|
||||||
|
"resultsPath": "tests/e2e-pw/test-results"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -431,7 +440,12 @@
|
||||||
"events": [
|
"events": [
|
||||||
"pull_request",
|
"pull_request",
|
||||||
"push"
|
"push"
|
||||||
]
|
],
|
||||||
|
"report": {
|
||||||
|
"resultsBlobName": "core-api-report",
|
||||||
|
"resultsPath": "tests/api-core-tests/test-results",
|
||||||
|
"allure": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Core API tests - HPOS disabled",
|
"name": "Core API tests - HPOS disabled",
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -77,7 +77,7 @@
|
||||||
},
|
},
|
||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"name": "JavaScript",
|
"name": "Monorepo Utils JS Tests",
|
||||||
"command": "test:js",
|
"command": "test:js",
|
||||||
"changes": [
|
"changes": [
|
||||||
"jest.config.js",
|
"jest.config.js",
|
||||||
|
|
|
@ -12,7 +12,6 @@ import { buildProjectGraph } from './lib/project-graph';
|
||||||
import { getFileChanges } from './lib/file-changes';
|
import { getFileChanges } from './lib/file-changes';
|
||||||
import { createJobsForChanges } from './lib/job-processing';
|
import { createJobsForChanges } from './lib/job-processing';
|
||||||
import { isGithubCI } from '../core/environment';
|
import { isGithubCI } from '../core/environment';
|
||||||
import { testTypes } from './lib/config';
|
|
||||||
|
|
||||||
const program = new Command( 'ci-jobs' )
|
const program = new Command( 'ci-jobs' )
|
||||||
.description(
|
.description(
|
||||||
|
@ -62,15 +61,28 @@ const program = new Command( 'ci-jobs' )
|
||||||
} );
|
} );
|
||||||
Logger.endTask( true );
|
Logger.endTask( true );
|
||||||
|
|
||||||
|
// Rename the test jobs to include the project name and test type.
|
||||||
|
for ( const job of jobs.test ) {
|
||||||
|
const optional = job.optional ? ' (optional)' : '';
|
||||||
|
job.name = `${ job.name } - ${ job.projectName } [${ job.testType }]${ optional }`;
|
||||||
|
Logger.notice( `- ${ job.name }` );
|
||||||
|
}
|
||||||
|
|
||||||
|
const resultsBlobNames = jobs.test
|
||||||
|
.map( ( job ) => {
|
||||||
|
if ( job.report && job.report.allure ) {
|
||||||
|
return job.report.resultsBlobName;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
} )
|
||||||
|
.filter( Boolean );
|
||||||
|
|
||||||
|
const reports = [ ...new Set( resultsBlobNames ) ];
|
||||||
|
|
||||||
if ( isGithubCI() ) {
|
if ( isGithubCI() ) {
|
||||||
setOutput( 'lint-jobs', JSON.stringify( jobs.lint ) );
|
setOutput( 'lint-jobs', JSON.stringify( jobs.lint ) );
|
||||||
|
setOutput( 'test-jobs', JSON.stringify( jobs.test ) );
|
||||||
testTypes.forEach( ( type ) => {
|
setOutput( 'report-jobs', JSON.stringify( reports ) );
|
||||||
setOutput(
|
|
||||||
`${ type }-test-jobs`,
|
|
||||||
JSON.stringify( jobs[ `${ type }Test` ] )
|
|
||||||
);
|
|
||||||
} );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,19 +98,21 @@ const program = new Command( 'ci-jobs' )
|
||||||
Logger.notice( 'No lint jobs to run.' );
|
Logger.notice( 'No lint jobs to run.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
testTypes.forEach( ( type ) => {
|
if ( jobs.test.length > 0 ) {
|
||||||
if ( jobs[ `${ type }Test` ].length > 0 ) {
|
Logger.notice( `Test Jobs` );
|
||||||
Logger.notice( `${ type } test Jobs` );
|
for ( const job of jobs.test ) {
|
||||||
for ( const job of jobs[ `${ type }Test` ] ) {
|
Logger.notice( `- ${ job.name }` );
|
||||||
const optional = job.optional ? ' (optional)' : '';
|
|
||||||
Logger.notice(
|
|
||||||
`- ${ job.projectName } - ${ job.name }${ optional }`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Logger.notice( `No ${ type } test jobs to run.` );
|
|
||||||
}
|
}
|
||||||
} );
|
} else {
|
||||||
|
Logger.notice( `No test jobs to run.` );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( reports.length > 0 ) {
|
||||||
|
Logger.notice( `Report Jobs` );
|
||||||
|
Logger.notice( `${ reports }` );
|
||||||
|
} else {
|
||||||
|
Logger.notice( `No report jobs to run.` );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
export default program;
|
export default program;
|
||||||
|
|
|
@ -136,7 +136,7 @@ describe( 'Config', () => {
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
testType: 'default',
|
testType: 'unit',
|
||||||
shardingArguments: [],
|
shardingArguments: [],
|
||||||
name: 'default',
|
name: 'default',
|
||||||
changes: [
|
changes: [
|
||||||
|
@ -192,6 +192,47 @@ describe( 'Config', () => {
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
it( 'should parse test config with report', () => {
|
||||||
|
const parsed = parseCIConfig( {
|
||||||
|
name: 'foo',
|
||||||
|
config: {
|
||||||
|
ci: {
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
name: 'default',
|
||||||
|
changes: '/src/**/*.{js,jsx,ts,tsx}',
|
||||||
|
command: 'foo',
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'foo-blob-report',
|
||||||
|
resultsPath: '/test-results',
|
||||||
|
allure: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} );
|
||||||
|
|
||||||
|
expect( parsed ).toMatchObject( {
|
||||||
|
jobs: [
|
||||||
|
{
|
||||||
|
type: JobType.Test,
|
||||||
|
name: 'default',
|
||||||
|
changes: [
|
||||||
|
/^package\.json$/,
|
||||||
|
makeRe( '/src/**/*.{js,jsx,ts,tsx}' ),
|
||||||
|
],
|
||||||
|
command: 'foo',
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'foo-blob-report',
|
||||||
|
resultsPath: '/test-results',
|
||||||
|
allure: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
it( 'should parse test config with cascade', () => {
|
it( 'should parse test config with cascade', () => {
|
||||||
const parsed = parseCIConfig( {
|
const parsed = parseCIConfig( {
|
||||||
name: 'foo',
|
name: 'foo',
|
||||||
|
@ -263,10 +304,10 @@ describe( 'Config', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each( [
|
it.each( [
|
||||||
[ '', 'default' ],
|
[ '', 'unit' ],
|
||||||
[ 'bad', 'default' ],
|
[ 'bad', 'unit' ],
|
||||||
[ 1, 'default' ],
|
[ 1, 'unit' ],
|
||||||
[ undefined, 'default' ],
|
[ undefined, 'unit' ],
|
||||||
] )(
|
] )(
|
||||||
'should parse test config with unexpected testType',
|
'should parse test config with unexpected testType',
|
||||||
( input, result ) => {
|
( input, result ) => {
|
||||||
|
|
|
@ -303,7 +303,7 @@ describe( 'Job Processing', () => {
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger test job for single node', async () => {
|
it( 'should trigger test job for single node', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
|
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
|
@ -331,8 +331,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 1 );
|
expect( jobs.test ).toHaveLength( 1 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -342,11 +342,12 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should replace vars in test command', async () => {
|
it( 'should replace vars in test command', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -378,8 +379,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 1 );
|
expect( jobs.test ).toHaveLength( 1 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -389,11 +390,12 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should not trigger a test job that has already been created', async () => {
|
it( 'should not trigger a test job that has already been created', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -421,11 +423,11 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 0 );
|
expect( jobs.test ).toHaveLength( 0 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should not trigger test job for single node with no changes', async () => {
|
it( 'should not trigger test job for single node with no changes', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -450,11 +452,11 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 0 );
|
expect( jobs.test ).toHaveLength( 0 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger test job for project graph', async () => {
|
it( 'should trigger test job for project graph', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -480,7 +482,7 @@ describe( 'Job Processing', () => {
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
testType: 'default',
|
testType: 'unit',
|
||||||
name: 'Default A',
|
name: 'Default A',
|
||||||
shardingArguments: [],
|
shardingArguments: [],
|
||||||
events: [],
|
events: [],
|
||||||
|
@ -498,7 +500,7 @@ describe( 'Job Processing', () => {
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
testType: 'default',
|
testType: 'unit',
|
||||||
name: 'Default B',
|
name: 'Default B',
|
||||||
shardingArguments: [],
|
shardingArguments: [],
|
||||||
events: [],
|
events: [],
|
||||||
|
@ -520,8 +522,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 2 );
|
expect( jobs.test ).toHaveLength( 2 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -531,8 +533,9 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test-b',
|
projectName: 'test-b',
|
||||||
projectPath: 'test-b',
|
projectPath: 'test-b',
|
||||||
name: 'Default B',
|
name: 'Default B',
|
||||||
|
@ -542,6 +545,7 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
@ -574,8 +578,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 1 );
|
expect( jobs.test ).toHaveLength( 1 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -585,12 +589,13 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
it( 'should trigger test job for dependent without changes when dependency has matching cascade key', async () => {
|
it( 'should trigger test job for dependent without changes when dependency has matching cascade key', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -617,7 +622,7 @@ describe( 'Job Processing', () => {
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
testType: 'default',
|
testType: 'unit',
|
||||||
name: 'Default A',
|
name: 'Default A',
|
||||||
shardingArguments: [],
|
shardingArguments: [],
|
||||||
events: [],
|
events: [],
|
||||||
|
@ -638,8 +643,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 2 );
|
expect( jobs.test ).toHaveLength( 2 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -649,8 +654,9 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test-a',
|
projectName: 'test-a',
|
||||||
projectPath: 'test-a',
|
projectPath: 'test-a',
|
||||||
name: 'Default A',
|
name: 'Default A',
|
||||||
|
@ -660,11 +666,12 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType,
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should isolate dependency cascade keys to prevent cross-dependency matching', async () => {
|
it( 'should isolate dependency cascade keys to prevent cross-dependency matching', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -691,7 +698,7 @@ describe( 'Job Processing', () => {
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
testType: 'default',
|
testType: 'unit',
|
||||||
name: 'Default A',
|
name: 'Default A',
|
||||||
shardingArguments: [],
|
shardingArguments: [],
|
||||||
events: [],
|
events: [],
|
||||||
|
@ -710,7 +717,7 @@ describe( 'Job Processing', () => {
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
testType: 'default',
|
testType: 'unit',
|
||||||
name: 'Default B',
|
name: 'Default B',
|
||||||
shardingArguments: [],
|
shardingArguments: [],
|
||||||
events: [],
|
events: [],
|
||||||
|
@ -731,8 +738,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 2 );
|
expect( jobs.test ).toHaveLength( 2 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -742,8 +749,9 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
} );
|
} );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test-a',
|
projectName: 'test-a',
|
||||||
projectPath: 'test-a',
|
projectPath: 'test-a',
|
||||||
name: 'Default A',
|
name: 'Default A',
|
||||||
|
@ -753,11 +761,12 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger test job for single node and parse test environment config', async () => {
|
it( 'should trigger test job for single node and parse test environment config', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
jest.mocked( parseTestEnvConfig ).mockResolvedValue( {
|
jest.mocked( parseTestEnvConfig ).mockResolvedValue( {
|
||||||
WP_ENV_CORE: 'https://wordpress.org/latest.zip',
|
WP_ENV_CORE: 'https://wordpress.org/latest.zip',
|
||||||
} );
|
} );
|
||||||
|
@ -799,8 +808,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 1 );
|
expect( jobs.test ).toHaveLength( 1 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -813,11 +822,12 @@ describe( 'Job Processing', () => {
|
||||||
WP_ENV_CORE: 'https://wordpress.org/latest.zip',
|
WP_ENV_CORE: 'https://wordpress.org/latest.zip',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger all jobs for a single node with changes set to "true"', async () => {
|
it( 'should trigger all jobs for a single node with changes set to "true"', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -853,8 +863,8 @@ describe( 'Job Processing', () => {
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
command: 'test-lint',
|
command: 'test-lint',
|
||||||
} );
|
} );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 1 );
|
expect( jobs.test ).toHaveLength( 1 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -864,11 +874,12 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger sharded test jobs for single node', async () => {
|
it( 'should trigger sharded test jobs for single node', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -898,8 +909,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 2 );
|
expect( jobs.test ).toHaveLength( 2 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toEqual(
|
expect( jobs.test ).toEqual(
|
||||||
expect.arrayContaining( [
|
expect.arrayContaining( [
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -911,6 +922,7 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -922,13 +934,14 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
},
|
},
|
||||||
] )
|
] )
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger job with event configured but no event cli argument', async () => {
|
it( 'should trigger job with event configured but no event cli argument', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -958,8 +971,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 2 );
|
expect( jobs.test ).toHaveLength( 2 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toEqual(
|
expect( jobs.test ).toEqual(
|
||||||
expect.arrayContaining( [
|
expect.arrayContaining( [
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -971,6 +984,7 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -982,13 +996,14 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
},
|
},
|
||||||
] )
|
] )
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should trigger job with event configured and matching event cli argument', async () => {
|
it( 'should trigger job with event configured and matching event cli argument', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -1018,8 +1033,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 2 );
|
expect( jobs.test ).toHaveLength( 2 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toEqual(
|
expect( jobs.test ).toEqual(
|
||||||
expect.arrayContaining( [
|
expect.arrayContaining( [
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -1031,6 +1046,7 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -1042,13 +1058,14 @@ describe( 'Job Processing', () => {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
testType: 'unit',
|
||||||
},
|
},
|
||||||
] )
|
] )
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should not trigger job with event configured but not matching event cli argument', async () => {
|
it( 'should not trigger job with event configured but not matching event cli argument', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -1121,12 +1138,13 @@ describe( 'Job Processing', () => {
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
command: 'test-lint test-base-ref',
|
command: 'test-lint test-base-ref',
|
||||||
optional: false,
|
optional: false,
|
||||||
|
report: undefined,
|
||||||
} );
|
} );
|
||||||
expect( jobs.test ).toHaveLength( 0 );
|
expect( jobs.test ).toHaveLength( 0 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should create optional test job', async () => {
|
it( 'should create optional test job', async () => {
|
||||||
const testType = 'default';
|
const testType = 'unit';
|
||||||
const jobs = await createJobsForChanges(
|
const jobs = await createJobsForChanges(
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
|
@ -1159,8 +1177,8 @@ describe( 'Job Processing', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect( jobs.lint ).toHaveLength( 0 );
|
expect( jobs.lint ).toHaveLength( 0 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toHaveLength( 1 );
|
expect( jobs.test ).toHaveLength( 1 );
|
||||||
expect( jobs[ `${ testType }Test` ] ).toContainEqual( {
|
expect( jobs.test ).toContainEqual( {
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
projectPath: 'test',
|
projectPath: 'test',
|
||||||
name: 'Default',
|
name: 'Default',
|
||||||
|
@ -1171,6 +1189,8 @@ describe( 'Job Processing', () => {
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
optional: true,
|
optional: true,
|
||||||
|
report: undefined,
|
||||||
|
testType: 'unit',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
@ -1189,6 +1209,12 @@ describe( 'Job Processing', () => {
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
optional: false,
|
optional: false,
|
||||||
|
testType: 'e2e',
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
|
@ -1198,6 +1224,11 @@ describe( 'Job Processing', () => {
|
||||||
events: [],
|
events: [],
|
||||||
changes: [ /test.js$/ ],
|
changes: [ /test.js$/ ],
|
||||||
command: 'test-cmd',
|
command: 'test-cmd',
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1211,10 +1242,16 @@ describe( 'Job Processing', () => {
|
||||||
command: 'test-cmd --shard-arg-1',
|
command: 'test-cmd --shard-arg-1',
|
||||||
shardNumber: 1,
|
shardNumber: 1,
|
||||||
optional: false,
|
optional: false,
|
||||||
|
testType: 'e2e',
|
||||||
testEnv: {
|
testEnv: {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
projectName: 'test',
|
projectName: 'test',
|
||||||
|
@ -1223,10 +1260,16 @@ describe( 'Job Processing', () => {
|
||||||
command: 'test-cmd --shard-arg-2',
|
command: 'test-cmd --shard-arg-2',
|
||||||
shardNumber: 2,
|
shardNumber: 2,
|
||||||
optional: false,
|
optional: false,
|
||||||
|
testType: 'e2e',
|
||||||
testEnv: {
|
testEnv: {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
] )
|
] )
|
||||||
);
|
);
|
||||||
|
@ -1247,6 +1290,12 @@ describe( 'Job Processing', () => {
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
optional: false,
|
optional: false,
|
||||||
|
testType: 'e2e',
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: JobType.Test,
|
type: JobType.Test,
|
||||||
|
@ -1256,6 +1305,11 @@ describe( 'Job Processing', () => {
|
||||||
events: [],
|
events: [],
|
||||||
changes: [ /test.js$/ ],
|
changes: [ /test.js$/ ],
|
||||||
command: 'test-cmd',
|
command: 'test-cmd',
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1267,10 +1321,16 @@ describe( 'Job Processing', () => {
|
||||||
command: 'test-cmd',
|
command: 'test-cmd',
|
||||||
shardNumber: 0,
|
shardNumber: 0,
|
||||||
optional: false,
|
optional: false,
|
||||||
|
testType: 'e2e',
|
||||||
testEnv: {
|
testEnv: {
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
report: {
|
||||||
|
resultsBlobName: 'blob-name',
|
||||||
|
resultsPath: 'results-path',
|
||||||
|
allure: false,
|
||||||
|
},
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,7 +24,7 @@ export const enum JobType {
|
||||||
/**
|
/**
|
||||||
* The type of the test job.
|
* The type of the test job.
|
||||||
*/
|
*/
|
||||||
export const testTypes = [ 'default', 'e2e', 'api', 'performance' ] as const;
|
export const testTypes = [ 'unit', 'e2e', 'api', 'performance' ] as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The variables that can be used in tokens on command strings
|
* The variables that can be used in tokens on command strings
|
||||||
|
@ -297,6 +297,26 @@ interface TestEnvConfig {
|
||||||
config: TestEnvConfigVars;
|
config: TestEnvConfigVars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The configuration of a report.
|
||||||
|
*/
|
||||||
|
interface ReportConfig {
|
||||||
|
/**
|
||||||
|
* The name of the artifact to be uploaded.
|
||||||
|
*/
|
||||||
|
resultsBlobName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the results that will be uploaded under the resultsBlobName name.
|
||||||
|
*/
|
||||||
|
resultsPath: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether Allure results exists and an Allure report should be generated and possibly published.
|
||||||
|
*/
|
||||||
|
allure: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration of a test job.
|
* The configuration of a test job.
|
||||||
*/
|
*/
|
||||||
|
@ -330,6 +350,11 @@ export interface TestJobConfig extends BaseJobConfig {
|
||||||
* The key(s) to use when identifying what jobs should be triggered by a cascade.
|
* The key(s) to use when identifying what jobs should be triggered by a cascade.
|
||||||
*/
|
*/
|
||||||
cascadeKeys?: string[];
|
cascadeKeys?: string[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The configuration for the report if one is needed.
|
||||||
|
*/
|
||||||
|
report?: ReportConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -375,7 +400,7 @@ function parseTestJobConfig( raw: any ): TestJobConfig {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let testType: ( typeof testTypes )[ number ] = 'default';
|
let testType: ( typeof testTypes )[ number ] = 'unit';
|
||||||
if (
|
if (
|
||||||
raw.testType &&
|
raw.testType &&
|
||||||
testTypes.includes( raw.testType.toString().toLowerCase() )
|
testTypes.includes( raw.testType.toString().toLowerCase() )
|
||||||
|
@ -410,6 +435,42 @@ function parseTestJobConfig( raw: any ): TestJobConfig {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( raw.report ) {
|
||||||
|
if ( typeof raw.report !== 'object' ) {
|
||||||
|
throw new ConfigError( 'The "report" option must be an object.' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
! raw.report.resultsBlobName ||
|
||||||
|
typeof raw.report.resultsBlobName !== 'string'
|
||||||
|
) {
|
||||||
|
throw new ConfigError(
|
||||||
|
'A string "resultsBlobName" option is required for report.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
! raw.report.resultsPath ||
|
||||||
|
typeof raw.report.resultsPath !== 'string'
|
||||||
|
) {
|
||||||
|
throw new ConfigError(
|
||||||
|
'A string "resultsPath" option is required for report.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( raw.report.allure && typeof raw.report.allure !== 'boolean' ) {
|
||||||
|
throw new ConfigError(
|
||||||
|
'A boolean "allure" option is required for report.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
config.report = {
|
||||||
|
resultsBlobName: raw.report.resultsBlobName,
|
||||||
|
resultsPath: raw.report.resultsPath,
|
||||||
|
allure: raw.report.allure,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if ( raw.cascade ) {
|
if ( raw.cascade ) {
|
||||||
config.cascadeKeys = parseTestCascade( raw.cascade );
|
config.cascadeKeys = parseTestCascade( raw.cascade );
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
import {
|
import {
|
||||||
CommandVarOptions,
|
CommandVarOptions,
|
||||||
JobType,
|
JobType,
|
||||||
testTypes,
|
|
||||||
LintJobConfig,
|
LintJobConfig,
|
||||||
TestJobConfig,
|
TestJobConfig,
|
||||||
} from './config';
|
} from './config';
|
||||||
|
@ -31,6 +30,15 @@ interface TestJobEnv {
|
||||||
start?: string;
|
start?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A testing job report.
|
||||||
|
*/
|
||||||
|
interface TestJobReport {
|
||||||
|
resultsBlobName: string;
|
||||||
|
resultsPath: string;
|
||||||
|
allure: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A testing job.
|
* A testing job.
|
||||||
*/
|
*/
|
||||||
|
@ -42,6 +50,8 @@ interface TestJob {
|
||||||
testEnv: TestJobEnv;
|
testEnv: TestJobEnv;
|
||||||
shardNumber: number;
|
shardNumber: number;
|
||||||
optional: boolean;
|
optional: boolean;
|
||||||
|
testType: string;
|
||||||
|
report: TestJobReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -230,8 +240,10 @@ async function createTestJob(
|
||||||
shouldCreate: false,
|
shouldCreate: false,
|
||||||
envVars: {},
|
envVars: {},
|
||||||
},
|
},
|
||||||
|
report: config.report,
|
||||||
shardNumber,
|
shardNumber,
|
||||||
optional: config.optional,
|
optional: config.optional,
|
||||||
|
testType: config.testType,
|
||||||
};
|
};
|
||||||
|
|
||||||
// We want to make sure that we're including the configuration for
|
// We want to make sure that we're including the configuration for
|
||||||
|
@ -268,10 +280,6 @@ async function createJobsForProject(
|
||||||
test: [],
|
test: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
testTypes.forEach( ( type ) => {
|
|
||||||
newJobs[ `${ type }Test` ] = [];
|
|
||||||
} );
|
|
||||||
|
|
||||||
// In order to simplify the way that cascades work we're going to recurse depth-first and check our dependencies
|
// In order to simplify the way that cascades work we're going to recurse depth-first and check our dependencies
|
||||||
// for jobs before ourselves. This lets any cascade keys created in dependencies cascade to dependents.
|
// for jobs before ourselves. This lets any cascade keys created in dependencies cascade to dependents.
|
||||||
const newCascadeKeys = [];
|
const newCascadeKeys = [];
|
||||||
|
@ -304,12 +312,7 @@ async function createJobsForProject(
|
||||||
}
|
}
|
||||||
|
|
||||||
newJobs.lint.push( ...dependencyJobs.lint );
|
newJobs.lint.push( ...dependencyJobs.lint );
|
||||||
|
newJobs.test.push( ...dependencyJobs.test );
|
||||||
testTypes.forEach( ( type ) => {
|
|
||||||
newJobs[ `${ type }Test` ].push(
|
|
||||||
...dependencyJobs[ `${ type }Test` ]
|
|
||||||
);
|
|
||||||
} );
|
|
||||||
|
|
||||||
// Track any new cascade keys added by the dependency.
|
// Track any new cascade keys added by the dependency.
|
||||||
// Since we're filtering out duplicates after the
|
// Since we're filtering out duplicates after the
|
||||||
|
@ -402,9 +405,7 @@ async function createJobsForProject(
|
||||||
|
|
||||||
jobConfig.jobCreated = true;
|
jobConfig.jobCreated = true;
|
||||||
|
|
||||||
newJobs[ `${ jobConfig.testType }Test` ].push(
|
newJobs.test.push( ...getShardedJobs( created, jobConfig ) );
|
||||||
...getShardedJobs( created, jobConfig )
|
|
||||||
);
|
|
||||||
|
|
||||||
// We need to track any cascade keys that this job is associated with so that
|
// We need to track any cascade keys that this job is associated with so that
|
||||||
// dependent projects can trigger jobs with matching keys. We are expecting
|
// dependent projects can trigger jobs with matching keys. We are expecting
|
||||||
|
|
Loading…
Reference in New Issue