41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
name: Lint and test yml
|
|
|
|
on: [push]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint_and_test:
|
|
# if: ${{ !github.event.act }} # Skip during local actions testing
|
|
if: github.repository == 'garrancode/gocustomurls'
|
|
runs-on: [ubuntu-latest, self-hosted]
|
|
# runs-on: [ubuntu-latest]
|
|
|
|
strategy:
|
|
matrix:
|
|
# Uses some of the solutions found here (https://github.com/actions/setup-go/issues/450)
|
|
go-version: ['', 'oldstable', 'stable']
|
|
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # git show-ref v4.2.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false # https://yossarian.net/til/post/actions-checkout-can-leak-github-credentials/
|
|
|
|
- name: Setup Go version ${{ matrix.go-version }}
|
|
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # git show-ref v5.4.0
|
|
with:
|
|
# Uses the condition found in here (https://github.com/actions/setup-go?tab=readme-ov-file#getting-go-version-from-the-gomod-file)
|
|
go-version: ${{ matrix.go-version }}
|
|
go-version-file: 'go.mod'
|
|
|
|
- name: Lint with ${{ matrix.go-version }}
|
|
uses: golangci/golangci-lint-action@8564da7cb3c6866ed1da648ca8f00a258ef0c802 # git show-ref v6.5.2
|
|
with:
|
|
args: --timeout=3m --verbose
|
|
|
|
- name: Test with ${{ matrix.go-version }}
|
|
run: |
|
|
make coverage-full
|