105 lines
3.2 KiB
YAML
105 lines
3.2 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: "tests"
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
MAGEARGS: -d build/magefiles -w .
|
|
TARGETPLATFORM: linux/amd64
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
with:
|
|
egress-policy: block
|
|
allowed-endpoints: >
|
|
api.codecov.io:443
|
|
api.github.com:443
|
|
azure.archive.ubuntu.com:80
|
|
cli.codecov.io:443
|
|
esm.ubuntu.com:443
|
|
github.com:443
|
|
ingest.codecov.io:443
|
|
keybase.io:443
|
|
motd.ubuntu.com:443
|
|
objects.githubusercontent.com:443
|
|
packages.microsoft.com:443
|
|
proxy.golang.org:443
|
|
raw.githubusercontent.com:443
|
|
storage.googleapis.com:443
|
|
sum.golang.org:443
|
|
- name: Checkout
|
|
id: checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Go
|
|
id: setup_go
|
|
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
- name: Install Mage
|
|
uses: magefile/mage-action@6a5dcb5fe61f43d7c08a98bc3cf9bc63c308c08e # v3
|
|
with:
|
|
install-only: true
|
|
- name: Run tests
|
|
run: mage ${MAGEARGS} tests:ci
|
|
- name: Upload Coverage
|
|
id: upload_coverage
|
|
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v4
|
|
continue-on-error: true
|
|
with:
|
|
token: ${{secrets.CODECOV_TOKEN}}
|
|
file: ./coverage.txt
|
|
fail_ci_if_error: false
|
|
|
|
golangci:
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
pull-requests: read # Use with `only-new-issues` option.
|
|
steps:
|
|
- uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
|
with:
|
|
egress-policy: block
|
|
allowed-endpoints: >
|
|
api.github.com:443
|
|
azure.archive.ubuntu.com:80
|
|
esm.ubuntu.com:443
|
|
github.com:443
|
|
motd.ubuntu.com:443
|
|
objects.githubusercontent.com:443
|
|
packages.microsoft.com:443
|
|
proxy.golang.org:443
|
|
raw.githubusercontent.com:443
|
|
storage.googleapis.com:443
|
|
sum.golang.org:443
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
cache: false # golangci-lint maintains its own cache
|
|
- name: Install Mage
|
|
uses: magefile/mage-action@6a5dcb5fe61f43d7c08a98bc3cf9bc63c308c08e # v3
|
|
with:
|
|
install-only: true
|
|
- name: Install build deps
|
|
run: mage ${MAGEARGS} preps:deps
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
|
|
with:
|
|
only-new-issues: true
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|