Skip to content

Commit 7ad3dbc

Browse files
committed
CI: separate build and test env for gem
Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com>
1 parent 5b447f1 commit 7ad3dbc

1 file changed

Lines changed: 29 additions & 11 deletions

File tree

.github/workflows/main.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
ruby: ['3.4', '3.3', '3.2']
15-
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
15+
os: [ubuntu-latest, macos-latest, windows-latest]
1616
include:
1717
- os: ubuntu-latest
1818
ruby: 2.7.1
@@ -22,37 +22,55 @@ jobs:
2222
name: Test with Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
2323
steps:
2424
- uses: actions/checkout@v4
25-
- name: Set up Ruby
26-
uses: ruby/setup-ruby@v1
25+
- uses: ruby/setup-ruby@v1
2726
with:
2827
ruby-version: ${{ matrix.ruby }}
2928
bundler-cache: true
3029
- name: Test
3130
run: bundle exec rake
3231

33-
gem:
32+
build:
33+
runs-on: ubuntu-latest
34+
name: Build gem
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: ruby/setup-ruby@v1
38+
with:
39+
ruby-version: '3.4'
40+
bundler-cache: true
41+
- name: Build
42+
run: bundler exec rake build
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: gem
46+
path: pkg/*.gem
47+
48+
gem-test:
49+
needs: build
3450
strategy:
3551
fail-fast: false
3652
matrix:
3753
ruby: ['3.4', '3.3', '3.2', '2.7.1']
3854
# macOS is excluded because of the difficulty in assuming a macOS shell behavior.
39-
os: ['ubuntu-latest', 'windows-latest']
55+
os: [ubuntu-latest, windows-latest]
4056
include:
4157
- os: ubuntu-latest
4258
shell: bash
4359
- os: windows-latest
4460
shell: cmd
4561
runs-on: ${{ matrix.os }}
46-
name: Gem with Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
62+
name: Gem test with Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
4763
steps:
4864
- uses: actions/checkout@v4
49-
- name: Set up Ruby
50-
uses: ruby/setup-ruby@v1
65+
- uses: ruby/setup-ruby@v1
5166
with:
5267
ruby-version: ${{ matrix.ruby }}
53-
bundler-cache: true
54-
- name: Install
55-
run: rake install
68+
- uses: actions/download-artifact@v4
69+
with:
70+
name: gem
71+
path: pkg
72+
- name: Install gem
73+
run: gem install pkg/*
5674
- name: Test command (bash)
5775
if: ${{ matrix.shell == 'bash' }}
5876
run: test/script/command-test.bash

0 commit comments

Comments
 (0)