ci: coalesce integration-test and upgrade-test into one workflow

This commit is contained in:
Erik Sundell
2021-10-17 01:55:00 +02:00
parent 211abb95e1
commit f4feaa08b5
3 changed files with 63 additions and 72 deletions

View File

@@ -24,8 +24,61 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
integration-test:
runs-on: ubuntu-18.04 # This job is used as a workaround to a limitation when using a matrix of
# variations that a job should be executed against. The limitation is that a
# matrix once defined can't include any conditions.
#
# What this job does before our real test job with a matrix of variations run,
# 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:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
# Currently, this logic filters out a matrix entry equaling a specific git
# 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 '{"include": map( . | select(.dont_run_on_ref != "${{ github.ref }}" ))}'
)
echo ::set-output name=matrix::$(echo "$matrix_post_filter")
echo "The subsequent job's matrix are:"
echo $matrix_post_filter | jq '.'
env:
matrix_include_pre_filter: |
- name: "Int. tests: Ubuntu 18.04, Py 3.6"
runs_on: ubuntu-18.04
extra_flags: ""
- name: "Int. tests: Ubuntu 20.04, Py 3.9"
runs_on: ubuntu-20.04
extra_flags: ""
- name: "Int. tests: Ubuntu 20.04, Py 3.9, --upgrade"
runs_on: ubuntu-20.04
extra_flags: --upgrade
dont_run_on_ref: refs/heads/master
integration-tests:
needs: decide-on-test-jobs-to-run
runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.decide-on-test-jobs-to-run.outputs.matrix) }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
@@ -51,18 +104,21 @@ jobs:
.github/integration-test.py run-test \ .github/integration-test.py run-test \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
basic-tests test_hub.py test_proxy.py \ basic-tests test_hub.py test_proxy.py \
test_install.py test_extensions.py test_install.py test_extensions.py \
${{ matrix.extra_flags }}
- name: Run admin tests - name: Run admin tests
run: | run: |
.github/integration-test.py run-test \ .github/integration-test.py run-test \
--installer-args "--admin admin:admin" \ --installer-args "--admin admin:admin" \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
basic-tests test_admin_installer.py basic-tests test_admin_installer.py \
${{ matrix.extra_flags }}
- name: Run plugin tests - name: Run plugin tests
run: | run: |
.github/integration-test.py run-test \ .github/integration-test.py run-test \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
--installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \
plugins test_simplest_plugin.py plugins test_simplest_plugin.py \
${{ matrix.extra_flags }}

View File

@@ -25,8 +25,10 @@ on:
jobs: jobs:
unit-test: unit-test:
name: Unit tests
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
container: ubuntu:18.04 container: ubuntu:18.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2

View File

@@ -1,67 +0,0 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
#
name: Upgrade tests
on:
pull_request:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/upgrade-test.yaml"
push:
paths-ignore:
- "docs/**"
- "**.md"
- "**.rst"
- ".github/workflows/*"
- "!.github/workflows/upgrade-test.yaml"
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
workflow_dispatch:
jobs:
upgrade-test:
if: ${{ github.ref != 'refs/heads/master' }}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Set BOOTSTRAP_PIP_SPEC value
run: |
echo "BOOTSTRAP_PIP_SPEC=git+https://github.com/$GITHUB_REPOSITORY.git@$GITHUB_REF" >> $GITHUB_ENV
echo $BOOTSTRAP_PIP_SPEC
- name: Build systemd image
run: |
.github/integration-test.py build-image
- name: Run basic tests
run: |
.github/integration-test.py run-test \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
basic-tests test_hub.py test_proxy.py \
test_install.py test_extensions.py \
--upgrade
- name: Run admin tests
run: |
.github/integration-test.py run-test \
--installer-args "--admin admin:admin" \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
basic-tests test_admin_installer.py \
--upgrade
- name: Run plugin tests
run: |
.github/integration-test.py run-test \
--bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \
--installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \
plugins test_simplest_plugin.py \
--upgrade