Skip to content

Commit

Permalink
Merge pull request #442 from sparklemotion/flavorjones-434-better-mus…
Browse files Browse the repository at this point in the history
…l-support

introduce general musl support
  • Loading branch information
flavorjones authored Apr 16, 2024
2 parents da30d5d + aba0c06 commit 055da73
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 49 deletions.
89 changes: 48 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
ruby-version: "3.3"
bundler-cache: true
apt-get: libsqlite3-dev
- run: bundle exec rake compile test -- --enable-system-libraries
- run: bundle exec rake compile -- --enable-system-libraries
- run: bundle exec rake test

test:
needs: basic
Expand Down Expand Up @@ -215,7 +216,7 @@ jobs:
name: source-gem
path: gems
- run: ./bin/test-gem-install gems -- --${{ matrix.syslib }}-system-libraries ${{ matrix.compile_flags }}
shell: bash
shell: sh

build_native_gem:
needs: native_setup
Expand All @@ -224,14 +225,18 @@ jobs:
fail-fast: false
matrix:
platform:
- "aarch64-linux"
- "arm-linux"
- "arm64-darwin"
- "x64-mingw-ucrt"
- "x64-mingw32"
- "x86-linux"
- "x86_64-darwin"
- "x86_64-linux"
- aarch64-linux-gnu
- aarch64-linux-musl
- arm-linux-gnu
- arm-linux-musl
- arm64-darwin
- x64-mingw-ucrt
- x64-mingw32
- x86-linux-gnu
- x86-linux-musl
- x86_64-darwin
- x86_64-linux-gnu
- x86_64-linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -256,35 +261,28 @@ jobs:
fail-fast: false
matrix:
platform:
- aarch64-linux
# - aarch64-linux-gnu
# - aarch64-linux-musl
- arm-linux
# - arm-linux-gnu
# - arm-linux-musl
- x86-linux
# - x86-linux-gnu
# - x86-linux-musl
- x86_64-linux
# - x86_64-linux-gnu
# - x86_64-linux-musl
- aarch64-linux-gnu
- aarch64-linux-musl
- arm-linux-gnu
- arm-linux-musl
- x86-linux-gnu
- x86-linux-musl
- x86_64-linux-gnu
- x86_64-linux-musl
ruby: ["3.3", "3.2", "3.1", "3.0"]
include:
# # declare docker image for each platform
# - { platform: aarch64-linux-musl, docker_tag: "-alpine" }
# - { platform: arm-linux-musl, docker_tag: "-alpine" }
# - { platform: x86-linux-musl, docker_tag: "-alpine" }
# - { platform: x86_64-linux-musl, docker_tag: "-alpine" }
# declare docker image for each platform
- { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
- { platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
- { platform: x86-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
- { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
# declare docker platform for each platform
- { platform: aarch64-linux, docker_platform: "--platform=linux/arm64" }
# - { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64" }
# - { platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64" }
- { platform: arm-linux, docker_platform: "--platform=linux/arm/v7" }
# - { platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" }
# - { platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" }
- { platform: x86-linux, docker_platform: "--platform=linux/386" }
# - { platform: x86-linux-gnu, docker_platform: "--platform=linux/386" }
# - { platform: x86-linux-musl, docker_platform: "--platform=linux/386" }
- { platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64" }
- { platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64" }
- { platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" }
- { platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" }
- { platform: x86-linux-gnu, docker_platform: "--platform=linux/386" }
- { platform: x86-linux-musl, docker_platform: "--platform=linux/386" }
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -295,8 +293,12 @@ jobs:
- run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -v $PWD:/work -w /work \
${{ matrix.docker_platform}} ruby:${{ matrix.ruby }} \
./bin/test-gem-install ./gems
${{ matrix.docker_platform}} ruby:${{ matrix.ruby }}${{ matrix.docker_tag }} \
sh -c "
${{ matrix.bootstrap }}
gem update --system &&
./bin/test-gem-install ./gems
"
test_the_rest:
name: "${{ matrix.platform }} ${{ matrix.ruby }}"
Expand Down Expand Up @@ -335,7 +337,7 @@ jobs:
name: cruby-${{ matrix.platform }}-gem
path: gems
- run: ./bin/test-gem-install gems
shell: bash
shell: sh

cruby-x86_64-linux-musl-install:
needs: build_native_gem
Expand All @@ -345,16 +347,21 @@ jobs:
include:
- { ruby: "3.0", flavor: "alpine" }
- { ruby: "3.1", flavor: "alpine3.18" }
- { ruby: "3.1", flavor: "alpine3.19" }
- { ruby: "3.2", flavor: "alpine3.18" }
- { ruby: "3.2", flavor: "alpine3.19" }
- { ruby: "3.3", flavor: "alpine3.18" }
- { ruby: "3.3", flavor: "alpine3.19" }
runs-on: ubuntu-latest
container:
image: ruby:${{matrix.ruby}}-${{matrix.flavor}}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: cruby-x86_64-linux-gem
name: cruby-x86_64-linux-musl-gem
path: gems
- run: apk add bash build-base
- run: apk add build-base
- if: matrix.ruby == '3.0' # https://github.com/rake-compiler/rake-compiler/pull/236
run: gem update --system
- run: ./bin/test-gem-install ./gems
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ group :development do
gem "minitest", "5.22.3"

gem "rake-compiler", "1.2.7"
gem "rake-compiler-dock", "1.4.0"
gem "rake-compiler-dock", "1.5.0"

gem "ruby_memcheck", "2.3.0" if Gem::Platform.local.os == "linux"

Expand Down
6 changes: 3 additions & 3 deletions bin/test-gem-install
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env bash
#! /usr/bin/env sh
#
# run as part of CI
#
Expand All @@ -15,14 +15,14 @@ test -e /etc/os-release && cat /etc/os-release

set -e -x -u

pushd $GEMS_DIR
cd $GEMS_DIR

gemfile=$(ls *.gem | head -n1)
ls -l ${gemfile}
gem install --no-document ${gemfile} -- ${INSTALL_FLAGS}
gem list -d sqlite3

popd
cd ..

bundle install --local || bundle install

Expand Down
12 changes: 8 additions & 4 deletions rakelib/native.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ require "yaml"

cross_rubies = ["3.3.0", "3.2.0", "3.1.0", "3.0.0"]
cross_platforms = [
"aarch64-linux",
"arm-linux",
"aarch64-linux-gnu",
"aarch64-linux-musl",
"arm-linux-gnu",
"arm-linux-musl",
"arm64-darwin",
"x64-mingw-ucrt",
"x64-mingw32",
"x86-linux",
"x86-linux-gnu",
"x86-linux-musl",
"x86_64-darwin",
"x86_64-linux"
"x86_64-linux-gnu",
"x86_64-linux-musl"
]
ENV["RUBY_CC_VERSION"] = cross_rubies.join(":")

Expand Down

0 comments on commit 055da73

Please sign in to comment.