From 21ecf2fdd2175a7dba4ffea89dae89fd8fc4223e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 18 Apr 2024 10:12:03 +0200 Subject: [PATCH] Use version.mk golang version in CI Signed-off-by: Evan Lezar --- .github/workflows/golang.yaml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 38a77a33..fc5acb4b 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -16,6 +16,9 @@ name: Golang on: pull_request: + types: + - opened + - synchronize branches: - main - release-* @@ -29,28 +32,45 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + name: Checkout code + - name: Get Golang version + id: vars + run: | + GOLANG_VERSION=$( grep "GOLANG_VERSION :=" versions.mk ) + echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GOLANG_VERSION }} - name: Lint uses: golangci/golangci-lint-action@v4 with: version: latest args: -v --timeout 5m skip-cache: true + - name: Check golang modules + run: make check-vendor test: name: Unit test runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + - name: Get Golang version + id: vars + run: | + GOLANG_VERSION=$( grep "GOLANG_VERSION :=" versions.mk ) + echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV - name: Install Go uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: ${{ env.GOLANG_VERSION }} - run: make test build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + name: Checkout code - name: Build run: make docker-build