diff --git a/.github/workflows/end-to-end-tests.yml b/.github/workflows/end-to-end-tests.yml index cf97ddf206..c3555dfefd 100644 --- a/.github/workflows/end-to-end-tests.yml +++ b/.github/workflows/end-to-end-tests.yml @@ -68,6 +68,8 @@ on: # ^ add new projects here # GitHub Actions doesn't support dynamic choices, we must add each project here to enable manual deployments # See https://github.com/community/community/discussions/11795 +env: + auto_pass_projects: '["manage-offences-and-delius"]' jobs: test: @@ -82,8 +84,6 @@ jobs: with: repository: ministryofjustice/hmpps-probation-integration-e2e-tests ref: ${{ inputs.test-branch }} - - name: Set auto-passing projects - run: echo 'auto_pass_projects=["manage-offences-and-delius"]' | tee -a "$GITHUB_ENV" - name: Get tests to run - all tests if: inputs.projects == '' || inputs.projects == 'All' run: echo "projects=$(find projects -mindepth 1 -maxdepth 1 -printf "%f\n" | jq --raw-input . | jq --slurp --compact-output .)" | tee -a "$GITHUB_ENV" @@ -150,12 +150,9 @@ jobs: skipped_projects=$(echo "$all_projects" | jq -r '.[]' | while read -r project; do if [ ! -d "tests/$project" ]; then echo $project; fi; done | jq --raw-input . | jq --slurp --compact-output .) failed_projects=$(jq -r '.suites[].specs[] | select(.ok == false).file' results.json | xargs -n1 dirname | sort -u | jq --raw-input . | jq --slurp --compact-output .) passed_projects=$(jq --compact-output --null-input --argjson all "$all_projects" --argjson failed "$failed_projects" --argjson skipped "$skipped_projects" '{all: $all, failed: $failed, skipped: $skipped} | .all - .failed - .skipped') + merged=$(echo "$auto_pass_projects $passed_projects" | jq -s 'add') + passed_projects=$(echo "$merged $projects" | jq -sc '.[0] - (.[0] - .[1])') fi - echo "$auto_pass_projects" | jq -c '.[]' | while read app; do - if [[ $(echo "$projects" | jq "any(.[]; . == $app)") == true ]] - then - passed_projects=$(echo "$passed_projects" | jq ". += [$app]") - fi done echo "skipped-projects=${skipped_projects:-'[]'}" | tee -a "$GITHUB_OUTPUT" echo "failed-projects=${failed_projects:-'[]'}" | tee -a "$GITHUB_OUTPUT"