Skip to content

Commit 683d54e

Browse files
committed
Move generated code sync check to dedicated workflow
I have found that the approach of focusing each GitHub Actions workflows on a specific type of task can have some significant benefits - Improved efficiency due to being able to use a refined paths filter to prevent pointless runs of the workflow - Easier for contributors to interpret the results in the event of a failure - Easier to maintain - More likely to be applicable as a "template" to arbitrary projects This check really had no business being in the test runner workflow. It could be argued that it is suitable for inclusion in the "Check Go" workflow, but it does have unique paths filter requirements and is also not in that workflow's "template". So, at least for now, I am putting it in a dedicated workflow.
1 parent 94c1820 commit 683d54e

File tree

3 files changed

+48
-8
lines changed

3 files changed

+48
-8
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Check Code Generation
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/check-code-generation-task.ya?ml"
7+
- "Taskfile.yml"
8+
- "go.mod"
9+
- "go.sum"
10+
- "**/*.go"
11+
- "etc/schemas/**/*.json"
12+
pull_request:
13+
paths:
14+
- ".github/workflows/check-code-generation-task.ya?ml"
15+
- "Taskfile.yml"
16+
- "go.mod"
17+
- "go.sum"
18+
- "**/*.go"
19+
- "etc/schemas/**/*.json"
20+
21+
env:
22+
BUILDS_ARTIFACT: build-artifacts
23+
24+
jobs:
25+
test-go:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Checkout local repository
30+
uses: actions/checkout@v2
31+
32+
- name: Install Go
33+
uses: actions/setup-go@v2
34+
with:
35+
go-version: "1.16"
36+
37+
- name: Install Taskfile
38+
uses: arduino/setup-task@v1
39+
with:
40+
repo-token: ${{ secrets.GITHUB_TOKEN }}
41+
version: 3.x
42+
43+
- name: Generate code
44+
run: task go:generate
45+
46+
- name: Check for forgotten code generation
47+
run: git diff --color --exit-code

.github/workflows/test.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
- "go.sum"
1010
- "**/*.go"
1111
- "**/testdata/**"
12-
- "etc/schemas/**/*.json"
1312
pull_request:
1413
paths:
1514
- ".github/workflows/test.yml"
@@ -18,7 +17,6 @@ on:
1817
- "go.sum"
1918
- "**/*.go"
2019
- "**/testdata/**"
21-
- "etc/schemas/**/*.json"
2220

2321
env:
2422
BUILDS_ARTIFACT: build-artifacts
@@ -49,12 +47,6 @@ jobs:
4947
repo-token: ${{ secrets.GITHUB_TOKEN }}
5048
version: 3.x
5149

52-
- name: Generate code
53-
run: task go:generate
54-
55-
- name: Check for forgotten code generation
56-
run: git diff --color --exit-code
57-
5850
- name: Run unit tests
5951
run: task go:test-unit
6052

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Tests Status](https://github.com/arduino/arduino-lint/workflows/Run%20tests/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Run+tests)
44
[![Test Integration status](https://github.com/arduino/arduino-lint/actions/workflows/test-go-integration-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/test-go-integration-task.yml)
55
[![Check Go status](https://github.com/arduino/arduino-lint/actions/workflows/check-go-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-go-task.yml)
6+
[![Check Code Generation status](https://github.com/arduino/arduino-lint/actions/workflows/check-code-generation-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-code-generation-task.yml)
67
[![Publish Nightly Build status](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/publish-go-nightly-task.yml)
78
[![Check Python status](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-python-task.yml)
89
[![Check Markdown status](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/arduino-lint/actions/workflows/check-markdown-task.yml)

0 commit comments

Comments
 (0)