Repository navigation
ci: run CI, mesh and Litestream tests on GitHub-hosted runners #2
Workflow file for this run
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: Headscale Litestream | |
| # Runs tests/litestream/run.sh: the headscale_hosted provider with Litestream and a warm standby against an S3-compatible store, a real Tailscale client, promotion of the standby, and the headscale_in_cluster guard. Only on changes that can affect them. | |
| # | |
| # Runs on GitHub-hosted ubuntu-latest, which has the Docker daemon the test needs. The work directory sits under runner.temp, which the job always has write access to. | |
| on: | |
| pull_request: | |
| paths: | |
| - roles/github_runner_cluster/tasks/mesh/headscale_*.yml | |
| - roles/github_runner_cluster/tasks/headscale_promote.yml | |
| - roles/github_runner_cluster/templates/headscale/** | |
| - roles/github_runner_cluster/files/headscale/** | |
| - roles/github_runner_cluster/defaults/main.yml | |
| - playbooks/promote_headscale_standby.yml | |
| - tests/litestream/** | |
| - .github/workflows/litestream.yml | |
| workflow_dispatch: | |
| concurrency: | |
| group: litestream-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| litestream: | |
| name: Litestream and standby promotion | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| COMPOSE_VERSION: v5.5.1 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install the pinned Docker Compose | |
| # Always the pinned version, not whatever the runner has: ubuntu-latest's own Compose recreated every node container when the role ran a second time, which the pinned version does not. The user plugin directory takes precedence over the system one. | |
| run: | | |
| set -euo pipefail | |
| docker version --format 'Docker Engine {{.Server.Version}}' | |
| case "$(uname -m)" in | |
| x86_64) arch=x86_64 ;; | |
| aarch64 | arm64) arch=aarch64 ;; | |
| *) echo "Unsupported architecture: $(uname -m)" >&2; exit 1 ;; | |
| esac | |
| mkdir -p "${HOME}/.docker/cli-plugins" | |
| base="https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-linux-${arch}" | |
| curl -fsSL -o "${RUNNER_TEMP}/docker-compose" "$base" | |
| echo "$(curl -fsSL "${base}.sha256" | cut -d' ' -f1) ${RUNNER_TEMP}/docker-compose" | sha256sum -c - | |
| install -m 0755 "${RUNNER_TEMP}/docker-compose" "${HOME}/.docker/cli-plugins/docker-compose" | |
| docker compose version | |
| - name: Install Ansible | |
| run: | | |
| set -euo pipefail | |
| if ! python3 -m venv "${RUNNER_TEMP}/venv" 2>/dev/null; then | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq python3-venv | |
| python3 -m venv "${RUNNER_TEMP}/venv" | |
| fi | |
| "${RUNNER_TEMP}/venv/bin/pip" install --quiet --prefer-binary ansible-core | |
| "${RUNNER_TEMP}/venv/bin/ansible-galaxy" collection install -r ansible/requirements.yml -p "${RUNNER_TEMP}/collections" | |
| echo "${RUNNER_TEMP}/venv/bin" >> "$GITHUB_PATH" | |
| - name: Run the test | |
| env: | |
| GRTEST_WORK: ${{ runner.temp }}/grtest-ls | |
| GRTEST_EXTRA_COLLECTIONS: ${{ runner.temp }}/collections | |
| run: tests/litestream/run.sh | |
| required-checks: | |
| name: Headscale Litestream result | |
| needs: [litestream] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Fail if the test failed or was cancelled | |
| run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then | |
| echo "The test did not succeed:" | |
| echo '${{ toJSON(needs) }}' | |
| exit 1 | |
| fi |