forked from ConradIrwin/interception
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Github-Actions to build gems for **all conceivable versions**. Fixes ConradIrwin#22 Signed-off-by: Stavros Ntentos <[email protected]>
- Loading branch information
Showing
2 changed files
with
116 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: Build Gems | ||
|
||
on: | ||
push: | ||
pull_request: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 10 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
ruby-version: | ||
- 'head' | ||
- '3.4' | ||
- '3.3' | ||
- '3.2' | ||
- '3.1' | ||
- '3.0' | ||
- '2.7' | ||
- '2.6' | ||
- '2.5' | ||
- '2.4' | ||
- '2.3' | ||
- '2.2' | ||
- '2.1' | ||
- '2.1.0' | ||
- '2.0.0' | ||
- '1.9' | ||
- '1.9.3' | ||
- '1.9.2' | ||
# - '1.8(.7)' | ||
- 'jruby-head' | ||
- 'jruby-9.4' | ||
- 'jruby-9.3' | ||
- 'jruby-9.2' | ||
- 'jruby-9.1' | ||
# - 'jruby-1[89]mode' | ||
- truffleruby-24 | ||
- truffleruby-23 | ||
- truffleruby-22 | ||
- truffleruby-21 | ||
- truffleruby-20 | ||
- truffleruby-19 | ||
- truffleruby+graalvm-24 | ||
- truffleruby+graalvm-23 | ||
- truffleruby+graalvm-22 | ||
- truffleruby+graalvm-21 | ||
# - rbx ? | ||
# - ree ? | ||
|
||
defaults: | ||
run: | ||
shell: /bin/bash --noprofile --norc -Eeuxo pipefail {0} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true | ||
|
||
- name: Slugify GITHUB_REPOSITORY | ||
run: echo "GITHUB_REPOSITORY_SLUG=${GITHUB_REPOSITORY////_}" >> $GITHUB_ENV | ||
|
||
- name: Build Extensions and Test | ||
run: bundle exec rake | ||
|
||
- name: Build Gem | ||
run: gem build "${{ github.event.repository.name }}.gemspec" | ||
|
||
- name: Create artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: ${{ env.GITHUB_REPOSITORY_SLUG }}_${{ github.event_name }}_${{ github.event.pull_request.number || github.sha }}_${{ matrix.os | ||
}}_ruby-${{ matrix.ruby-version }}_gems | ||
path: ${{ github.event.repository.name }}-*.gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
task :clean do | ||
sh 'rm -f ext/*.o ext/*.so ext/*.dylib' | ||
sh 'rm -f ext/org/pryrepl/*.class' | ||
sh 'rm -f ext/org/pryrepl/*.jar' | ||
end | ||
|
||
desc "Compile *.c files" | ||
task :compile => [:clean] do | ||
# Task for compiling CRuby C extension | ||
desc 'Compile C extension for CRuby' | ||
task :compile_cruby => [:clean] do | ||
cd 'ext/' do | ||
sh 'ruby extconf.rb' | ||
sh 'make' | ||
end | ||
end | ||
|
||
desc "Run example" | ||
# Task for compiling JRuby Java extension | ||
desc 'Compile Java extension for JRuby' | ||
task :compile_jruby => [:clean] do | ||
cd 'ext/org/pryrepl/' do | ||
sh 'javac InterceptionEventHook.java' | ||
sh 'jar cf InterceptionEventHook.jar InterceptionEventHook.class' | ||
end | ||
end | ||
|
||
desc 'Run example' | ||
task :example do | ||
sh "ruby -I./lib/ ./examples/example.rb " | ||
sh 'ruby -I./lib/ ./examples/example.rb' | ||
end | ||
|
||
desc "Run example 2" | ||
desc 'Run example 2' | ||
task :example2 do | ||
sh "ruby -I./lib/ ./examples/example2.rb " | ||
sh 'ruby -I./lib/ ./examples/example2.rb' | ||
end | ||
|
||
desc "Run tests" | ||
desc 'Run tests' | ||
task :test do | ||
sh 'rspec spec -r ./spec/spec_helpers.rb' | ||
end | ||
|
||
task :default => [:compile, :test] | ||
|
||
|
||
# Default task that automatically chooses the correct compilation based on environment | ||
desc 'Compile appropriate extension and run tests' | ||
task :default => [:test] do | ||
if defined?(JRUBY_VERSION) | ||
Rake::Task[:compile_jruby].invoke | ||
else | ||
Rake::Task[:compile_cruby].invoke | ||
end | ||
end |