Skip to content
95 changes: 93 additions & 2 deletions .github/workflows/golang-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
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"
Loading