ci: remove unimportant and complicated job filtering

This commit is contained in:
Erik Sundell
2023-04-15 10:56:44 +02:00
parent 6ecbe083d5
commit f219acd041

View File

@@ -24,40 +24,17 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
# This job is used as a workaround to a limitation when using a matrix of integration-tests:
# variations that a job should be executed against. The limitation is that a # integration tests run in a container,
# matrix once defined can't include any conditions. # not in the worker, so this version is not relevant to the tests
# # and can be the same for all tested versions
# What this job does before our real test job with a matrix of variations run, runs-on: ubuntu-22.04
# is to decide on that matrix of variations a conditional logic of our choice.
#
# For more details, see this excellent stack overflow answer:
# https://stackoverflow.com/a/65434401/2220152
#
decide-on-test-jobs-to-run:
name: Decide on test jobs to run
runs-on: ubuntu-latest
outputs: name: ${{ matrix.name }}
matrix: ${{ steps.set-matrix.outputs.matrix }} strategy:
fail-fast: false
steps: matrix:
# Currently, this logic filters out a matrix entry equaling a specific git include:
# reference identified by "dont_run_on_ref".
- name: Decide on test jobs to run
id: set-matrix
run: |
matrix_post_filter=$(
echo "$matrix_include_pre_filter" \
| yq e --output-format=json '.' - \
| jq -c '{"include": map( . | select(.dont_run_on_ref != "${{ github.ref }}" ))}'
)
echo "matrix=$matrix_post_filter" >> $GITHUB_OUTPUT
echo "The subsequent job's matrix are:"
echo $matrix_post_filter | jq -C '.'
env:
matrix_include_pre_filter: |
- name: "Debian 11, Py 3.9" - name: "Debian 11, Py 3.9"
distro_image: "debian:11" distro_image: "debian:11"
runs_on: "ubuntu-22.04" runs_on: "ubuntu-22.04"
@@ -78,19 +55,6 @@ jobs:
distro_image: "ubuntu:22.04" distro_image: "ubuntu:22.04"
extra_flags: --upgrade-from=0.2.0 extra_flags: --upgrade-from=0.2.0
integration-tests:
needs: decide-on-test-jobs-to-run
# integration tests run in a container,
# not in the worker, so this version is not relevant to the tests
# and can be the same for all tested versions
runs-on: ubuntu-22.04
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.decide-on-test-jobs-to-run.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4