Skip to content

Commit 5eabe54

Browse files
committed
feat: refactor pipelines into reusable workflows
This change refactors the build, test, and benchmarking pipelines to a `presubmit` and `trunk` parent workflow which invokes other reusable workflows. This simplifies the deluge of pipelines that are executed, allowing for better orchestration and reduced noise on failures (only one email will be sent instead of several). Closes: #1198 Change-Id: I52407c39366bb9fbfd8fc1455a4f4a1d94f04897
1 parent e4c74ef commit 5eabe54

File tree

9 files changed

+171
-194
lines changed

9 files changed

+171
-194
lines changed

.github/workflows/benchmark.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
1-
name: Go build and test
1+
name: build-and-test
22

33
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
8-
workflow_dispatch:
9-
10-
concurrency:
11-
group: go-${{ github.ref }}
12-
cancel-in-progress: true
4+
workflow_call:
135

146
jobs:
15-
build:
16-
7+
with-go:
178
strategy:
189
matrix:
1910
go-version: [1.22.5]
2011
platform: [ubuntu-latest, macos-latest, windows-latest]
21-
2212
runs-on: ${{ matrix.platform }}
23-
2413
steps:
25-
26-
- name: Set up Go ${{ matrix.node-version }}
14+
- name: Set up Go ${{ matrix.go-version }}
2715
uses: actions/setup-go@v5
2816
with:
2917
go-version: ${{ matrix.go-version }}
@@ -43,17 +31,29 @@ jobs:
4331
GITHUB_TOKEN_PUBLIC: ${{ secrets._GITHUB_TOKEN_PUBLIC }}
4432
GITLAB_API_TOKEN: ${{ secrets.GITLAB_API_TOKEN }}
4533
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
46-
47-
lint:
34+
35+
with-node:
4836
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
node-version: [12.x, 14.x, 16.x]
40+
defaults:
41+
run:
42+
working-directory: webui
4943
steps:
50-
- name: Install Go
51-
uses: actions/setup-go@v5
44+
- name: Setup Node.js ${{ matrix.node-version }}
45+
uses: actions/setup-node@v4
5246
with:
53-
go-version: 1.19.4
47+
node-version: ${{ matrix.node-version }}
5448

55-
- name: Checkout code
49+
- name: Check out code
5650
uses: actions/checkout@v4
5751

58-
- name: Check Code Formatting
59-
run: find . -name "*.go" | while read line; do [ -z "$(gofmt -d "$line" | head)" ] || exit 1; done
52+
- name: Install
53+
run: make install
54+
55+
- name: Build
56+
run: make build
57+
58+
- name: Test
59+
run: make test

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/codespell.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
filter:
8+
name: filter
9+
runs-on: ubuntu-latest
10+
outputs:
11+
golang: ${{ steps.filter.outputs.golang }}
12+
golang_files: ${{ steps.filter.outputs.golang_files }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dorny/paths-filter@v3
16+
id: filter
17+
with:
18+
list-files: shell
19+
filters: |
20+
golang:
21+
- added|modified: '**/*.go'
22+
- added|modified: '/go.sum'
23+
- added|modified: '/go.mod'
24+
25+
codeql:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
# We must fetch at least the immediate parents so that if this is
32+
# a pull request then we can checkout the head.
33+
fetch-depth: 2
34+
35+
- run: git checkout HEAD^2
36+
if: ${{ github.event_name == 'pull_request' }}
37+
38+
- name: Initialize CodeQL
39+
uses: github/codeql-action/init@v3
40+
with:
41+
languages: go, javascript
42+
43+
- name: Autobuild
44+
uses: github/codeql-action/autobuild@v3
45+
46+
- name: Perform CodeQL Analysis
47+
uses: github/codeql-action/analyze@v3
48+
49+
spelling:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Check spelling
56+
uses: codespell-project/actions-codespell@v2
57+
58+
go:
59+
runs-on: ubuntu-latest
60+
needs:
61+
- filter
62+
if: needs.filter.outputs.golang == 'true'
63+
steps:
64+
- name: Install Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version: 1.22.5
68+
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Check Code Formatting
73+
run: |
74+
test -z "$(gofmt -d ${{ needs.filter.outputs.golang_files }})" || exit 1

.github/workflows/nodejs.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/presubmit.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# //.github/workflows:presubmit.yml
2+
#
3+
# This file exists to define the steps executed for a push to each tree matching
4+
# the pattern `refs/heads/*`, excluding the default ref. For configuring the
5+
# steps that occur after a push to the trunk branch, see
6+
# `//.github/workflows:trunk.yml`.
7+
---
8+
name: presubmit
9+
10+
on:
11+
push:
12+
branches-ignore:
13+
- master
14+
15+
concurrency:
16+
group: ${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
lint:
21+
uses: ./.github/workflows/lint.yml
22+
23+
build-and-test:
24+
uses: ./.github/workflows/build-and-test.yml
25+
secrets: inherit

.github/workflows/release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Build release binaries
22

33
on:
4-
workflow_dispatch:
54
push:
65
tags:
76
- "v*"
@@ -13,7 +12,6 @@ concurrency:
1312
jobs:
1413
build-release:
1514
runs-on: "ubuntu-latest"
16-
1715
steps:
1816
- name: Set up Go
1917
uses: actions/setup-go@v5

0 commit comments

Comments
 (0)