fix(release): derive release tag from the normalized Go-module subdir… #173
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, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| go-version: ['1.26.x'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Install toolchain dependencies | |
| shell: bash | |
| run: | | |
| echo "Installing validator toolchains..." | |
| # Install buf | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| mkdir -p "$HOME/bin" | |
| curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.66.1/buf-Windows-x86_64.exe" -o "$HOME/bin/buf.exe" | |
| chmod +x "$HOME/bin/buf.exe" | |
| echo "$HOME/bin" >> $GITHUB_PATH | |
| elif [[ "${{ runner.os }}" == "macOS" ]]; then | |
| curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.66.1/buf-Darwin-arm64" -o /tmp/buf | |
| chmod +x /tmp/buf | |
| sudo mv /tmp/buf /usr/local/bin/buf | |
| else | |
| curl -sSL "https://github.com/bufbuild/buf/releases/download/v1.66.1/buf-Linux-x86_64" -o /tmp/buf | |
| chmod +x /tmp/buf | |
| sudo mv /tmp/buf /usr/local/bin/buf | |
| fi | |
| # Install spectral (Node.js based) - latest version fixes deprecation warnings | |
| npm install -g @stoplight/spectral-cli@6.15.0 | |
| # Install oasdiff using go install (latest stable version) | |
| go install github.com/oasdiff/oasdiff@v1.11.7 | |
| # Verify installations | |
| echo "Verifying tool installations..." | |
| buf --version || echo "buf not found" | |
| spectral --version || echo "spectral not found" | |
| oasdiff --help | head -1 || echo "oasdiff not found" | |
| - name: Build binary | |
| shell: bash | |
| run: | | |
| mkdir -p ./bin | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| echo "Building for Windows..." | |
| go build -o ./bin/apx.exe ./cmd/apx | |
| echo "Binary built. Checking if it exists:" | |
| ls -la ./bin/ | |
| echo "Verifying binary works:" | |
| ./bin/apx.exe --version || echo "Binary execution failed" | |
| else | |
| echo "Building for Unix-like system..." | |
| go build -o ./bin/apx ./cmd/apx | |
| echo "Binary built. Checking if it exists:" | |
| ls -la ./bin/ | |
| echo "Verifying binary works:" | |
| ./bin/apx --version || echo "Binary execution failed" | |
| fi | |
| - name: Run tests | |
| env: | |
| CI: "1" | |
| NO_COLOR: "1" | |
| run: go test ./... -race -count=1 -coverprofile=coverage.out | |
| - name: Upload coverage to Codecov | |
| if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.26.x' | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| enforce-principles: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - name: Enforce coding principles | |
| run: make enforce-principles | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - name: Run integration tests | |
| run: make integration-tests | |
| e2e-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| K3D_VERSION: v5.8.3 | |
| KUBECTL_VERSION: v1.32.3 | |
| BUF_VERSION: v1.66.1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| cache: true | |
| - name: Cache E2E tool binaries | |
| id: cache-e2e-tools | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.local/bin/k3d | |
| ~/.local/bin/kubectl | |
| ~/.local/bin/buf | |
| key: e2e-tools-linux-amd64-k3d${{ env.K3D_VERSION }}-kubectl${{ env.KUBECTL_VERSION }}-buf${{ env.BUF_VERSION }} | |
| - name: Install E2E dependencies | |
| if: steps.cache-e2e-tools.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p ~/.local/bin | |
| # Install k3d | |
| curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash | |
| cp /usr/local/bin/k3d ~/.local/bin/k3d | |
| # Install kubectl | |
| curl -LO "https://dl.k8s.io/release/${{ env.KUBECTL_VERSION }}/bin/linux/amd64/kubectl" | |
| chmod +x kubectl && mv kubectl ~/.local/bin/kubectl | |
| # Install buf | |
| curl -sSL "https://github.com/bufbuild/buf/releases/download/${{ env.BUF_VERSION }}/buf-Linux-x86_64" -o ~/.local/bin/buf | |
| chmod +x ~/.local/bin/buf | |
| - name: Add tools to PATH | |
| run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Verify tools | |
| run: | | |
| k3d version | |
| kubectl version --client | |
| buf --version | |
| - name: Build APX binary | |
| run: | | |
| mkdir -p ./bin | |
| go build -o ./bin/apx ./cmd/apx | |
| - name: Run E2E tests | |
| env: | |
| CI: "1" | |
| NO_COLOR: "1" | |
| APX_DISABLE_TTY: "1" | |
| run: make test-e2e | |
| - name: Cleanup E2E resources | |
| if: always() | |
| run: make clean-e2e | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - name: Run go vet | |
| run: go vet ./... | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.x | |
| - name: Run Go Vulnerability Check | |
| uses: golang/govulncheck-action@v1 |