Accept args in pre-commit recipe #289
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: Tests | |
on: | |
pull_request: | |
push: | |
permissions: | |
contents: read | |
jobs: | |
lint-protos: | |
name: Lint protos | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- uses: bufbuild/buf-setup-action@v1 | |
with: | |
github_token: ${{ github.token }} | |
- uses: bufbuild/buf-lint-action@v1 | |
- uses: bufbuild/buf-push-action@v1 | |
if: github.ref_name == 'ccp' | |
with: | |
buf_token: ${{ secrets.BUF_TOKEN }} | |
golangci-lint: | |
name: Lint code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Get date | |
id: get-date | |
shell: bash | |
run: echo "date=$(date -u '+%Y-%')" >> "$GITHUB_OUTPUT" | |
- name: Restore golangci-lint cache | |
uses: actions/cache@v4 | |
timeout-minutes: 10 | |
continue-on-error: true | |
with: | |
path: ${{ runner.temp }}/golangci-lint-cache | |
key: ${{ runner.os }}-golangci-lint-cache-${{ steps.get-date.outputs.date }} | |
restore-keys: | | |
${{ runner.os }}-golangci-lint-cache- | |
- name: Run golangci-lint | |
run: make lint | |
env: | |
GOLANGCI_LINT_CACHE: ${{ runner.temp }}/golangci-lint-cache | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Run tests | |
run: go test -race ./... | |
mod: | |
name: Check mod tidy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Check | |
run: | | |
go mod tidy | |
git diff --name-only --exit-code || (echo "Please run 'go mod tidy'."; exit 1) |