Add GitHub Actions workflow for all CircleCI jobs #11
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: | |
| permissions: | |
| contents: read | |
| env: | |
| GO_VERSION: '1.24.11' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Build | |
| run: | | |
| make build | |
| git diff --exit-code | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y xz-utils | |
| - name: Lint | |
| run: make lint --always-make | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run tests | |
| run: make test --always-make | |
| test-e2e: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Build e2e test container | |
| run: | | |
| make container-test | |
| # Verify the image was built successfully | |
| docker images --format '{{.Repository}}:{{.Tag}}' | grep -q 'local_e2e_test' || (echo 'ERROR: Container image local_e2e_test not found' && exit 1) | |
| echo "Container image successfully built:" | |
| docker images | grep 'local_e2e_test' | |
| - name: Run e2e tests | |
| run: | | |
| # Run tests directly instead of via make to avoid rebuilding the container | |
| # The make test-e2e target has a dependency on container-test which would rebuild | |
| # Remove any existing test artifacts from previous runs | |
| rm -rf test/e2e/e2e_* | |
| CGO_ENABLED=1 GO111MODULE=on go test -v -race -short -tags integration ./test/e2e | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y unzip | |
| - name: Generate and validate | |
| run: | | |
| make generate validate --always-make | |
| make proto | |
| git diff --exit-code |