diff --git a/.github/workflows/golang-workflow.yaml b/.github/workflows/golang-workflow.yaml index 2bed4716..83d6eb87 100644 --- a/.github/workflows/golang-workflow.yaml +++ b/.github/workflows/golang-workflow.yaml @@ -6,6 +6,97 @@ on: - opened - synchronize +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +env: + GO_VERSION: "1.24.1" + # Do not add the 'v' prefix to the golangci-lint version. + GOLANGCI_VERSION: "2.2.1" + CGO_ENABLED: "0" + jobs: - golang-ci: - uses: kerthcet/github-workflow-as-kube/.github/workflows/workflow-golang-ci.yaml@v0.1.21 + golang-lint: + name: golang-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + - name: golangci-lint + uses: golangci/golangci-lint-action@v7 + with: + version: v${{ env.GOLANGCI_VERSION }} + args: --timeout=30m --config=.golangci.yaml + + unit-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run unit tests + run: | + make test + + integration-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run integration tests + run: | + make test-integration + + e2e-test: + runs-on: ubuntu-latest + + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@v1.3.1 + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Run e2e tests + run: | + make test-e2e + timeout-minutes: 20 + env: + GINKGO_TIMEOUT: "15m"