mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-06-10 20:05:12 +02:00
We don't need the version matrix here, and don't want to reference the go version in go.mod. Instead, just always use stable.
94 lines
2.9 KiB
YAML
94 lines
2.9 KiB
YAML
name: tests
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- "**"
|
|
schedule: # daily at 07:30 UTC
|
|
- cron: "30 7 * * *"
|
|
workflow_dispatch:
|
|
permissions:
|
|
contents: read
|
|
concurrency:
|
|
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
go:
|
|
# test with the two most recent major go versions,
|
|
# as well as the minimum supported from go.mod.
|
|
- { go-version: stable }
|
|
- { go-version: oldstable }
|
|
- { go-version-file: go.mod }
|
|
platform: [ubuntu-latest]
|
|
include:
|
|
# include windows, but only with the latest Go version, since there
|
|
# is very little in the library that is platform specific
|
|
- go: { go-version: stable }
|
|
platform: windows-latest
|
|
|
|
# only update test coverage stats with most recent go version on linux
|
|
- go: { go-version: stable }
|
|
platform: ubuntu-latest
|
|
update-coverage: true
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ matrix.go.go-version }}
|
|
go-version-file: ${{ matrix.go.go-version-file }}
|
|
- name: Run go test
|
|
run: go test -v -race -coverprofile coverage.txt -covermode atomic ./...
|
|
- name: Upload coverage to Codecov
|
|
if: ${{ matrix.update-coverage }}
|
|
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
|
|
test-latest:
|
|
strategy:
|
|
fail-fast: false
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: stable
|
|
- uses: geomys/sandboxed-step@7d75eb49d17fdeeb3656b3a57d35932d205bcfb9 # v1.2.1
|
|
with:
|
|
run: |
|
|
go get -u -t ./...
|
|
go test -race ./...
|
|
staticcheck:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: stable
|
|
- uses: geomys/sandboxed-step@7d75eb49d17fdeeb3656b3a57d35932d205bcfb9 # v1.2.1
|
|
with:
|
|
run: go run honnef.co/go/tools/cmd/staticcheck@latest ./...
|
|
govulncheck:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: stable
|
|
- uses: geomys/sandboxed-step@7d75eb49d17fdeeb3656b3a57d35932d205bcfb9 # v1.2.1
|
|
with:
|
|
run: |
|
|
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
|
|
pushd caddy; go run golang.org/x/vuln/cmd/govulncheck@latest ./...; popd
|