setup CodeQL workflow #834
Workflow file for this run
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
--- | |
name: test | |
on: ["push", "pull_request"] | |
env: | |
GO_VERSION: "1.22" | |
LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le" | |
jobs: | |
lint: | |
name: Lint | |
permissions: | |
contents: read | |
pull-requests: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1 | |
with: | |
format: auto | |
config_file: .yamllint.yaml | |
- uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 | |
with: | |
args: --verbose | |
version: v1.57.1 | |
build: | |
name: Build all linux architectures | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Build on all supported architectures | |
run: | | |
set -e | |
for arch in ${LINUX_ARCHES}; do | |
echo "Building for arch $arch" | |
GOARCH=$arch go build ./... | |
done | |
test-linux: | |
name: Run tests on Linux amd64 | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: setup go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Install test binaries | |
run: | | |
go install github.com/mattn/[email protected] | |
go install github.com/modocache/gover@latest | |
- name: test | |
run: COVERALLS=1 ./test.sh | |
- env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
name: Send coverage to coveralls | |
run: | | |
PATH=$PATH:$(go env GOPATH)/bin | |
gover | |
goveralls -coverprofile=gover.coverprofile -service=github | |
test-win: | |
name: Build and run tests on Windows | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- name: setup go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: test | |
run: bash ./test.sh |