Skip to content

chore: address go linting (#389) #662

chore: address go linting (#389)

chore: address go linting (#389) #662

Workflow file for this run

name: Lagoon CLI Test
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'
jobs:
test-suite:
runs-on: ubuntu-latest
strategy:
matrix:
goversion:
- 1.21
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{matrix.goversion}}
- name: Build
run: |
go install go.uber.org/mock/[email protected]
ARTIFACT_DESTINATION=./builds make build
# - name: Check version
# run: |
# ./builds/lagoon --version
docker:
needs: test-suite
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: "0"
-
name: Set tag version for build
if: "!startsWith(github.ref, 'refs/tags/')"
id: version_tag_build
run: |
VERSION=$(echo $(git describe --abbrev=0 --tags)+$(git rev-parse --short=8 HEAD))
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "tag is $VERSION"
-
name: Set tag version for tag
if: "startsWith(github.ref, 'refs/tags/')"
id: version_tag
run: |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "tag is $VERSION"
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ github.repository_owner }}/lagoon-cli
ghcr.io/${{ github.repository_owner }}/lagoon-cli
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
build-args: VERSION=${{ env.VERSION}}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}