Remove the legacy global state from the benchmark. #35
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| env: | |
| GO_VERSION: "1.26" | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1 | |
| with: | |
| version: v2.12.2 | |
| args: --timeout=5m | |
| - name: go vet | |
| run: go vet ./... | |
| - name: gofmt check | |
| run: | | |
| fmt_out=$(gofmt -l .) | |
| if [ -n "$fmt_out" ]; then | |
| echo "::error::gofmt diff:" && echo "$fmt_out" | |
| exit 1 | |
| fi | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Tests with coverage (race + short) | |
| run: | | |
| go test -race -short -count=1 -coverprofile=coverage.out -covermode=atomic ./... | |
| go tool cover -func=coverage.out | tail -n 1 | |
| # Rerun the cross-Server isolation cases with -count=3 to catch | |
| # flakes that the single-pass unit run might miss. Kept on the | |
| # default (untagged) test build so it stays cheap; the matching | |
| # integration cases run in the dedicated job below. | |
| - name: Cross-Server isolation (race x3) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: go test -race -count=3 -run 'Isolation|TwoServers' ./internal/... | |
| - name: Upload coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: coverage | |
| path: coverage.out | |
| retention-days: 7 | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Build (cross-compile sanity) | |
| run: | | |
| GOOS=linux GOARCH=amd64 go build -trimpath -o /tmp/apt-proxy-linux-amd64 ./cmd/apt-proxy | |
| GOOS=linux GOARCH=arm64 go build -trimpath -o /tmp/apt-proxy-linux-arm64 ./cmd/apt-proxy | |
| GOOS=linux GOARCH=386 go build -trimpath -o /tmp/apt-proxy-linux-386 ./cmd/apt-proxy | |
| GOOS=linux GOARCH=arm GOARM=6 go build -trimpath -o /tmp/apt-proxy-linux-armv6 ./cmd/apt-proxy | |
| GOOS=linux GOARCH=arm GOARM=7 go build -trimpath -o /tmp/apt-proxy-linux-armv7 ./cmd/apt-proxy | |
| GOOS=darwin GOARCH=amd64 go build -trimpath -o /tmp/apt-proxy-darwin-amd64 ./cmd/apt-proxy | |
| GOOS=darwin GOARCH=arm64 go build -trimpath -o /tmp/apt-proxy-darwin-arm64 ./cmd/apt-proxy | |
| integration: | |
| name: Integration (e2e) | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - name: Set up Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| - name: Start OtterIO | |
| # OtterIO is an Apache-2.0 fork of MinIO that speaks the same S3 API. | |
| # We launch it via `docker run` (rather than a service container) because | |
| # GitHub Actions services can't pass extra args, and OtterIO's default | |
| # CMD is just `otterio` (which prints help) — we need `server /data`. | |
| # The integration tests only need the S3 port (9000); we skip publishing | |
| # the optional console listener entirely. | |
| run: | | |
| docker run -d --name otterio \ | |
| -p 9000:9000 \ | |
| -e OTTERIO_ROOT_USER=otterioadmin \ | |
| -e OTTERIO_ROOT_PASSWORD=otterioadmin \ | |
| soulteary/otterio:latest \ | |
| server /data | |
| - name: Wait for OtterIO | |
| run: | | |
| for i in $(seq 1 30); do | |
| if curl -fsS http://127.0.0.1:9000/otterio/health/live >/dev/null; then | |
| echo "OtterIO is ready" | |
| exit 0 | |
| fi | |
| echo "Waiting for OtterIO... ($i)" | |
| sleep 2 | |
| done | |
| echo "::error::OtterIO did not become ready in time" | |
| docker logs otterio || true | |
| exit 1 | |
| - name: Run integration tests | |
| env: | |
| # Point the S3 integration tests at the OtterIO container started above. | |
| # When unset, those tests skip themselves; here we want them to run. | |
| # The integration tests create the bucket themselves (MakeBucket) so | |
| # we don't need an init step. | |
| APT_PROXY_TEST_S3_ENDPOINT: 127.0.0.1:9000 | |
| APT_PROXY_TEST_S3_ACCESS_KEY: otterioadmin | |
| APT_PROXY_TEST_S3_SECRET_KEY: otterioadmin | |
| APT_PROXY_TEST_S3_BUCKET: apt-proxy-itest | |
| APT_PROXY_TEST_S3_USE_SSL: "false" | |
| APT_PROXY_TEST_S3_USE_PATH_STYLE: "true" | |
| run: go test -tags=integration -race -count=1 -timeout=10m ./tests/integration/... | |
| - name: Dump OtterIO logs on failure | |
| if: failure() | |
| run: docker logs otterio || true |