Skip to content

Commit 200be74

Browse files
committed
Add a check that main.yml and release.yml are exactly in sync
1 parent 90e8d32 commit 200be74

File tree

5 files changed

+77
-10
lines changed

5 files changed

+77
-10
lines changed

.github/ci.diff

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--- .github/workflows/main.yml
2+
+++ .github/workflows/release.yml
3+
@@ -1,13 +1,13 @@
4+
-name: CI
5+
+name: CI (release)
6+
7+
on:
8+
push:
9+
paths-ignore: ['docs/**', '*.md']
10+
pull_request:
11+
paths-ignore: ['docs/**', '*.md']
12+
- branches: [master]
13+
+ branches: [v1]
14+
schedule:
15+
- - cron: '0 6 * * 6'
16+
+ - cron: '0 6 * * *'
17+
18+
jobs:
19+
try:
20+
@@ -35,8 +35,8 @@
21+
shell: bash
22+
steps:
23+
- uses: actions/checkout@v5
24+
- - run: npm install --only=prod
25+
- - uses: ./
26+
+
27+
+ - uses: crystal-lang/install-crystal@v1
28+
with: ${{ matrix.config }}
29+
id: install
30+
- run: |
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Checks that the files 'main.yml' and 'release.yml' are exactly in sync
2+
3+
name: Check workflow configs
4+
on:
5+
pull_request:
6+
jobs:
7+
check_configs:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Download source
11+
uses: actions/checkout@v5
12+
- name: Apply the existing patch
13+
run: |
14+
patch --backup -p0 -i .github/ci.diff
15+
mv .github/workflows/{main.yml,release.yml}
16+
mv .github/workflows/{main.yml.orig,main.yml}
17+
- name: Regenerate the patch
18+
run: |
19+
diff -U2 {--label=,}.github/workflows/main.yml {--label=,}.github/workflows/release.yml > .github/ci.diff || true
20+
- name: Check if any edits are necessary
21+
id: diff
22+
run: |
23+
git diff --color --exit-code
24+
- name: Apply automatic fixes using pre-commit-ci-lite
25+
if: failure() && steps.diff.outcome == 'failure'
26+
uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0

.github/workflows/main.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,3 @@ jobs:
7878
shards build
7979
working-directory: test-project
8080
if: ${{ !contains('false', matrix.config.shards) }}
81-
82-
test:
83-
runs-on: ubuntu-latest
84-
steps:
85-
- uses: actions/checkout@v5
86-
- run: npm install
87-
- run: npm test

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: CI (release)
22

33
on:
44
push:
5+
paths-ignore: ['docs/**', '*.md']
6+
pull_request:
7+
paths-ignore: ['docs/**', '*.md']
58
branches: [v1]
6-
7-
8-
99
schedule:
1010
- cron: '0 6 * * *'
1111

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
paths-ignore: ['docs/**', '*.md']
6+
pull_request:
7+
paths-ignore: ['docs/**', '*.md']
8+
branches: [master]
9+
schedule:
10+
- cron: '0 6 * * 6'
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: npm install
18+
- run: npm test

0 commit comments

Comments
 (0)