Skip to content

Commit 4623b75

Browse files
authored
Merge pull request #2897 from stan-dev/gha/use-concurrency-feature
Use built-in concurrency feature in Github Actions
2 parents 9251316 + b0b6812 commit 4623b75

2 files changed

Lines changed: 10 additions & 35 deletions

File tree

.github/workflows/header_checks.yml

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@ on:
1616
permissions:
1717
contents: read
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
1923
jobs:
2024
windows:
21-
permissions:
22-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
23-
contents: read # for actions/checkout to fetch code
2425
name: Windows
2526
runs-on: windows-latest
2627

2728
steps:
28-
- uses: n1hility/cancel-previous-runs@v3
29-
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
31-
workflow: c-cpp.yml
32-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
33-
3429
- uses: actions/checkout@v3
3530
- uses: actions/setup-python@v4
3631
with:
@@ -53,39 +48,21 @@ jobs:
5348
run: make -j2 test-headers
5449

5550
opencl:
56-
permissions:
57-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
58-
contents: read # for actions/checkout to fetch code
5951
name: OpenCL
6052
runs-on: ubuntu-latest
6153

6254
steps:
63-
- uses: n1hility/cancel-previous-runs@v3
64-
with:
65-
token: ${{ secrets.GITHUB_TOKEN }}
66-
workflow: c-cpp.yml
67-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
68-
6955
- uses: actions/checkout@v3
7056

7157
- name: Run header tests
7258
run: |
7359
echo "STAN_OPENCL=true" > make/local
7460
make -j2 test-headers
7561
no_range_checks:
76-
permissions:
77-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
78-
contents: read # for actions/checkout to fetch code
7962
name: NoRange
8063
runs-on: ubuntu-latest
8164

8265
steps:
83-
- uses: n1hility/cancel-previous-runs@v3
84-
with:
85-
token: ${{ secrets.GITHUB_TOKEN }}
86-
workflow: c-cpp.yml
87-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
88-
8966
- uses: actions/checkout@v3
9067

9168
- name: Run header tests

.github/workflows/main.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,16 @@ on:
1414
- 'RELEASE-NOTES.txt'
1515
permissions:
1616
contents: read
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
1720

1821
jobs:
1922
prim-rev:
20-
permissions:
21-
actions: write # for n1hility/cancel-previous-runs to create & stop workflow runs
22-
contents: read # for actions/checkout to fetch code
2323
name: prim and rev tests
2424
runs-on: windows-latest
2525

2626
steps:
27-
- uses: n1hility/cancel-previous-runs@v3
28-
with:
29-
token: ${{ secrets.GITHUB_TOKEN }}
30-
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
31-
3227
- uses: actions/checkout@v3
3328
- uses: actions/setup-python@v4
3429
with:
@@ -73,6 +68,7 @@ jobs:
7368
with:
7469
name: gtest_outputs_xml
7570
path: '**/*_test.xml'
71+
7672
fwd-non-fun-mix:
7773
name: fwd tests and non-fun mix tests
7874
runs-on: windows-latest
@@ -126,6 +122,7 @@ jobs:
126122
with:
127123
name: gtest_outputs_xml
128124
path: '**/*_test.xml'
125+
129126
mix-fun-1:
130127
name: mix/fun tests 1
131128
runs-on: windows-latest
@@ -174,6 +171,7 @@ jobs:
174171
with:
175172
name: gtest_outputs_xml
176173
path: '**/*_test.xml'
174+
177175
mix-fun-2:
178176
name: mix/fun tests 2
179177
runs-on: windows-latest

0 commit comments

Comments
 (0)