Merge pull request #98 from thanos-community/dependabot/go_modules/k8… #297
This file contains 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: go | |
on: | |
push: | |
branches: | |
- main | |
- first-dev | |
tags: | |
pull_request: | |
env: | |
golang-version: '1.22' | |
kind-version: 'v0.24.0' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Linters (Static Analysis) for Go | |
steps: | |
- name: Checkout code into the Go module directory. | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.golang-version }} | |
- uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Linting & vetting. | |
env: | |
GOBIN: /tmp/.bin | |
run: make lint | |
unit-tests: | |
runs-on: ubuntu-latest | |
name: Unit tests | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.golang-version }} | |
- run: make --always-make test | |
e2e-tests: | |
name: E2E tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
kind-image: | |
- 'kindest/node:v1.31.0' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.golang-version }} | |
- name: Start kind cluster | |
uses: helm/[email protected] | |
with: | |
version: ${{ env.kind-version }} | |
node_image: ${{ matrix.kind-image }} | |
wait: 10s | |
cluster_name: kind | |
- name: Wait for cluster to bootstrap | |
run: kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s | |
- name: Run tests | |
run: | | |
export KUBECONFIG="${HOME}/.kube/config" | |
make test-e2e |