Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-24.04-arm
platform:
- aarch64-linux-gnu
- aarch64-linux-musl
- aarch64-mingw-ucrt
- arm-linux-gnu
- arm-linux-musl
- arm64-darwin
- jruby
- x64-mingw-ucrt
- x64-mingw32
- x86-linux-gnu
- x86-linux-musl
- x86-mingw32
- x86_64-darwin
- x86_64-linux-gnu
- x86_64-linux-musl
include:
- platform: aarch64-linux-gnu
alias: aarch64-linux
Expand All @@ -66,7 +85,7 @@ jobs:
- platform: x86_64-linux-gnu
alias: x86_64-linux
- platform: x86_64-linux-musl
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand All @@ -78,13 +97,22 @@ jobs:
uses: actions/cache@v4
with:
path: tmp/build-cache
key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ matrix.platform }}-buildx
- name: Build docker image
key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx
enableCrossOsArchive: true
- name: Change docker to a cache-able driver
run: |
docker buildx create --driver docker-container --use
bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load"
docker images
- name: Build docker image
if: runner.arch == 'X64'
run: |
bundle exec rake build:x86:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new"
- name: Build docker image
if: runner.arch == 'ARM64'
run: |
bundle exec rake build:arm:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new"
- name: Show docker images
run: docker images
- name: Update and prune docker buildx layer cache
run: |
rm -rf tmp/build-cache
Expand All @@ -101,6 +129,7 @@ jobs:
bundle exec rake gem:${{ matrix.platform }}

- name: Upload native gem
if: runner.arch == 'X64'
uses: actions/upload-artifact@v4
with:
name: gem-${{ matrix.platform }}
Expand All @@ -116,7 +145,7 @@ jobs:
bundle exec rake clean clobber
bundle exec rake gem:${{ matrix.platform }}

- if: matrix.static
- if: matrix.static && runner.arch == 'X64'
name: Upload static native gem
uses: actions/upload-artifact@v4
with:
Expand All @@ -131,7 +160,7 @@ jobs:
bundle exec rake clean clobber
bundle exec rake gem:${{ matrix.alias }}

- if: matrix.alias
- if: matrix.alias && runner.arch == 'X64'
name: Upload native gem ${{ matrix.alias }}
uses: actions/upload-artifact@v4
with:
Expand Down
53 changes: 24 additions & 29 deletions .github/workflows/publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,52 +31,47 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use cache from primary pipeline
uses: actions/cache@v4
- name: Use X64 cache from primary pipeline
uses: actions/cache/restore@v4
with:
path: tmp/build-cache
key: ${{runner.os}}-${{matrix.platform}}-buildx-${{github.sha}}
restore-keys: |
${{runner.os}}-${{matrix.platform}}-buildx
path: tmp/build-cache-X64
key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }}-buildx
enableCrossOsArchive: true
- name: Use ARM64 cache from primary pipeline
uses: actions/cache/restore@v4
with:
path: tmp/build-cache-ARM64
key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-buildx
enableCrossOsArchive: true
fail-on-cache-miss: true
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Generate docker image names
id: rcd_config
run: |
bundle exec ruby -e ' \
require "rake_compiler_dock"; \
print "image_name="; \
print "image_name_opt=-t "; \
puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}})); \
print "snapshot_name="; \
print "snapshot_name_opt=-t "; \
puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}}), :version => %q(snapshot)); \
if %q(${{matrix.platform}}).end_with?("-gnu"); \
print "generic_linux_snapshot_name="; \
print "generic_linux_snapshot_name_opt=-t "; \
puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}}), :version => %q(snapshot)).chomp("-gnu"); \
end \
' | tee -a $GITHUB_OUTPUT
- name: Build docker image
env:
RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load
RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache-X64 --cache-from=type=local,src=tmp/build-cache-ARM64 --cache-to=type=local,dest=tmp/build-cache-new ${{steps.rcd_config.outputs.snapshot_name_opt}} ${{steps.rcd_config.outputs.generic_linux_snapshot_name_opt}}
run: |
docker buildx create --driver docker-container --use
bundle exec rake build:${{matrix.platform}}
# move build cache and remove outdated layers
rm -rf tmp/build-cache
mv tmp/build-cache-new tmp/build-cache
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Push the docker image
run: |
docker images
docker tag ${{steps.rcd_config.outputs.image_name}} ${{steps.rcd_config.outputs.snapshot_name}}
docker push ${{steps.rcd_config.outputs.snapshot_name}}
- name: Push a generic linux image
if: ${{ steps.rcd_config.outputs.generic_linux_snapshot_name }}
run: |
docker tag ${{steps.rcd_config.outputs.image_name}} ${{steps.rcd_config.outputs.generic_linux_snapshot_name}}
docker push ${{steps.rcd_config.outputs.generic_linux_snapshot_name}}
bundle exec rake release:${{matrix.platform}}
4 changes: 2 additions & 2 deletions .github/workflows/release-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ jobs:
' | tee -a $GITHUB_OUTPUT
- name: Build docker image
env:
RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load
RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new
run: |
docker buildx create --driver docker-container --use
bundle exec rake build:${{matrix.platform}}
bundle exec rake build:x86:${{matrix.platform}}
# move build cache and remove outdated layers
rm -rf tmp/build-cache
mv tmp/build-cache-new tmp/build-cache
Expand Down
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,46 @@ docker buildx create --use --driver=docker-container
bundle exec rake build
```


### Create builder instance for two architectures

Building with qemu emulation fails currently with a segfault, so that it must be built by a builder instance with at least one remote node for the other architecture.
Building on native hardware is also much faster (~45 minutes) than on qemu.
A two-nodes builder requires obviously a ARM and a Intel/AMD device.
It can be created like this:

```sh
# Make sure the remote instance can be connected
$ docker -H ssh://isa info

# Create a new builder with the local instance
# Disable the garbage collector by the config file
$ docker buildx create --name isayoga --config build/buildkitd.toml

# Add the remote instance
$ docker buildx create --name isayoga --config build/buildkitd.toml --append ssh://isa

# They are inactive from the start
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
isayoga docker-container
\_ isayoga0 \_ unix:///var/run/docker.sock inactive
\_ isayoga1 \_ ssh://isa inactive
default* docker
\_ default \_ default running v0.13.2 linux/arm64

# Bootstrap the instances
$ docker buildx inspect --bootstrap --builder isayoga

# Set the new builder as default
$ docker buildx use isayoga

# Now it should be default and in state "running"
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
isayoga* docker-container
\_ isayoga0 \_ unix:///var/run/docker.sock running v0.18.2 linux/arm64
\_ isayoga1 \_ ssh://isa running v0.18.2 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
default docker
\_ default \_ default running v0.13.2 linux/arm64
```
Loading
Loading