Skip to content

Commit

Permalink
Support x86 and arm64 in tests
Browse files Browse the repository at this point in the history
This adds x86 and arm64 versions of the "text" extension to make GitHub Actions work again. The `macos-latest` GitHub Actions runner is only available as arm64. It also adds `macos-13` to the test matrix so that x86 is tested on macOS as well.

The extensions were downloaded from https://github.com/nalgeon/sqlean
  • Loading branch information
gschlager committed Jun 2, 2024
1 parent 95cbefd commit c648552
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
ruby: ['3.0', '3.1', '3.2', '3.3']
# macos-latest uses arm64, macos-13 uses x86
os: [ubuntu-latest, macos-latest, macos-13]
ruby: ['3.0', '3.1', '3.2', '3.3', 'head']

name: >-
${{matrix.os}}, ${{matrix.ruby}}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
# macos-latest uses arm64, macos-13 uses x86
os: [ubuntu-latest, macos-latest, macos-13]
ruby: ['3.0', '3.1', '3.2', '3.3', 'head']

name: >-
Expand Down
Binary file renamed test/extensions/text.dylib → test/extensions/arm64/text.dylib
100644 → 100755
Binary file not shown.
Binary file added test/extensions/arm64/text.so
Binary file not shown.
Binary file removed test/extensions/text.so
Binary file not shown.
Binary file added test/extensions/x86/text.dylib
Binary file not shown.
Binary file added test/extensions/x86/text.so
Binary file not shown.
12 changes: 8 additions & 4 deletions test/test_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,14 @@ def test_value_casting

def test_extension_loading
case RUBY_PLATFORM
when /linux/
@db.load_extension(File.join(__dir__, 'extensions/text.so'))
when /darwin/
@db.load_extension(File.join(__dir__, 'extensions/text.dylib'))
when /aarch64-linux/
@db.load_extension(File.join(__dir__, 'extensions/arm64/text.so'))
when /x86_64-linux/
@db.load_extension(File.join(__dir__, 'extensions/x86/text.so'))
when /arm64-darwin/
@db.load_extension(File.join(__dir__, 'extensions/arm64/text.dylib'))
when /x86_64-darwin/
@db.load_extension(File.join(__dir__, 'extensions/x86/text.dylib'))
end

r = @db.query_single_splat("select reverse('abcd')")
Expand Down

0 comments on commit c648552

Please sign in to comment.