Skip to content

Commit b59d6bd

Browse files
committed
Add GitHub Actions for Windows CI
1. Add rake compile:msys2 to allow compiling with MSYS2 sqlite3 package 2. Add .github/workflows/windows.yml to run GitHub Actions on Ruby 2.4 thru master on Windows
1 parent a140754 commit b59d6bd

3 files changed

Lines changed: 43 additions & 2 deletions

File tree

.github/workflows/windows.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: windows
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: windows-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
ruby: [ '9.9.x', '2.6.x', '2.5.x', '2.4.x' ]
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Load Ruby, update gcc
15+
uses: MSP-Greg/actions-ruby@master
16+
with:
17+
ruby-version: ${{ matrix.ruby }}
18+
base: update
19+
mingw: sqlite3
20+
- name: Install dependencies
21+
run: |
22+
gem update --system --no-document --conservative
23+
bundle install --jobs 4 --retry 3
24+
- name: compile
25+
run: rake compile:msys2
26+
- name: test
27+
run: rake test

rakelib/native.rake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ RUBY_EXTENSION = Rake::ExtensionTask.new('sqlite3_native', HOE.spec) do |ext|
5151
end
5252

5353
# ensure things are compiled prior testing
54-
task :test => [:compile]
55-
54+
if RUBY_PLATFORM =~ /mingw/ then
55+
task :test => ["compile:msys2"]
56+
else
57+
task :test => [:compile]
58+
end
5659
# vim: syntax=ruby

rakelib/vendor_sqlite3.rake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ if RUBY_PLATFORM =~ /mingw/
3737
# also prepend DevKit into compilation phase
3838
Rake::Task["compile"].prerequisites.unshift "devkit", "ports:sqlite3:#{RUBY_PLATFORM}"
3939
Rake::Task["native"].prerequisites.unshift "devkit", "ports:sqlite3:#{RUBY_PLATFORM}"
40+
41+
namespace "compile" do
42+
desc "Build using MSYS2 sqlite package"
43+
task :msys2 do
44+
RUBY_EXTENSION.config_options.pop
45+
t = Rake::Task["compile"]
46+
t.prerequisites.clear
47+
t.prerequisites << "devkit" << "compile:#{RUBY_PLATFORM}"
48+
t.invoke
49+
end
50+
end
4051
end
4152

4253
# trick to test local compilation of sqlite3

0 commit comments

Comments
 (0)