fix: intermittently failing tests #1759
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
| on: | |
| push: | |
| branches: | |
| - main | |
| - v1.0.x | |
| - v1.1.x | |
| tags: | |
| - 'v[0-9]+\.[0-9]+\.[0-9]+' | |
| pull_request: | |
| branches: | |
| - main | |
| - v1.0.x | |
| - v1.1.x | |
| name: CI Tests | |
| concurrency: | |
| group: ci-build-tests-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - run: | | |
| make check-codegen | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.13.1 | |
| args: --timeout 5m | |
| only-new-issues: true | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get Build Date | |
| id: builddate | |
| run: | | |
| echo "builddate=$(date -u +%Y-%m-%dT%H:%M:%SZ)" | tee $GITHUB_OUTPUT | |
| - uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: build image | |
| run: | | |
| docker buildx build \ | |
| --label "org.opencontainers.image.revision=${{ github.sha }}" \ | |
| --label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \ | |
| --label "org.opencontainers.image.created=${{ steps.builddate.outputs.builddate }}" \ | |
| --platform linux/amd64 \ | |
| -f ./Dockerfile . | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go: [1.26] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.x" | |
| - name: Install python dependencies | |
| run: python -m pip install --upgrade pip setuptools wheel | |
| - name: installing codespell | |
| run: pip install codespell | |
| - name: running codespell | |
| run: codespell --skip="vendor,*.git,*.png,*.pdf,*.tiff,*.plist,*.pem,rangesim*.go,*.gz,go.mod,go.sum" --ignore-words="./testdata/ignore_words.txt" | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - uses: actions/checkout@v6 | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| - name: govulncheck | |
| continue-on-error: true | |
| run: go tool govulncheck ./... | |
| - run: go mod vendor | |
| - name: Run tests | |
| run: make test | |
| - name: Check coverage floor | |
| run: | | |
| COVERAGE=$(go tool cover -func=.coverprofile | tail -1 | awk '{print $3}' | tr -d '%') | |
| echo "Total coverage: ${COVERAGE}%" | |
| if (( $(echo "$COVERAGE < 50" | bc -l) )); then | |
| echo "::error::Coverage ${COVERAGE}% is below 50% minimum" | |
| exit 1 | |
| fi | |
| - name: Run tests (with race detection enabled) | |
| run: | | |
| echo "::group::Race Detection Tests" | |
| make data-race-test | |
| echo "::endgroup::" | |
| make data-race-test-inspect | |
| - run: go build -o /dev/null ./cmd/trickster | |
| - name: Send coverage | |
| if: github.repository_owner == 'trickstercache' # Skip for forked repositories | |
| uses: shogo82148/actions-goveralls@v1 | |
| # publishing to coveralls should not fail; and if it does, it should not block the CI process. | |
| # Likely coveralls maintenance: https://status.coveralls.io/ | |
| # TODO: publish PR comment if coveralls publish fails | |
| continue-on-error: true | |
| with: | |
| path-to-profile: .coverprofile | |
| flag-name: unit-Go-${{ matrix.go }} | |
| parallel: true | |
| integration: | |
| runs-on: ubuntu-latest | |
| env: | |
| TRICKSTER_MYSQL_CLI_TEST: "1" | |
| TRICKSTER_DNS_TEST: "1" | |
| # CI containers cannot raise the UDP receive buffer; the warning is noise | |
| QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING: "1" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Start developer environment (with integration containers) | |
| run: make integration-start | |
| - name: Show container status | |
| if: always() | |
| run: | | |
| cd docs/developer/environment | |
| docker compose ps | |
| docker compose logs --tail=30 redis prometheus mysql grafana coredns | |
| docker compose logs --tail=60 graphite graphite_seed graphite_generator | |
| - name: Run integration tests (with coverage) | |
| run: make integration-cover | |
| - name: Run integration tests (with race detection enabled) | |
| run: make -C integration data-race-test | |
| - name: Send integration coverage | |
| if: github.repository_owner == 'trickstercache' | |
| uses: shogo82148/actions-goveralls@v1 | |
| continue-on-error: true | |
| with: | |
| path-to-profile: integration/.integration.coverprofile | |
| flag-name: integration | |
| parallel: true | |
| integration-kind: | |
| # Kubernetes autodiscovery scenario (plan step 34): in-cluster | |
| # Trickster over EndpointSlices discovery in a kind cluster | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Create kind cluster | |
| uses: helm/kind-action@v1 | |
| with: | |
| config: integration/kind/kind-config.yaml | |
| cluster_name: trickster-it | |
| - name: Build and load trickster image | |
| run: | | |
| docker build -t trickster:integration . | |
| kind load docker-image trickster:integration --name trickster-it | |
| - name: Deploy scenario manifests | |
| run: | | |
| kubectl --context kind-trickster-it apply -f integration/kind/manifests.yaml | |
| kubectl --context kind-trickster-it -n trickster-it rollout status deployment/webecho deployment/trickster --timeout=180s | |
| - name: Run kubernetes autodiscovery scenario | |
| working-directory: integration | |
| env: | |
| TRICKSTER_KIND_TEST: "1" | |
| run: go test -v -timeout 15m -run TestALBDiscoveryKind . | |
| - name: Show cluster state on failure | |
| if: failure() | |
| run: | | |
| kubectl --context kind-trickster-it -n trickster-it get pods -o wide || true | |
| kubectl --context kind-trickster-it -n trickster-it describe deployment trickster webecho || true | |
| kubectl --context kind-trickster-it -n trickster-it logs deployment/trickster --tail=100 || true | |
| finish: | |
| needs: | |
| - build | |
| - integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: shogo82148/actions-goveralls@v1 | |
| if: github.repository_owner == 'trickstercache' # Skip for forked repositories | |
| continue-on-error: true | |
| with: | |
| parallel-finished: true |