|
| 1 | +name: Integration Tests |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + merge_group: null |
| 7 | + |
| 8 | + |
| 9 | +# Integration tests interact with GitHub resources in the integration test infrastructure and therefore |
| 10 | +# cannot run concurrently with other integration tests. |
| 11 | +concurrency: |
| 12 | + group: cf-scripts-integration-tests |
| 13 | + cancel-in-progress: false |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: bash -leo pipefail {0} |
| 18 | + |
| 19 | +jobs: |
| 20 | + integration-tests: |
| 21 | + name: Run Integration Tests |
| 22 | + # if triggered by pull_request, only run on non-fork PRs (secrets access needed) |
| 23 | + # Nevertheless, this check is always run in the merge queue. |
| 24 | + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository |
| 25 | + runs-on: ubuntu-latest |
| 26 | + steps: |
| 27 | + - name: Set up Docker Buildx |
| 28 | + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 |
| 29 | + |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 32 | + with: |
| 33 | + path: cf-scripts |
| 34 | + submodules: 'true' |
| 35 | + |
| 36 | + - name: Build Docker Image |
| 37 | + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 |
| 38 | + with: |
| 39 | + context: cf-scripts |
| 40 | + push: false |
| 41 | + load: true |
| 42 | + tags: conda-forge-tick:test |
| 43 | + |
| 44 | + - name: Setup micromamba |
| 45 | + uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4 |
| 46 | + with: |
| 47 | + environment-file: cf-scripts/conda-lock.yml |
| 48 | + environment-name: cf-scripts |
| 49 | + condarc-file: cf-scripts/autotick-bot/condarc |
| 50 | + |
| 51 | + - name: Run pip install |
| 52 | + working-directory: cf-scripts |
| 53 | + run: | |
| 54 | + pip install --no-deps --no-build-isolation -e . |
| 55 | +
|
| 56 | + - name: Run mitmproxy certificate setup wizard |
| 57 | + working-directory: cf-scripts |
| 58 | + run: | |
| 59 | + # place a script in the mitmproxy directory that will be run by the setup wizard |
| 60 | + # to trust the mitmproxy certificate |
| 61 | + cat <<EOF > ./tests_integration/.mitmproxy/${{ env.MITMPROXY_WIZARD_HEADLESS_TRUST_SCRIPT }} |
| 62 | + #!/usr/bin/env bash |
| 63 | + set -euo pipefail |
| 64 | + sudo cp "\$1" /usr/local/share/ca-certificates/mitmproxy.crt |
| 65 | + sudo update-ca-certificates |
| 66 | + EOF |
| 67 | +
|
| 68 | + ./tests_integration/mitmproxy_setup_wizard.sh |
| 69 | + env: |
| 70 | + MITMPROXY_WIZARD_HEADLESS: true |
| 71 | + MITMPROXY_WIZARD_HEADLESS_TRUST_SCRIPT: mitmproxy_trust_script.sh |
| 72 | + |
| 73 | + - name: Set up git identity |
| 74 | + run: | |
| 75 | + git config --global user.name "regro-cf-autotick-bot-staging" |
| 76 | + git config --global user.email "[email protected]" |
| 77 | +
|
| 78 | + - name: Run Integration Tests with pytest |
| 79 | + working-directory: cf-scripts |
| 80 | + run: | |
| 81 | + pytest -s -v \ |
| 82 | + --dist=no \ |
| 83 | + tests_integration |
| 84 | + env: |
| 85 | + BOT_TOKEN: ${{ secrets.GH_TOKEN_STAGING_BOT_USER }} |
| 86 | + TEST_SETUP_TOKEN: ${{ secrets.GH_TOKEN_STAGING_BOT_USER }} |
| 87 | + |
| 88 | + - name: Print Proxy Logs |
| 89 | + run: cat /tmp/mitmproxy.log |
| 90 | + if: always() |
0 commit comments