Skip to content

Commit 74fb785

Browse files
authored
Merge pull request #64 from crystal-lang/checkci
Add a check that main.yml and release.yml are exactly in sync
2 parents e840c5e + f748cc8 commit 74fb785

File tree

5 files changed

+77
-9
lines changed

5 files changed

+77
-9
lines changed

.github/generate_release_yml.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from pathlib import Path
2+
3+
content = Path(".github/workflows/main.yml").read_text()
4+
content = (
5+
content.replace(
6+
"name: CI",
7+
"name: CI (release)",
8+
)
9+
.replace(
10+
" pull_request:\n paths-ignore: ['docs/**', '*.md']",
11+
"\n",
12+
)
13+
.replace(
14+
"branches: [master]",
15+
"branches: [v1]",
16+
)
17+
.replace(
18+
"cron: '0 6 * * 6'",
19+
"cron: '0 6 * * *'",
20+
)
21+
.replace(
22+
" - run: npm install --only=prod",
23+
"",
24+
)
25+
.replace(
26+
" - uses: ./",
27+
" - uses: crystal-lang/install-crystal@v1",
28+
)
29+
)
30+
Path(".github/workflows/release.yml").write_text(content)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 edits
13+
run: |
14+
python3 .github/generate_release_yml.py
15+
- name: Check if any edits are necessary
16+
id: diff
17+
run: |
18+
git diff --color --exit-code
19+
- name: Apply automatic fixes using pre-commit-ci-lite
20+
if: failure() && steps.diff.outcome == 'failure'
21+
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
@@ -85,10 +85,3 @@ jobs:
8585
shards build
8686
working-directory: test-project
8787
if: ${{ !contains('false', matrix.config.shards) }}
88-
89-
test:
90-
runs-on: ubuntu-latest
91-
steps:
92-
- uses: actions/checkout@v5
93-
- run: npm install
94-
- run: npm test

.github/workflows/release.yml

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

33
on:
44
push:
5-
branches: [v1]
6-
5+
paths-ignore: ['docs/**', '*.md']
76

87

8+
branches: [v1]
99
schedule:
1010
- cron: '0 6 * * *'
1111

@@ -28,6 +28,12 @@ jobs:
2828
- {shards: latest, crystal: latest}
2929
- {shards: nightly, crystal: nightly}
3030
- {crystal: 'branch:master'}
31+
exclude:
32+
- os: ubuntu-24.04-arm
33+
config: {shards: '0.14', crystal: '1.3'}
34+
include:
35+
- os: ubuntu-24.04-arm
36+
config: {shards: '0.19', crystal: '1.18'}
3137

3238
name: crystal ${{ matrix.config.crystal }} + shards ${{ matrix.config.shards }} (${{ matrix.os }})
3339
runs-on: ${{ matrix.os }}

.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)