Bump anchore/scan-action from 4 to 5 in the github-actions group (#168) #483
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
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: Check for GitLeaks | |
runs-on: ubuntu-latest | |
steps: | |
- {uses: actions/checkout@v4, with: {fetch-depth: 0}} | |
- uses: gacts/gitleaks@v1 | |
golangci-lint: | |
name: Run golangci-lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- {uses: actions/setup-go@v5, with: {go-version-file: go.mod}} | |
- uses: golangci/golangci-lint-action@v6 | |
go-test: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- {uses: actions/setup-go@v5, with: {go-version-file: go.mod}} | |
- run: go test -race ./... | |
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@v4 | |
- {uses: actions/setup-go@v5, with: {go-version-file: go.mod}} | |
- {uses: gacts/github-slug@v1, id: slug} | |
- 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@v4 | |
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@v4 | |
- {uses: gacts/github-slug@v1, id: slug} | |
- name: Build the 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@v5 # action page: <https://github.com/anchore/scan-action> | |
with: | |
image: tinifier:local | |
fail-build: true | |
severity-cutoff: medium # negligible, low, medium, high or critical |