Skip to content

Commit

Permalink
feat(ci): enable aarch64 build
Browse files Browse the repository at this point in the history
  • Loading branch information
uulm-janbaudisch committed Aug 22, 2024
1 parent 9f21d8c commit 648ec7b
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 39 deletions.
44 changes: 31 additions & 13 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:

jobs:
Check:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
uses: DeterminateSystems/nix-installer-action@v13
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Check
run: nix flake check -L

Expand All @@ -21,11 +21,20 @@ jobs:
fail-fast: false
matrix:
target:
- double: aarch64-linux # target we are building for
system: aarch64-linux # system we are building on
emulated: true # whether this build is being emulated
runner: ubuntu-24.04 # GitHub runner the build is running on
interpreter: /lib/ld-linux-aarch64.so.1 # path to libc interpreter
- double: x86_64-linux
runner: ubuntu-latest
system: x86_64-linux
runner: ubuntu-24.04
interpreter: /lib64/ld-linux-x86-64.so.2
- double: x86_64-darwin
system: x86_64-darwin
runner: macos-13
- double: aarch64-darwin
system: aarch64-darwin
runner: macos-latest
variant:
- flake: ddnnife
Expand All @@ -35,31 +44,39 @@ jobs:
exclude:
- target: { double: x86_64-linux }
variant: { flake: ddnnife }
- target: { double: aarch64-linux }
variant: { flake: ddnnife }
include:
- target: { double: x86_64-linux, runner: ubuntu-latest }
- target: { double: aarch64-linux, system: aarch64-linux, emulated: true, runner: ubuntu-24.04 }
variant: { flake: ddnnife-static, artifact: '' }
- target: { double: x86_64-linux, system: x86_64-linux, runner: ubuntu-24.04, docs: true }
variant: { flake: ddnnife-static, artifact: '' }
docs: true
- target: { double: x86_64-windows, runner: ubuntu-latest }
- target: { double: x86_64-windows, system: x86_64-linux, runner: ubuntu-24.04 }
variant: { flake: ddnnife-windows, artifact: '' }
- target: { double: x86_64-windows, runner: ubuntu-latest }
- target: { double: x86_64-windows, system: x86_64-linux, runner: ubuntu-24.04 }
variant: { flake: ddnnife-windows-d4-bundled, artifact: '-d4' }
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: QEMU
if: ${{ matrix.target.emulated }}
run: sudo apt-get install -y qemu-user-static
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
uses: DeterminateSystems/nix-installer-action@v13
with:
extra-conf: extra-platforms = ${{ matrix.target.system }}
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build
run: nix build -L .#${{ matrix.variant.flake }}
run: nix build -L .#packages.${{ matrix.target.system }}.${{ matrix.variant.flake }}
- name: Set interpreter
if: ${{ matrix.target.double == 'x86_64-linux' && matrix.variant.flake == 'ddnnife-d4-bundled' }}
if: ${{ matrix.target.interpreter }}
run: |
cp -rL result output
rm -rf result
chmod +w output/bin/*
nix run nixpkgs#patchelf -- --set-interpreter /lib64/ld-linux-x86-64.so.2 output/bin/*
nix run nixpkgs#patchelf -- --set-interpreter ${{ matrix.target.interpreter }} output/bin/*
chmod -w output/bin/*
mv output result
- name: Upload
Expand All @@ -79,6 +96,7 @@ jobs:
with:
name: pages-rust
path: docs

Pages:
if: github.ref == 'refs/heads/main'
needs: Build
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/Container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,33 @@ env:

jobs:
Build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- double: aarch64-linux # target we are building for
architecture: arm64 # container architecture label
emulated: true # whether this build is being emulated
- double: x86_64-linux
architecture: amd64
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: QEMU
if: ${{ matrix.target.emulated }}
run: sudo apt-get install -y qemu-user-static
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
uses: DeterminateSystems/nix-installer-action@v13
with:
extra-conf: extra-platforms = ${{ matrix.target.double }}
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build
run: nix build -L .#container
run: nix build -L .#packages.${{ matrix.target.double }}.container
- name: Login
run: nix run nixpkgs#skopeo -- login $REGISTRY --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
- name: Push
run: nix run nixpkgs#skopeo -- copy docker-archive:result docker://$REGISTRY/$IMAGE_NAME:$TAG
run: nix run nixpkgs#skopeo -- copy docker-archive:result docker://$REGISTRY/$IMAGE_NAME:$TAG-${{ matrix.target.architecture }}
- name: Push latest tag
if: ${{ github.ref_type == 'tag' }}
run: nix run nixpkgs#skopeo -- copy docker://$REGISTRY/$IMAGE_NAME:$TAG docker://$REGISTRY/$IMAGE_NAME:latest
run: nix run nixpkgs#skopeo -- copy docker://$REGISTRY/$IMAGE_NAME:$TAG-${{ matrix.target.architecture }} docker://$REGISTRY/$IMAGE_NAME:latest-${{ matrix.target.architecture }}
81 changes: 65 additions & 16 deletions .github/workflows/Kotlin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on:
- push

jobs:
Build:
Library:
strategy:
fail-fast: false
matrix:
target:
- double: aarch64-linux
jna: linux-aarch64
runner: ubuntu-24.04
emulated: true
- double: x86_64-linux
jna: linux-x86-64
runner: ubuntu-24.04
docs: true
- double: x86_64-darwin
jna: darwin-x86-64
runner: macos-13
- double: aarch64-darwin
jna: darwin-aarch64
runner: macos-latest
- double: x86_64-darwin
jna: darwin-x86-64
runner: macos-13
variant:
- ''
- '-d4'
Expand All @@ -29,20 +32,67 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: QEMU
if: ${{ matrix.target.emulated }}
run: sudo apt-get install -y qemu-user-static
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
uses: DeterminateSystems/nix-installer-action@v13
with:
extra-conf: extra-platforms = ${{ matrix.target.double }}
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build
run: |
nix build -L .#packages.${{ matrix.target.double }}.libddnnife${{ matrix.variant }}
mkdir -p libraries/${{ matrix.target.jna }}
cp -L result/lib/*ddnnife* libraries/${{ matrix.target.jna }}/
- name: Upload
uses: actions/upload-artifact@v4
with:
name: libddnnife${{ matrix.variant }}-${{ matrix.target.double }}
path: libraries
- name: Build (dependencies)
if: ${{ matrix.variant == '-d4' }}
run: nix build -L .#packages.${{ matrix.target.double }}.dependencies-d4
- name: Upload (dependencies)
if: ${{ matrix.variant == '-d4' }}
uses: actions/upload-artifact@v4
with:
name: libddnnife-d4-${{ matrix.target.double }}-dependencies
path: result

Package:
needs: Library
strategy:
fail-fast: false
matrix:
variant:
- ''
- '-d4'
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v13
- name: Build (bindgen)
run: |
nix build -L .#bindgen
cp -L result/bin/uniffi-bindgen .
- name: Build (library)
run: |
nix build -L .#libddnnife${{ matrix.variant }}
mkdir -p libraries/${{ matrix.target.jna }}
cp -L result/lib/*ddnnife* libraries/${{ matrix.target.jna }}/
- name: Download (libraries)
uses: actions/download-artifact@v4
with:
path: libraries
pattern: libddnnife${{ matrix.variant }}-*
merge-multiple: true
- name: Download (dependencies)
uses: actions/download-artifact@v4
with:
path: dependencies
pattern: libddnnife-d4-x86_64-linux-dependencies
- name: Build
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/dependencies
run: |
cd bindings/kotlin
gradle shadowJar --no-daemon -Plibraries=../../libraries -Pbindgen=../../uniffi-bindgen
Expand All @@ -53,22 +103,21 @@ jobs:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ddnnife-kotlin-${{ matrix.target.double }}${{ matrix.variant }}
name: ddnnife-kotlin${{ matrix.variant }}
path: bindings/kotlin/build/libs
- name: Docs
if: ${{ matrix.target.docs && matrix.variant == '' }}
run: |
cd bindings/kotlin
gradle dokkaHtml --no-daemon -Plibraries=../../libraries -Pbindgen=../../uniffi-bindgen
mkdir docs
mv build/dokka/html docs/kotlin
- name: Upload (docs)
if: ${{ matrix.target.docs && matrix.variant == '' }}
uses: actions/upload-artifact@v4
with:
name: pages-kotlin
path: bindings/kotlin/docs

Pages:
if: github.ref == 'refs/heads/main'
needs: Build
needs: Package
uses: ./.github/workflows/Pages.yaml
4 changes: 2 additions & 2 deletions .github/workflows/Portable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
uses: DeterminateSystems/nix-installer-action@v13
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Bundle
run: nix bundle --bundler github:DavHau/nix-portable -o bundle .#ddnnife-d4
- name: Upload
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Nix
uses: DeterminateSystems/nix-installer-action@v10
uses: DeterminateSystems/nix-installer-action@v13
- name: Cache
uses: DeterminateSystems/magic-nix-cache-action@v4
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build
run: nix build -L .#python
- name: Upload
Expand Down
1 change: 1 addition & 0 deletions doc/aarch64-linux.md
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
);
ddnnife-windows-d4-bundled = bundled-d4 pkgs-windows;

dependencies-d4 = d4.packages.${system}.dependencies;
dependencies-d4-windows = d4.packages.${system}.dependencies-windows;

libddnnife = import ./nix/ddnnife.nix (defaultAttrs // libAttrs);
libddnnife-d4 = import ./nix/ddnnife.nix (d4Attrs // libAttrs);

Expand Down

0 comments on commit 648ec7b

Please sign in to comment.