Skip to content

Commit 149fa40

Browse files
committed
Support macOS portability and testing
- Export DYLD_LIBRARY_PATH on macOS to find bundled shared libraries. - Add macOS portability test in GitHub Actions using artifacts and 1-day retention.
1 parent 2d5500a commit 149fa40

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.github/workflows/test-on-push.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,34 @@ jobs:
5454
bundle exec rake build
5555
bundle exec rake test
5656
57+
- name: Build helloworld for cross-system test
58+
run: ruby -Ilib exe/ocran test/fixtures/helloworld/helloworld.rb --output helloworld_packed
59+
60+
- name: Upload packed binary
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: helloworld-macos-${{ matrix.ruby }}
64+
path: helloworld_packed
65+
retention-days: 1
66+
67+
test-macos-portability:
68+
needs: run-tests-macos
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
ruby: [ '3.2', '3.3', '3.4', '4.0' ]
73+
runs-on: macos-latest
74+
steps:
75+
- name: Download packed binary
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: helloworld-macos-${{ matrix.ruby }}
79+
80+
- name: Run packed executable
81+
run: |
82+
chmod +x helloworld_packed
83+
./helloworld_packed
84+
5785
run-tests-windows:
5886
strategy:
5987
fail-fast: false

lib/ocran/direction.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ def construct(builder)
145145

146146
# On POSIX systems, set LD_LIBRARY_PATH to find bundled shared libraries
147147
unless Gem.win_platform?
148-
builder.export("LD_LIBRARY_PATH", File.join(EXTRACT_ROOT, BINDIR.to_s))
148+
extract_bin = File.join(EXTRACT_ROOT, BINDIR.to_s)
149+
builder.export("LD_LIBRARY_PATH", extract_bin)
150+
if RUBY_PLATFORM.include?("darwin")
151+
builder.export("DYLD_LIBRARY_PATH", extract_bin)
152+
end
149153
end
150154

151155
# Windows-only: Add detected DLLs

0 commit comments

Comments
 (0)