Skip to content

Commit 2f46993

Browse files
authored
[CI] Only run GitHub Actions workflows when relevant (#2568)
* [CI] Only run GitHub Actions workflows when relevant * Add examples path to documentation workflow triggers
1 parent 4715e54 commit 2f46993

File tree

4 files changed

+93
-26
lines changed

4 files changed

+93
-26
lines changed

.github/workflows/CI.yml

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
name: CI
22
on:
33
pull_request:
4+
paths:
5+
- '.github/workflows/CI.yml'
6+
- 'ext/**'
7+
- 'lib/**'
8+
- 'src/**'
9+
- 'test/**'
10+
- 'Project.toml'
411
push:
512
branches:
613
- main
714
- release-*
15+
paths:
16+
- '.github/workflows/CI.yml'
17+
- 'ext/**'
18+
- 'lib/**'
19+
- 'src/**'
20+
- 'test/**'
21+
- 'Project.toml'
822
tags: '*'
923

1024
concurrency:
@@ -230,29 +244,3 @@ jobs:
230244
files: lcov.info
231245
token: ${{ secrets.CODECOV_TOKEN }}
232246
fail_ci_if_error: false # or true if you want CI to fail when Codecov fails
233-
docs:
234-
timeout-minutes: 20
235-
name: Documentation
236-
runs-on: ubuntu-latest
237-
steps:
238-
- uses: actions/checkout@v4
239-
- uses: julia-actions/setup-julia@v2
240-
with:
241-
version: '1'
242-
- uses: julia-actions/cache@v2
243-
- run: |
244-
julia --color=yes --project=docs -e '
245-
using Pkg
246-
Pkg.instantiate()'
247-
env:
248-
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
249-
- run: |
250-
julia --color=yes --project=docs -e '
251-
using Documenter: DocMeta, doctest
252-
using Enzyme
253-
DocMeta.setdocmeta!(Enzyme, :DocTestSetup, :(using Enzyme); recursive=true)
254-
doctest(Enzyme)'
255-
- run: julia --color=yes --project=docs docs/make.jl
256-
env:
257-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
258-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Documentation
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/Documentation.yml'
7+
- 'docs/**'
8+
- 'examples/**'
9+
- 'lib/**'
10+
- 'src/**'
11+
- 'Project.toml'
12+
push:
13+
branches:
14+
- main
15+
- release-*
16+
paths:
17+
- '.github/workflows/Documentation.yml'
18+
- 'docs/**'
19+
- 'examples/**'
20+
- 'lib/**'
21+
- 'src/**'
22+
- 'Project.toml'
23+
tags: '*'
24+
25+
concurrency:
26+
# Same group concurrency as the `PreviewCleanup.yml` workflow, because they both
27+
# git-push to the same branch, so we want to avoid clashes. NOTE: this is
28+
# different from the concurrency group below, which is to cancel successive
29+
# jobs from within the PR.
30+
group: docs-pushing
31+
32+
jobs:
33+
docs:
34+
timeout-minutes: 20
35+
name: Documentation
36+
runs-on: ubuntu-latest
37+
concurrency:
38+
# Skip intermediate builds: always.
39+
# Cancel intermediate builds: only if it is a pull request build.
40+
group: ${{ github.workflow }}-${{ github.ref }}
41+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
42+
steps:
43+
- uses: actions/checkout@v5
44+
- uses: julia-actions/setup-julia@v2
45+
with:
46+
version: '1'
47+
- uses: julia-actions/cache@v2
48+
- name: Instantiate docs environment
49+
shell: julia --color=yes --project=docs {0}
50+
run: |
51+
using Pkg
52+
Pkg.instantiate()
53+
env:
54+
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
55+
- name: Run doctests
56+
shell: julia --color=yes --project=docs {0}
57+
run: |
58+
using Documenter: DocMeta, doctest
59+
using Enzyme
60+
DocMeta.setdocmeta!(Enzyme, :DocTestSetup, :(using Enzyme); recursive=true)
61+
doctest(Enzyme)
62+
- name: Build the docs
63+
run: julia --color=yes --project=docs docs/make.jl
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

.github/workflows/PreviewCleanup.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
pull_request:
55
types: [closed]
66

7+
concurrency:
8+
# Same group concurrency as the `Documentation.yml` workflow, because they both
9+
# git-push to the same branch, so we want to avoid clashes.
10+
group: docs-pushing
11+
712
jobs:
813
doc-preview-cleanup:
914
runs-on: ubuntu-latest

.github/workflows/benchmark_pr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ name: Benchmark a pull request
22

33
on:
44
pull_request:
5+
paths:
6+
- '.github/workflows/benchmark_pr.yml'
7+
- 'benchmark/**'
8+
- 'ext/**'
9+
- 'lib/**'
10+
- 'src/**'
11+
- 'test/**'
12+
- 'Project.toml'
513

614
permissions:
715
pull-requests: write

0 commit comments

Comments
 (0)