-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (80 loc) · 2.17 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: CI
on:
workflow_dispatch:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Install dependencies
run: bundle install
- name: Run rubocop
run: bundle exec rubocop
build:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, darwin, windows]
arch: [amd64]
include:
- os: windows
suffix: .exe
exclude:
- os: windows
arch: arm64
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: build
run: rake build:${{ matrix.os }}-${{ matrix.arch }}
- name: Upload test binary (${{ matrix.os }}-${{ matrix.arch }}})
uses: actions/upload-artifact@v4
with:
name: rf-${{ github.sha }}-${{ matrix.os }}-${{ matrix.arch }}
path: build/${{ matrix.os }}-${{ matrix.arch }}/bin/rf${{ matrix.suffix }}
test:
needs: build
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
include:
- runs-on: ubuntu-latest
os-arch: linux-amd64
- runs-on: macos-latest
os-arch: darwin-amd64
- runs-on: windows-latest
os-arch: windows-amd64
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: rf-${{ github.sha }}-${{ matrix.os-arch }}
path: build/bin
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Grant execute permission
if: ${{ ! contains(matrix.runs-on, 'windows') }}
run: chmod +x build/bin/rf
- name: Run test
run: bundle exec rake spec