Docker System Tests #112
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker System Tests | |
| on: | |
| schedule: | |
| - cron: '0 4 * * *' # Daily at 4am UTC | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| systests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/jenkinsapi | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0 | |
| with: | |
| egress-policy: audit | |
| # azure.archive.ubuntu.com:80 - Ubuntu apt packages | |
| # esm.ubuntu.com:443 - Ubuntu ESM security updates | |
| # files.pythonhosted.org:443 - Python package downloads | |
| # github.com:443 - Git operations / Actions | |
| # api.github.com:443 - GitHub API | |
| # int.api.stepsecurity.io:443 - harden-runner telemetry | |
| # motd.ubuntu.com:443 - Ubuntu MOTD | |
| # packages.microsoft.com:443 - Microsoft apt repo (ubuntu-latest runner) | |
| # ppa.launchpadcontent.net:443 - Ubuntu PPA | |
| # pypi.org:443 - PyPI package index | |
| # objects.githubusercontent.com:443 - GitHub release artifacts / LFS | |
| # ghcr.io:443 - GitHub Container Registry (pull image) | |
| # pkg-containers.githubusercontent.com:443 - Docker layer storage for GHCR | |
| allowed-endpoints: > | |
| azure.archive.ubuntu.com:80 | |
| esm.ubuntu.com:443 | |
| files.pythonhosted.org:443 | |
| github.com:443 | |
| api.github.com:443 | |
| int.api.stepsecurity.io:443 | |
| motd.ubuntu.com:443 | |
| packages.microsoft.com:443 | |
| ppa.launchpadcontent.net:443 | |
| pypi.org:443 | |
| objects.githubusercontent.com:443 | |
| ghcr.io:443 | |
| pkg-containers.githubusercontent.com:443 | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| python-version: "3.13" | |
| - name: Install python | |
| run: uv python install | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update; sudo apt-get install libkrb5-dev gcc | |
| - name: Log in to GHCR | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare Docker image | |
| uses: ./.github/actions/docker-image-prep | |
| with: | |
| image_name: ${{ env.IMAGE_NAME }} | |
| - name: Run system tests | |
| run: | | |
| NUM_WORKERS=auto | |
| echo "Running docker-backed tests with xdist mode '$NUM_WORKERS' ($(nproc) CPUs available)" | |
| uv run pytest jenkinsapi_tests/unittests/test_docker_jenkins.py jenkinsapi_tests/systests/ -n $NUM_WORKERS --timeout=120 -v |