Skip to content

Commit 310ba93

Browse files
committed
ci: split into two distinct jobs
The previous commit introduced two lists of ruby to use, but that meant that we now had triples to test, exploding the amount of tests without reason. In order to avoid this, split the build into a macOS-specific build and a Ubuntu-specific one which avoids the branching though it does lead to some duplicated code. It does however still achieve the goal of not having to change the Ubuntu build's ruby versions constantly which is still less overhead.
1 parent ca38b04 commit 310ba93

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,57 @@ on:
88
- maint/*
99

1010
jobs:
11-
build:
11+
macOS:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
ruby-mac: [ '2.4.9', '2.5.7', '2.6.5', '2.7.0' ]
16-
ruby-linux: [ '2.4', '2.5', '2.6', '2.7' ]
17-
os: [ ubuntu-18.04, macOS-latest ]
15+
ruby: [ '2.4.9', '2.5.7', '2.6.5', '2.7.0' ]
16+
os: [ macOS-latest ]
17+
runs-on: ${{ matrix.os }}
1818

19+
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
20+
steps:
21+
- uses: actions/checkout@master
22+
- name: update submodule
23+
run: git submodule update --init
24+
- name: Install macOS packages
25+
run: ./vendor/libgit2/azure-pipelines/setup-osx.sh
26+
- name: Set up Ruby on macOS
27+
run: |
28+
brew install rbenv
29+
rbenv install ${{ matrix.ruby }}
30+
rbenv local ${{ matrix.ruby }}
31+
- name: run build
32+
run: |
33+
eval "$(rbenv init -)"
34+
ruby --version
35+
gem install bundler
36+
bundle install --path vendor
37+
./script/travisbuild
38+
39+
ubuntu:
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
ruby: [ '2.4', '2.5', '2.6', '2.7' ]
44+
os: [ ubuntu-18.04 ]
1945
runs-on: ${{ matrix.os }}
2046

21-
name: Ruby ${{ matrix.ruby-mac }} ${{ matrix.ruby-linux }} on ${{ matrix.os }}
47+
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
2248
steps:
2349
- uses: actions/checkout@master
2450
- name: update submodule
2551
run: git submodule update --init
2652
- name: Install Linux packages
27-
if: runner.os == 'Linux'
2853
run: |
2954
sudo apt update
3055
sudo apt install -y cmake libssh2-1-dev openssh-client openssh-server
31-
- name: Install macOS packages
32-
if: runner.os == 'macOS'
33-
run: ./vendor/libgit2/azure-pipelines/setup-osx.sh
3456
- name: Set up Ruby on Linux
35-
if: runner.os == 'Linux'
3657
uses: actions/setup-ruby@v1
3758
with:
38-
ruby-version: ${{ matrix.ruby-linux }}
39-
- name: Set up Ruby on macOS
40-
if: runner.os == 'macOS'
41-
run: |
42-
brew install rbenv
43-
rbenv install ${{ matrix.ruby-mac }}
44-
rbenv local ${{ matrix.ruby-mac }}
59+
ruby-version: ${{ matrix.ruby }}
4560
- name: run build
4661
run: |
47-
if [ -x rbenv ]; then eval "$(rbenv init -)"; fi
4862
ruby --version
4963
gem install bundler
5064
bundle install --path vendor

0 commit comments

Comments
 (0)