Skip to content

Commit

Permalink
ci: use paths to restrict workflow runs
Browse files Browse the repository at this point in the history
  • Loading branch information
purpleclay committed Jul 17, 2022
1 parent 8986b96 commit 7d085e2
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 6 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ on:
push:
branches:
- main
paths:
- "*.go"
- "go.mod"
- "go.sum"
pull_request:
paths:
- "*.go"
- "go.mod"
- "go.sum"
jobs:
ci:
strategy:
Expand All @@ -36,12 +44,15 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
if: matrix.os == 'windows-latest'

- name: Checkout
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: Cache Go
uses: actions/cache@v3
with:
Expand All @@ -51,24 +62,29 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: task test

- name: Build
run: task build

# All static checks from this point should run on linux as it is the
# fastest platform
- name: Integration Test
if: matrix.os == 'ubuntu-latest'
run: task integration-test

- name: Lint Code
if: matrix.os == 'ubuntu-latest'
uses: golangci/[email protected]
with:
skip-go-installation: true

- name: misspell
if: matrix.os == 'ubuntu-latest'
uses: reviewdog/action-misspell@v1
Expand All @@ -82,6 +98,7 @@ jobs:
./Taskfile.yaml
./.github/workflows/**
./CODE_OF_CONDUCT.md
- name: Code Coverage
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ name: code-quality

on:
push:
branches: [main]
branches:
- main
paths:
- "*.go"
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
paths:
- "*.go"
schedule:
- cron: "36 4 * * 6"

Expand All @@ -47,7 +50,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dependency Review
uses: actions/dependency-review-action@v2
2 changes: 0 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ on:
- ".github/workflows/docs.yml"
- "docs/**"
- "mkdocs.yml"
# Allow the workflow to be triggered manually
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/git-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: GitGuardian
uses: GitGuardian/gg-shield-action@master
env:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- uses: actions/cache@v3
with:
path: |
Expand All @@ -48,10 +50,13 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Cosign
uses: sigstore/cosign-installer@main

- name: Download Syft
uses: anchore/sbom-action/download-syft@v0

- name: GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/uplift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.GH_UPLIFT }}

- name: Release
uses: gembaadvantage/[email protected]
with:
Expand Down

0 comments on commit 7d085e2

Please sign in to comment.