Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Updated linter

Updated linter #373

Workflow file for this run

name: Test & Build
on: push
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
check-latest: true
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Vet
run: go vet ./...
# get .golangci.yml from github.com/overmindtech/golangci-lint_config
- name: Get .golangci.yml from github.com/overmindtech/golangci-lint_configs
run: |
curl -sfL https://raw.githubusercontent.com/overmindtech/golangci-lint_config/main/.golangci.yml -o .golangci.yml
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60.1
args: --timeout 3m
skip-cache: true # the linters require all code generation and dependecies to be present, but the cache implementation completely falls over when there is already existing content. See https://github.com/golangci/golangci-lint-action/issues/23, https://github.com/golangci/golangci-lint-action/issues/863, https://github.com/golangci/golangci-lint-action/issues/984
- name: Test
run: go test ./...
build:
name: Build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
needs:
- test
permissions:
contents: read # required for checkout
id-token: write # mint AWS credentials through OIDC
packages: write
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile
image_name: source-template
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/overmindtech/${{ matrix.image_name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: setup-builder
uses: docker/setup-buildx-action@v3
- name: Build and push
id: push
uses: docker/build-push-action@v5
with:
builder: ${{ steps.setup-builder.outputs.name }}
context: .
sbom: true
cache-from: type=gha
cache-to: type=gha,mode=max
file: build/package/${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}