ci: Run lint only if code or lint rules or ci actions have changed #37
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: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
files-changed: | |
uses: ./.github/workflows/files-changed.yml | |
lint: | |
if: needs.files-changed.outputs.lint == 'true' || needs.files-changed.outputs.actions == 'true' | |
needs: files-changed | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Setup golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: latest | |
skip-cache: true | |
args: --timeout=10m --verbose | |
test: | |
if: needs.files-changed.outputs.app == 'true' || needs.files-changed.outputs.actions == 'true' | |
needs: files-changed | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Test | |
run: make test | |
build: | |
if: needs.files-changed.outputs.app == 'true' || needs.files-changed.outputs.actions == 'true' | |
needs: files-changed | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
- name: Build | |
run: make build |