diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml index d61f121..fd20ba5 100644 --- a/.github/workflows/integration-test.yaml +++ b/.github/workflows/integration-test.yaml @@ -24,8 +24,61 @@ on: workflow_dispatch: 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: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -51,18 +104,21 @@ jobs: .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 + test_install.py test_extensions.py \ + ${{ matrix.extra_flags }} - 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 + basic-tests test_admin_installer.py \ + ${{ matrix.extra_flags }} - 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 + plugins test_simplest_plugin.py \ + ${{ matrix.extra_flags }} diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index 3f85a78..7f63cd4 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -25,8 +25,10 @@ on: jobs: unit-test: + name: Unit tests runs-on: ubuntu-18.04 container: ubuntu:18.04 + steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.github/workflows/upgrade-test.yaml b/.github/workflows/upgrade-test.yaml deleted file mode 100644 index 13c2fe1..0000000 --- a/.github/workflows/upgrade-test.yaml +++ /dev/null @@ -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