use main repos for AL #235
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
--- | |
# DO NOT EDIT this file in a service repository. | |
# It should be changed in the `template` repository, and then copied to there as-is. | |
# All differences should be encapsulated in Makefile targets. | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
pull_request: | |
permissions: | |
contents: read | |
packages: write | |
checks: write | |
pull-requests: write | |
jobs: | |
test: | |
name: Test | |
timeout-minutes: 10 | |
continue-on-error: false | |
runs-on: ubuntu-latest | |
env: | |
# no `-mod=readonly` to test PRs made by @dependabot; | |
# `git diff --exit-code` step below still checks what we need | |
GOPRIVATE: github.com/percona,github.com/percona-platform | |
GONOSUMDB: github.com/percona,github.com/percona-platform | |
steps: | |
- name: Configure git for private modules | |
run: echo 'machine github.com login percona-robot password ${{ secrets.ROBOT_TOKEN }}' > $HOME/.netrc | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up Go release | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: "**/go.sum" | |
- name: Download Go modules | |
run: | | |
pushd tools && go mod download -x | |
popd && go mod download -x | |
- name: Install development tools | |
run: make init | |
- name: Build binaries | |
run: make build | |
- name: Run tests | |
run: | | |
go clean -testcache | |
make test | |
- name: Check that there are no source code changes | |
run: | | |
# Break job if any files were changed during its run (code generation, etc), except go.sum. | |
# `go mod tidy` could remove old checksums from that file, and that's okay on CI, | |
# and actually expected for PRs made by @dependabot. | |
# Checksums of actually used modules are checked by previous `go` subcommands. | |
pushd tools && go mod tidy -v && git checkout go.sum | |
popd && go mod tidy -v && git checkout go.sum | |
git diff --exit-code | |
- name: Run debug commands on failure | |
if: ${{ failure() }} | |
run: | | |
env | |
go version | |
go env | |
pwd | |
git status | |
check: | |
name: Check | |
timeout-minutes: 10 | |
if: github.event_name == 'pull_request' | |
continue-on-error: false | |
runs-on: ubuntu-latest | |
env: | |
# no `-mod=readonly` to test PRs made by @dependabot; | |
# `git diff --exit-code` step below still checks what we need | |
GOPRIVATE: github.com/percona,github.com/percona-platform | |
GONOSUMDB: github.com/percona,github.com/percona-platform | |
steps: | |
- name: Configure git for private modules | |
run: echo 'machine github.com login percona-robot password ${{ secrets.ROBOT_TOKEN }}' > $HOME/.netrc | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up Go release | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: "**/go.sum" | |
- name: Download Go modules | |
run: | | |
pushd tools && go mod download -x | |
popd && go mod download -x | |
- name: Install tools | |
run: make init | |
- name: Build binaries | |
run: make build | |
- name: Format sources | |
run: make format | |
- name: Run checks/linters | |
run: | | |
# use GITHUB_TOKEN because only it has access to GitHub Checks API | |
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=nofilter -fail-on-error=true | |
# run it like that until some of those issues/PRs are resolved: | |
# * https://github.com/quasilyte/go-consistent/issues/33 | |
# * https://github.com/golangci/golangci-lint/issues/288 | |
# * https://github.com/reviewdog/errorformat/pull/47 (once it is actually used by reviewdog) | |
bin/go-consistent -exclude=tools -pedantic ./... | |
- name: Check that there are no source code changes | |
run: | | |
# Break job if any files were changed during its run (tools installation, etc), except go.sum. | |
# `go mod tidy` could remove old checksums from that file, and that's okay on CI, | |
# and actually expected for PRs made by @dependabot. | |
# Checksums of actually used modules are checked by previous `go` subcommands. | |
pushd tools && go mod tidy -v && git checkout go.sum | |
popd && go mod tidy -v && git checkout go.sum | |
git diff --exit-code | |
- name: Run debug commands on failure | |
if: ${{ failure() }} | |
run: | | |
env | |
go version | |
go env | |
pwd | |
git status | |