Skip to content

Commit

Permalink
chore(ci): tidyup and improve actions workflows
Browse files Browse the repository at this point in the history
- use consistent `on:` triggers across all
- remove `if:` clause that left "Skipping xyz action..." in the status
  checks, not sure why we were doing that rather than just limiting push
  builds to `main`
- yamlfmt

Signed-off-by: Dominic Evans <[email protected]>
  • Loading branch information
dnwe committed Aug 4, 2023
1 parent 09ced0b commit b006724
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 83 deletions.
55 changes: 31 additions & 24 deletions .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
name: API Compatibility
on: [push, pull_request]
on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
apidiff:
runs-on: ubuntu-latest
if: github.base_ref
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Add GOBIN to PATH
run: echo "$(go env GOPATH)/bin" >>$GITHUB_PATH
- name: Install apidiff cmd
run: go install golang.org/x/exp/cmd/apidiff@latest
- name: Checkout base code
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: "base"
- name: Capture apidiff baseline
run: apidiff -m -w ../baseline.bin .
working-directory: "base"
- name: Checkout updated code
uses: actions/checkout@v3
with:
path: "updated"
- name: Run apidiff check
run: apidiff -m -incompatible ../baseline.bin .
working-directory: "updated"
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
- name: Add GOBIN to PATH
run: echo "$(go env GOPATH)/bin" >>$GITHUB_PATH
- name: Install apidiff cmd
run: go install golang.org/x/exp/cmd/apidiff@latest
- name: Checkout base code
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: "base"
- name: Capture apidiff baseline
run: apidiff -m -w ../baseline.bin .
working-directory: "base"
- name: Checkout updated code
uses: actions/checkout@v3
with:
path: "updated"
- name: Run apidiff check
run: apidiff -m -incompatible ../baseline.bin .
working-directory: "updated"
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
name: CI
on: [push, pull_request]
on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
lint:
name: Linting with Go ${{ matrix.go-version }}
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: "CodeQL"

on:
merge_group:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- "**"
schedule:
- cron: '39 12 * * 1'

- cron: "39 12 * * 1"
jobs:
analyze:
name: Analyze
Expand All @@ -16,28 +17,22 @@ jobs:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['go']

language: ["go"]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.17

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
21 changes: 8 additions & 13 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
---
name: Fuzzing

on: [push, pull_request]

on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
test:
name: Fuzz
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

env:
GOFLAGS: -trimpath

steps:
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.19.x

- name: Get Go environment
id: go-env
run: |
echo "cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Set up cache
uses: actions/cache@v3
with:
Expand All @@ -37,6 +33,5 @@ jobs:
key: fuzz-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
fuzz-go-
- name: Run any fuzzing tests
run: go test -v -run=^Fuzz -test.fuzztime=5m ./...
14 changes: 8 additions & 6 deletions .github/workflows/fvt.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
name: FVT
on: [push, pull_request]
on:
merge_group:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
fvt:
name: Test with Kafka ${{ matrix.kafka-version }}
runs-on: ubuntu-latest

# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
Expand Down
49 changes: 23 additions & 26 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@
name: "Stale issues and PRs"
on:
schedule:
- cron: "0 */2 * * *"

- cron: "0 */2 * * *"
jobs:
stale:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v8
with:
days-before-stale: 90
days-before-close: 30
stale-issue-message: >-
Thank you for taking the time to raise this issue. However, it has
not had any activity on it in the past 90 days and will be closed in
30 days if no updates occur.
- uses: actions/stale@v8
with:
days-before-stale: 90
days-before-close: 30
stale-issue-message: >-
Thank you for taking the time to raise this issue. However, it has not had
any activity on it in the past 90 days and will be closed in 30 days if
no updates occur.
Please check if the main branch has already resolved the issue
since it was raised. If you believe the issue is still valid and you
would like input from the maintainers then please comment to ask for
it to be reviewed.
stale-pr-message: >-
Thank you for your contribution! However, this pull request has not
had any activity in the past 90 days and will be closed in 30 days if
no updates occur.
Please check if the main branch has already resolved the issue since it
was raised. If you believe the issue is still valid and you would like input
from the maintainers then please comment to ask for it to be reviewed.
stale-pr-message: >-
Thank you for your contribution! However, this pull request has not had
any activity in the past 90 days and will be closed in 30 days if no updates
occur.
If you believe the changes are still valid then please verify your
branch has no conflicts with main and rebase if needed. If you
are awaiting a (re-)review then please let us know.
stale-issue-label: "stale"
exempt-issue-labels: "stale/exempt,pinned"
stale-pr-label: "stale"
exempt-pr-labels: "stale/exempt,pinned"
If you believe the changes are still valid then please verify your branch
has no conflicts with main and rebase if needed. If you are awaiting a (re-)review
then please let us know.
stale-issue-label: "stale"
exempt-issue-labels: "stale/exempt,pinned"
stale-pr-label: "stale"
exempt-pr-labels: "stale/exempt,pinned"

0 comments on commit b006724

Please sign in to comment.