Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 60 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,51 @@ jobs:
with:
graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}

# Detect which files changed so PRs skip irrelevant jobs. For merge_group and
# push events every filter defaults to 'true', so the merge queue and post-merge
# always run the full suite (a stale generated artifact must never merge because
# its check was skipped, as happened when the library subcommands merged).
detect-changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
go: ${{ github.event_name != 'pull_request' || steps.filter.outputs.go == 'true' || steps.filter.outputs.ci == 'true' }}
scripts: ${{ github.event_name != 'pull_request' || steps.filter.outputs.scripts == 'true' || steps.filter.outputs.ci == 'true' }}
steps:
- name: Checkout (needed for non-PR events)
if: github.event_name != 'pull_request'
uses: actions/checkout@v7
- name: Detect changed files
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
ci:
- '.github/workflows/ci.yml'
- '.github/scripts/**'
go:
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '.goreleaser*.yaml'
- 'resources/**'
- 'package/**'
- 'config/**'
- 'weaver/**'
- 'generator/**/data_library/**'
scripts:
- 'scripts/**'
- 'package/scripts/**'
- '.github/scripts/**'

shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
needs: optimize_ci
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.scripts == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -48,8 +88,8 @@ jobs:
setup:
name: Setup environment
runs-on: ubuntu-latest
needs: optimize_ci
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -72,8 +112,8 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -97,8 +137,8 @@ jobs:
gosec:
name: Gosec
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -116,8 +156,8 @@ jobs:
revive:
name: Revive
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -139,8 +179,8 @@ jobs:
build:
name: Build - ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -225,8 +265,8 @@ jobs:
merge-build:
name: Merge Build
runs-on: ubuntu-latest
needs: [optimize_ci, setup, build]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup, build]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
env:
cinc_package: https://packages.cinc.sh/files/stable/cinc-auditor/4.56.58/ubuntu/22.04/cinc-auditor_4.56.58-1_amd64.deb
steps:
Expand Down Expand Up @@ -322,8 +362,8 @@ jobs:
man-check:
name: Man pages
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -341,8 +381,8 @@ jobs:
completion-check:
name: Shell completion (bash, zsh)
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -360,8 +400,8 @@ jobs:
generate-o11y-check:
name: Generated metrics
runs-on: ubuntu-latest
needs: [optimize_ci, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' }}
needs: [optimize_ci, detect-changes, setup]
if: ${{ needs.optimize_ci.outputs.skip != 'true' && needs.detect-changes.outputs.go == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
Loading
Loading