Skip to content

Commit

Permalink
CI: try cross pre-build hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
ahihi committed Aug 2, 2024
1 parent 6ef8cf5 commit 53f8fef
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 31 deletions.
62 changes: 31 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,41 +59,41 @@ jobs:
- name: checkout
uses: actions/checkout@v4

- name: set up Ubuntu multiarch
if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64'
run: |
readonly DISTRO_CODENAME=$(lsb_release -c | sed -E 's/Codename:\s*//')
echo "DISTRO_CODENAME=$DISTRO_CODENAME"
sudo dpkg --add-architecture "${{ matrix.target-apt-arch }}"
sudo sed -i "s/^deb http/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] http/" /etc/apt/sources.list
sudo sed -i "s/^deb mirror/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] mirror/" /etc/apt/sources.list
for suite in '' '-updates' '-backports' '-security'; do
echo "deb [arch=${{ matrix.target-apt-arch }}] http://ports.ubuntu.com/ $DISTRO_CODENAME$suite main universe multiverse" | \
sudo tee -a /etc/apt/sources.list >/dev/null
done
# - name: set up Ubuntu multiarch
# if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64'
# run: |
# readonly DISTRO_CODENAME=$(lsb_release -c | sed -E 's/Codename:\s*//')
# echo "DISTRO_CODENAME=$DISTRO_CODENAME"
# sudo dpkg --add-architecture "${{ matrix.target-apt-arch }}"
# sudo sed -i "s/^deb http/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] http/" /etc/apt/sources.list
# sudo sed -i "s/^deb mirror/deb [arch=$(dpkg-architecture -q DEB_HOST_ARCH)] mirror/" /etc/apt/sources.list
# for suite in '' '-updates' '-backports' '-security'; do
# echo "deb [arch=${{ matrix.target-apt-arch }}] http://ports.ubuntu.com/ $DISTRO_CODENAME$suite main universe multiverse" | \
# sudo tee -a /etc/apt/sources.list >/dev/null
# done

- name: cache QEMU and AArch64 cross compiler
if: startsWith(matrix.target, 'aarch64-unknown-linux')
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: qemu-user gcc-aarch64-linux-gnu libc6:arm64
version: 1.0
# - name: cache QEMU and AArch64 cross compiler
# if: startsWith(matrix.target, 'aarch64-unknown-linux')
# uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: qemu-user gcc-aarch64-linux-gnu libc6:arm64
# version: 1.0

- name: cache musl development files
if: endsWith(matrix.target, '-musl')
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: musl-tools musl-dev:${{ matrix.target-apt-arch }}
version: 1.0
# - name: cache musl development files
# if: endsWith(matrix.target, '-musl')
# uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: musl-tools musl-dev:${{ matrix.target-apt-arch }}
# version: 1.0

- name: cache apt packages
if: startsWith(matrix.os, 'ubuntu')
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libasound2-dev
version: 1.0
# - name: cache apt packages
# if: startsWith(matrix.os, 'ubuntu')
# uses: awalsh128/cache-apt-pkgs-action@latest
# with:
# packages: libasound2-dev
# version: 1.0

- name: Build binary
- name: build
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
Expand Down
23 changes: 23 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[target.x86_64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libasound2-dev:$CROSS_DEB_ARCH"
]

[target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libasound2-dev:$CROSS_DEB_ARCH"
]

[target.x86_64-unknown-linux-musl]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libasound2-dev:$CROSS_DEB_ARCH"
]

[target.aarch64-unknown-linux-musl]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get install --assume-yes libasound2-dev:$CROSS_DEB_ARCH"
]

0 comments on commit 53f8fef

Please sign in to comment.