refactor(vz): clean up PR based on self-review findings #588
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: Test | |
| on: | |
| push: {} | |
| jobs: | |
| test: | |
| runs-on: [self-hosted, linux, x64, kvm] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| # Not necessary to upload cache on self-hosted runner(s) | |
| # ~/go/pkg/mod and ~/.cache/go-build stay on disk between runs automatically. | |
| cache: false | |
| go-version: '1.25' | |
| - name: Install dependencies | |
| run: | | |
| set -xe | |
| if ! command -v mkfs.erofs &> /dev/null; then | |
| sudo apt-get update | |
| sudo apt-get install -y erofs-utils | |
| fi | |
| go mod download | |
| # Avoids rate limits when running the tests | |
| # Tests includes pulling, then converting to disk images | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Clean cached binaries | |
| run: make clean | |
| - name: Generate OpenAPI code | |
| run: make oapi-generate | |
| - name: Build | |
| run: make build | |
| - name: Run tests | |
| env: | |
| # Docker auth for tests running as root (sudo) | |
| DOCKER_CONFIG: /home/debianuser/.docker | |
| # TLS/ACME testing (optional - tests will skip if not configured) | |
| ACME_EMAIL: ${{ secrets.ACME_EMAIL }} | |
| ACME_DNS_PROVIDER: "cloudflare" | |
| ACME_CA: "https://acme-staging-v02.api.letsencrypt.org/directory" | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| TLS_TEST_DOMAIN: "test.hypeman-development.com" | |
| TLS_ALLOWED_DOMAINS: '*.hypeman-development.com' | |
| run: make test | |
| test-darwin: | |
| runs-on: [self-hosted, macos, arm64] | |
| concurrency: | |
| group: macos-ci-test-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DATA_DIR: /tmp/hypeman-ci-${{ github.run_id }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| cache: false | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| - name: Install dependencies | |
| run: | | |
| brew list e2fsprogs &>/dev/null || brew install e2fsprogs | |
| brew list erofs-utils &>/dev/null || brew install erofs-utils | |
| go mod download | |
| - name: Create run-scoped data directory | |
| run: mkdir -p "$DATA_DIR" | |
| - name: Generate OpenAPI code | |
| run: make oapi-generate | |
| - name: Build | |
| run: make build | |
| - name: Run tests | |
| env: | |
| DEFAULT_HYPERVISOR: vz | |
| JWT_SECRET: ci-test-secret | |
| run: make test | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| pkill -f "vz-shim.*$DATA_DIR" || true | |
| rm -rf "$DATA_DIR" | |
| make clean | |
| e2e-install: | |
| runs-on: [self-hosted, macos, arm64] | |
| needs: test-darwin | |
| concurrency: | |
| group: macos-ci-e2e-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| cache: false | |
| - name: Install dependencies | |
| run: brew list caddy &>/dev/null || brew install caddy | |
| - name: Run E2E install test | |
| run: bash scripts/e2e-install-test.sh | |
| - name: Cleanup on failure | |
| if: failure() | |
| run: bash scripts/uninstall.sh || true |