# 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: Integration tests on: pull_request: paths-ignore: - "docs/**" - "**.md" - "**.rst" - ".github/workflows/*" - "!.github/workflows/integration-test.yaml" push: paths-ignore: - "docs/**" - "**.md" - "**.rst" - ".github/workflows/*" - "!.github/workflows/integration-test.yaml" branches-ignore: - "dependabot/**" - "pre-commit-ci-update-config" workflow_dispatch: jobs: # 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" ubuntu_version: 18.04 python_version: 3.6 extra_flags: "" - name: "Int. tests: Ubuntu 20.04, Py 3.9" ubuntu_version: 20.04 python_version: 3.9 extra_flags: "" - name: "Int. tests: Ubuntu 20.04, Py 3.9, --upgrade" ubuntu_version: 20.04 python_version: 3.9 extra_flags: --upgrade dont_run_on_ref: refs/heads/master integration-tests: needs: decide-on-test-jobs-to-run runs-on: ubuntu-${{ matrix.ubuntu_version }} 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 with: python-version: ${{ matrix.python_version }} - 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 --build-arg ubuntu_version=${{ matrix.ubuntu_version }} - name: Run bootstrap checks run: | python3 -m pip install pytest pytest --verbose --maxfail=2 --color=yes --capture=no integration-tests/test_bootstrap.py - 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 \ ${{ 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 \ ${{ 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 \ ${{ matrix.extra_flags }}