Skip to content

Commit 466c8c2

Browse files
authored
[skip changelog] Run CI workflows that are useful to contributors on pushes to any branch (arduino#887)
* Split docs workflow into validate and publish workflows The docs workflow had two uses: - Check that changes to docs don't break the static website build system - Publish the docs to the website To make the CI system friendly to contributors, it should be easy for them to validate documentation changes from a feature branch, meaning the validation aspect should run on a push to any branch. However, the special behavior of the workflow to publish on pushes conflicted with that usage. The most simple solution is to split the workflow into two. The validation workflow contains the process of interest to contributors, and is thus made friendly to their development process. The publishing workflow is not of interest to contributors, and thus doesn't need to be configured to run on pushes to any branch. * Run workflows that are useful to contributors on push to any branch Contributors should run CI in their feature branch to make sure it's passing before submitting a PR. Previously, the CI workflows were configured to run only on push to the master branch, meaning that contributors would need to modify the workflows just to get them to run on a feature branch. It's very unlikely that a contributor would do that, so they are more likely to just submit the PR, then if CI on the PR fails push fixup commits until CI is passing. The solution is simply to remove the filters that caused the workflows to run only on push to master.
1 parent 67b47b6 commit 466c8c2

File tree

5 files changed

+77
-28
lines changed

5 files changed

+77
-28
lines changed

.github/workflows/link-validation.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Verifies documentation links
22

33
on:
44
push:
5-
branches:
6-
- master
75
pull_request:
86
schedule:
97
- cron: "0 3 * * 1" # Every Monday at 03:00

.github/workflows/docs.yaml renamed to .github/workflows/publish-docs.yaml

+3-22
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
name: docs
1+
name: publish-docs
22

33
on:
4-
pull_request:
5-
paths:
6-
# existing docs
7-
- "docs/**"
8-
# changes to the cli reference generator
9-
- "docsgen/**"
10-
# potential changes to commands documentation
11-
- "cli/**"
12-
# potential changes to gRPC documentation
13-
- "rpc/**"
14-
# changes to the workflow itself
15-
- ".github/workflows/docs.yaml"
164
push:
175
branches:
186
- master
@@ -24,10 +12,10 @@ on:
2412
- "docsgen/**"
2513
- "cli/**"
2614
- "rpc/**"
27-
- ".github/workflows/docs.yaml"
15+
- ".github/workflows/publish-docs.yaml"
2816

2917
jobs:
30-
build:
18+
publish:
3119
runs-on: ubuntu-latest
3220

3321
steps:
@@ -73,17 +61,10 @@ jobs:
7361
python3 -m pip install --upgrade pip
7462
python3 -m pip install -r ./requirements_docs.txt
7563
76-
- name: Build docs website
77-
# This runs on every PR to ensure the docs build is sane, these docs
78-
# won't be published
79-
if: github.event_name == 'pull_request'
80-
run: task docs:build
81-
8264
- name: Publish docs
8365
# Determine docs version for the commit pushed and publish accordingly using Mike.
8466
# Publishing implies creating a git commit on the gh-pages branch, we let
8567
# ArduinoBot own these commits.
86-
if: github.event_name == 'push'
8768
run: |
8869
git config --global user.email "[email protected]"
8970
git config --global user.name "ArduinoBot"

.github/workflows/python-lint.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: "Lints Python code"
22

33
on:
44
push:
5-
branches:
6-
- master
75
paths:
86
- "**.py"
97
- ".flake8"

.github/workflows/test.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: test
22

33
on:
44
push:
5-
branches:
6-
- master
75
pull_request:
86

97
jobs:

.github/workflows/validate-docs.yaml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: validate-docs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
# existing docs
7+
- "docs/**"
8+
# changes to the cli reference generator
9+
- "docsgen/**"
10+
# potential changes to commands documentation
11+
- "cli/**"
12+
# potential changes to gRPC documentation
13+
- "rpc/**"
14+
# changes to the workflow itself
15+
- ".github/workflows/validate-docs.yaml"
16+
push:
17+
# At this day, GitHub doesn't support YAML anchors, d'oh!
18+
paths:
19+
- "docs/**"
20+
- "docsgen/**"
21+
- "cli/**"
22+
- "rpc/**"
23+
- ".github/workflows/validate-docs.yaml"
24+
25+
jobs:
26+
validate:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v2
32+
33+
- name: Install Taskfile
34+
uses: Arduino/actions/setup-taskfile@master
35+
with:
36+
repo-token: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Setup Go
39+
uses: actions/setup-go@v2-beta
40+
with:
41+
go-version: "1.14"
42+
43+
- name: Install Go dependencies
44+
run: |
45+
go version
46+
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
47+
48+
- name: Install protoc compiler
49+
uses: arduino/setup-protoc@v1
50+
with:
51+
repo-token: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Setup Python
54+
uses: actions/setup-python@v1
55+
with:
56+
python-version: "3.6"
57+
architecture: "x64"
58+
59+
- name: Cache dependencies
60+
uses: actions/cache@v1
61+
with:
62+
path: ~/.cache/pip
63+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
64+
restore-keys: |
65+
${{ runner.os }}-pip-
66+
67+
- name: Install Python dependencies
68+
run: |
69+
python3 -m pip install --upgrade pip
70+
python3 -m pip install -r ./requirements_docs.txt
71+
72+
- name: Build docs website
73+
# Ensure the docs build is sane, these docs won't be published
74+
run: task docs:build

0 commit comments

Comments
 (0)