Skip to content

chore(deps): update golangci/golangci-lint docker tag to v1.54 #398

chore(deps): update golangci/golangci-lint docker tag to v1.54

chore(deps): update golangci/golangci-lint docker tag to v1.54 #398

Workflow file for this run

name: tests
on:
push:
branches: [master, main]
paths-ignore: ['**.md']
tags-ignore: ['**']
pull_request:
paths-ignore: ['**.md']
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
gitleaks:
name: Gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: {fetch-depth: 0}
- uses: gacts/gitleaks@v1
golangci-lint:
name: Golang-CI (lint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gacts/setup-go-with-cache@v1
with: {go-version: 1.19}
- uses: golangci/golangci-lint-action@v3 # Action page: <https://github.com/golangci/golangci-lint-action>
with: {skip-pkg-cache: true, skip-build-cache: true}
go-test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with: {fetch-depth: 2} # Fixes codecov error 'Issue detecting commit SHA'
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}
- run: go test -race -covermode=atomic -coverprofile /tmp/coverage.txt ./...
- continue-on-error: true
uses: codecov/codecov-action@v3 # https://github.com/codecov/codecov-action
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: /tmp/coverage.txt
fail_ci_if_error: false
build:
name: Build for ${{ matrix.os }} (${{ matrix.arch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [linux, windows, darwin] # linux, freebsd, darwin, windows
arch: [amd64] # amd64, 386
include:
- os: linux
arch: 386
needs: [golangci-lint, go-test]
steps:
- uses: actions/checkout@v3
- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}
- {uses: gacts/github-slug@v1, id: slug}
- name: Build application
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
LDFLAGS: -s -w -X gh.tarampamp.am/tinifier/v4/internal/version.version=${{ steps.slug.outputs.branch-name-slug }}@${{ steps.slug.outputs.commit-hash-short }}
run: go build -trimpath -ldflags "$LDFLAGS" -o /tmp/tinifier ./cmd/tinifier/
- name: Try to execute
if: matrix.os == 'linux'
run: /tmp/tinifier --version && /tmp/tinifier -h
- uses: actions/upload-artifact@v3
with:
name: tinifier-${{ matrix.os }}-${{ matrix.arch }}
path: /tmp/tinifier
if-no-files-found: error
retention-days: 1
image:
name: Build docker image
runs-on: ubuntu-latest
needs: [golangci-lint, go-test]
steps:
- uses: actions/checkout@v3
- {uses: gacts/github-slug@v1, id: slug}
- name: Build image
run: docker build -t tinifier:local --build-arg "APP_VERSION=${{ steps.slug.outputs.branch-name-slug }}@${{ steps.slug.outputs.commit-hash-short }}" -f ./Dockerfile .
- run: docker run --rm tinifier:local --version
- uses: anchore/scan-action@v3 # action page: <https://github.com/anchore/scan-action>
with:
image: tinifier:local
fail-build: true
severity-cutoff: medium # negligible, low, medium, high or critical