Skip to content

Commit 5ee5fdf

Browse files
committed
Use GitHub actions for CI
1 parent d7bae87 commit 5ee5fdf

File tree

5 files changed

+164
-47
lines changed

5 files changed

+164
-47
lines changed

.github/workflows/build.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Build Gems
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
upload-artifacts:
7+
description: "Whether to upload gem artifacts"
8+
type: boolean
9+
default: true
10+
required: false
11+
12+
jobs:
13+
# Test on multiple Ruby versions and platforms
14+
test:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest]
20+
ruby: ["3.0", "3.1", "3.2", "3.3"]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Ruby
26+
uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: ${{ matrix.ruby }}
29+
bundler-cache: true
30+
31+
- name: Set up Rust
32+
uses: dtolnay/rust-toolchain@stable
33+
34+
- name: Build extension
35+
run: bundle exec rake compile
36+
37+
- name: Run tests
38+
run: bundle exec rake spec
39+
40+
# Build native gems for different platforms using rake-compiler-dock
41+
cross-gem:
42+
name: Build native gem for ${{ matrix.platform }}
43+
runs-on: ubuntu-latest
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
platform:
48+
- x86_64-linux
49+
- x86_64-linux-musl
50+
- aarch64-linux
51+
- aarch64-linux-musl
52+
- x86_64-darwin
53+
- arm64-darwin
54+
- x64-mingw-ucrt
55+
- x64-mingw32
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Set up Ruby
60+
uses: ruby/setup-ruby@v1
61+
with:
62+
ruby-version: "3.3"
63+
bundler-cache: true
64+
65+
- name: Install dependencies
66+
run: bundle install
67+
68+
- name: Build native gem for ${{ matrix.platform }}
69+
run: |
70+
bundle exec rake native:${{ matrix.platform }}:gem
71+
env:
72+
RUBY_CC_VERSION: "3.0.0:3.1.0:3.2.0:3.3.0"
73+
74+
- name: Upload gem artifact
75+
if: inputs.upload-artifacts
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: native-gem-${{ matrix.platform }}
79+
path: pkg/*-${{ matrix.platform }}.gem
80+
retention-days: 1
81+
82+
# Build the source gem (no pre-built binary)
83+
source-gem:
84+
name: Build source gem
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Set up Ruby
90+
uses: ruby/setup-ruby@v1
91+
with:
92+
ruby-version: "3.3"
93+
bundler-cache: true
94+
95+
- name: Build source gem
96+
run: gem build rscsv.gemspec
97+
98+
- name: Upload gem artifact
99+
if: inputs.upload-artifacts
100+
uses: actions/upload-artifact@v4
101+
with:
102+
name: source-gem
103+
path: "rscsv-*.gem"
104+
retention-days: 1

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
build:
11+
uses: ./.github/workflows/build.yml
12+
with:
13+
upload-artifacts: true

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
# Build all gems using the reusable workflow
10+
build:
11+
uses: ./.github/workflows/build.yml
12+
with:
13+
upload-artifacts: true
14+
15+
# Publish all gems to RubyGems
16+
publish:
17+
name: Publish gems to RubyGems
18+
needs: build
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
id-token: write
23+
environment: release
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: "3.3"
31+
32+
- name: Download all gem artifacts
33+
uses: actions/download-artifact@v4
34+
with:
35+
path: pkg
36+
pattern: "*-gem*"
37+
merge-multiple: true
38+
39+
- name: List gems to publish
40+
run: ls -la pkg/
41+
42+
- name: Publish gems to RubyGems (with trusted publishing)
43+
run: |
44+
for gem in pkg/*.gem; do
45+
echo "Publishing $gem"
46+
gem push "$gem"
47+
done

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Fast CSV using Rust extensions. Can read arrays of arrays from strings and write
44
strings from arrays of arrays.
55

6-
[![Build Status](https://travis-ci.org/lautis/rscsv.svg?branch=master)](https://travis-ci.org/lautis/rscsv)
7-
86
## Installation
97

108
This gem requires Rust (~> 1.17) and Cargo to be installed. With those

0 commit comments

Comments
 (0)