1
0
mirror of https://github.com/nukesor/pueue synced 2024-06-29 06:04:21 +00:00

ci: Replace actions-rust-cross with raw commands for nexttest

This commit is contained in:
Arne Beer 2024-01-12 14:51:22 +01:00
parent 2bfd42f04b
commit f9285f8df6
No known key found for this signature in database
GPG Key ID: CC9408F679023B65
5 changed files with 80 additions and 18 deletions

View File

@ -92,7 +92,7 @@ jobs:
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
args: --release --locked ${{ matrix.cargo_flags }}
args: --release --locked
target: ${{ matrix.target }}
- name: Compress client

View File

@ -39,31 +39,24 @@ jobs:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
strip: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
cross: true
strip: false
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
cross: true
strip: false
- os: ubuntu-latest
target: arm-unknown-linux-musleabihf
cross: true
strip: false
- os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
strip: true
- os: macos-latest
target: x86_64-apple-darwin
cross: false
strip: true
- os: macos-latest
target: aarch64-apple-darwin
cross: true
strip: true
steps:
- name: Checkout code
@ -80,6 +73,12 @@ jobs:
with:
tool: nextest
- name: Install cargo-cross
uses: taiki-e/install-action@v2
with:
tool: cross
if: ${{ matrix.cross }}
- uses: actions/cache@v3
with:
path: |
@ -92,23 +91,37 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-
# ----- Non-Cross path
- name: cargo build
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.target }}
run: cargo build --target=${{ matrix.target }}
if: ${{ !matrix.cross }}
- name: cargo test
uses: houseabsolute/actions-rust-cross@v0
with:
command: nextest
args: "run --workspace"
target: ${{ matrix.target }}
run: cargo nextest run --workspace --target=${{ matrix.target }}
env:
NEXTEST_PROFILE: ci # defined in .config/nextest.toml
if: ${{ !matrix.cross }}
# The test result artifacts are used by the test-report.yaml workflow.
# ----- Cross path
#- name: Install qemu
# run: apt-get install --assume-yes binfmt-support qemu-user-static qemu-user
# if: ${{ matrix.cross }}
- name: cargo build
run: cross build --target=${{ matrix.target }}
if: ${{ matrix.cross }}
# We don't do automated testing for cross builds yet.
# - They don't work in the CI. I have yet to figure out why things aren't set up properly.
# - The tests run way to slow and all kinds of race conditions are triggered.
# Until we find a way to run time related tests in an ultra slow environment, this needs to be postponed.
#- name: cargo test
# run: cross test run --workspace --target=${{ matrix.target }}
# env:
# NEXTEST_PROFILE: ci # defined in .config/nextest.toml
# if: ${{ matrix.cross }}
# ----- Test result artifacts are used by the test-report.yaml workflow.
- name: upload test results
uses: actions/upload-artifact@v3
if: ${{ !matrix.cross }}

36
Cross.toml Normal file
View File

@ -0,0 +1,36 @@
[target.x86_64-unknown-linux-musl]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main"
pre-build = [
"""
dpkg --add-architecture amd64 && \
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
[target.aarch64-unknown-linux-musl]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main"
pre-build = [
"""
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
[target.armv7-unknown-linux-musleabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-musleabihf:main"
pre-build = [
"""
apt-get update && \
apt-get install --assume-yes lld clang
"""
]
[target.arm-unknown-linux-musleabihf]
image = "ghcr.io/cross-rs/arm-unknown-linux-musleabihf:main"
pre-build = [
"""
apt-get update && \
apt-get install --assume-yes lld clang
"""
]

13
docs/Cross.md Normal file
View File

@ -0,0 +1,13 @@
# Cross compilation
Compilation and testing for other architectures is rather easy with `cross`.
1. Install `cargo-cross`.
1. Make sure to install `qemu`.
- On Arch-Linux install `qemu-user-static-binfmt`.
- On Ubuntu install `binfmt-support` and `qemu-user-static`.
Run the build/test against the target infrastructure, I.e.:
- `cross build --target=aarch64-unknown-linux-musl`
- `cross test --target=aarch64-unknown-linux-musl`