Skip to content

Commit 52c91cb

Browse files
committed
Consolidate CI config
1 parent 79d3179 commit 52c91cb

File tree

2 files changed

+106
-57
lines changed

2 files changed

+106
-57
lines changed

.github/workflows/main.yml

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,78 @@ name: CI
33
on:
44
push:
55
pull_request:
6+
67
schedule:
78
- cron: '0 6 * * 6'
89

910
jobs:
10-
test:
11+
try:
1112
strategy:
1213
fail-fast: false
1314
matrix:
1415
os: [ubuntu-latest, macos-latest, windows-latest]
16+
config:
17+
- {}
18+
- {shards: false}
19+
- {shards: true}
20+
- {shards: '0.12.0', crystal: '0.35.1'}
21+
- {shards: latest, crystal: latest}
22+
- {shards: nightly, crystal: nightly}
23+
exclude:
24+
- os: windows-latest
25+
config: {shards: '0.12.0', crystal: '0.35.1'}
26+
- os: windows-latest
27+
config: {shards: latest, crystal: latest}
28+
29+
name: crystal ${{ matrix.config.crystal }} + shards ${{ matrix.config.shards }} (${{ matrix.os }})
1530
runs-on: ${{ matrix.os }}
31+
defaults:
32+
run:
33+
shell: bash
1634
steps:
1735
- uses: actions/checkout@v2
1836
- run: npm install
19-
20-
- uses: ./
21-
with:
22-
shards: false
23-
- run: crystal eval "puts 1337"
24-
- run: '! shards --version'
25-
2637
- uses: ./
27-
with:
28-
shards: true
29-
- run: crystal eval "puts 1337"
30-
- run: shards --version
38+
with: ${{ matrix.config }}
39+
id: install
3140

32-
- uses: ./
33-
with:
34-
shards: latest
35-
if: runner.os != 'Windows'
36-
- run: crystal eval "puts 1337"
37-
if: runner.os != 'Windows'
38-
- run: shards --version
39-
if: runner.os != 'Windows'
41+
- run: |
42+
crystal eval 'puts "test" + "ing"' | grep 'testing'
43+
- run: |
44+
crystal --version
45+
- run: |
46+
v='${{ steps.install.outputs.crystal }}'
47+
crystal --version | grep "${v:0:9}"
48+
if: ${{ runner.os != 'Windows' }}
49+
- run: |
50+
v='${{ matrix.config.crystal }}'
51+
crystal --version | grep "$v"
52+
if: ${{ contains(matrix.config.crystal, '.') }}
4053
41-
- uses: ./
42-
with:
43-
shards: nightly
44-
- run: crystal eval "puts 1337"
45-
- run: shards --version
46-
47-
- uses: ./
48-
with:
49-
crystal: nightly
54+
- run: |
55+
shards --version
56+
if: ${{ !contains('false', matrix.config.shards) }}
57+
- run: |
58+
v='${{ steps.install.outputs.shards }}'
59+
v="${v#v}"
60+
shards --version | grep "${v:0:9}"
61+
if: ${{ !contains('true|false|nightly', matrix.config.shards) }}
62+
- run: |
63+
v='${{ matrix.config.shards }}'
64+
shards --version | grep "$v"
65+
if: ${{ contains(matrix.config.shards, '.') }}
66+
- run: |
67+
! shards --version
68+
if: ${{ matrix.config.shards == 'false' }}
5069
70+
test:
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
os: [ubuntu-latest, macos-latest, windows-latest]
75+
runs-on: ${{ matrix.os }}
76+
steps:
77+
- uses: actions/checkout@v2
78+
- run: npm install
5179
- run: npm test
5280
- run: npm audit --audit-level=moderate

.github/workflows/release.yml

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,61 @@ on:
88
- cron: '0 6 * * 6'
99

1010
jobs:
11-
test:
11+
try:
1212
strategy:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16+
config:
17+
- {}
18+
- {shards: false}
19+
- {shards: true}
20+
- {shards: '0.12.0', crystal: '0.35.1'}
21+
- {shards: latest, crystal: latest}
22+
- {shards: nightly, crystal: nightly}
23+
exclude:
24+
- os: windows-latest
25+
config: {shards: '0.12.0', crystal: '0.35.1'}
26+
- os: windows-latest
27+
config: {shards: latest, crystal: latest}
28+
29+
name: crystal ${{ matrix.config.crystal }} + shards ${{ matrix.config.shards }} (${{ matrix.os }})
1630
runs-on: ${{ matrix.os }}
31+
defaults:
32+
run:
33+
shell: bash
1734
steps:
35+
- uses: actions/checkout@v2
36+
- run: npm install
1837
- uses: oprypin/install-crystal@v1
19-
with:
20-
shards: false
21-
- run: crystal eval "puts 1337"
22-
- run: '! shards --version'
23-
24-
- uses: oprypin/install-crystal@v1
25-
with:
26-
shards: true
27-
- run: crystal eval "puts 1337"
28-
- run: shards --version
38+
with: ${{ matrix.config }}
39+
id: install
2940

30-
- uses: oprypin/install-crystal@v1
31-
with:
32-
shards: latest
33-
if: runner.os != 'Windows'
34-
- run: crystal eval "puts 1337"
35-
if: runner.os != 'Windows'
36-
- run: shards --version
37-
if: runner.os != 'Windows'
41+
- run: |
42+
crystal eval 'puts "test" + "ing"' | grep 'testing'
43+
- run: |
44+
crystal --version
45+
- run: |
46+
v='${{ steps.install.outputs.crystal }}'
47+
crystal --version | grep "${v:0:9}"
48+
if: ${{ runner.os != 'Windows' }}
49+
- run: |
50+
v='${{ matrix.config.crystal }}'
51+
crystal --version | grep "$v"
52+
if: ${{ contains(matrix.config.crystal, '.') }}
3853
39-
- uses: oprypin/install-crystal@v1
40-
with:
41-
shards: nightly
42-
- run: crystal eval "puts 1337"
43-
- run: shards --version
44-
45-
- uses: oprypin/install-crystal@v1
46-
with:
47-
crystal: nightly
54+
- run: |
55+
shards --version
56+
if: ${{ !contains('false', matrix.config.shards) }}
57+
- run: |
58+
v='${{ steps.install.outputs.shards }}'
59+
v="${v#v}"
60+
shards --version | grep "${v:0:9}"
61+
if: ${{ !contains('true|false|nightly', matrix.config.shards) }}
62+
- run: |
63+
v='${{ matrix.config.shards }}'
64+
shards --version | grep "$v"
65+
if: ${{ contains(matrix.config.shards, '.') }}
66+
- run: |
67+
! shards --version
68+
if: ${{ matrix.config.shards == 'false' }}

0 commit comments

Comments
 (0)