Skip to content

Replace workflows

Replace workflows #55

Workflow file for this run

name: Rust build
on:
- push
- pull_request
- workflow_dispatch
env:
CARGO_TERM_COLOR: always
CARGO_TERM_UNICODE: true
RUST_BACKTRACE: 1
jobs:
lint:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
release="$(lsb_release --short --codename)"
sudo apt update
sudo apt install clang lld {libclang-rt,libc,libssl}-dev
cat >>"${GITHUB_ENV}" <<EOF
CC=clang
LD=ld.lld
EOF
mkdir -p ~/.cargo
cat >~/.cargo/config.toml <<EOF
[build]
rustflags = [
"-C", "linker=clang",
"-C", "link-arg=--rtlib=compiler-rt",
"-C", "link-arg=-fuse-ld=lld"
]
EOF
- run: |
rustup update
rustup default nightly
rustup component add clippy
- uses: Swatinem/rust-cache@v2
with:
shared-key: "global"
- run: cargo clippy --all-targets --all-features
build-native:
name: Build Native
strategy:
matrix:
system:
- ubuntu-latest
- ubuntu-24.04-arm
- macos-latest
- macos-13
- windows-latest
runs-on: ${{ matrix.system }}
steps:
- uses: actions/checkout@v4
- run: |
release="$(lsb_release --short --codename)"
sudo apt update
sudo apt install clang lld {libclang-rt,libc,musl,libssl}-dev
cat >>"${GITHUB_ENV}" <<EOF
CC=clang
LD=ld.lld
EOF
mkdir -p ~/.cargo
cat >~/.cargo/config.toml <<EOF
[build]
rustflags = [
"-C", "linker=clang",
"-C", "link-arg=--rtlib=compiler-rt",
"-C", "link-arg=-fuse-ld=lld"
]
EOF
if: ${{ runner.os == 'Linux' }}
- run: |
brew update
brew install llvm lld openssl
cat >>"${GITHUB_ENV}" <<EOF
CC=$(brew --prefix llvm)/bin/clang
LD=$(brew --prefix lld)/bin/lld
EOF
mkdir -p .cargo
cat >~/.cargo/config.toml <<EOF
[build]
rustflags = [
"-C", "linker=$(brew --prefix llvm)/bin/clang",
"-C", "link-arg=--rtlib=compiler-rt",
"-C", "link-arg=-fuse-ld=lld"
]
EOF
if: ${{ runner.os == 'Darwin' }}
- run: |
choco install openssl
if: ${{ runner.os == 'Windows' }}
- run: |
rustup update
rustup default nightly
- run: |
rustup target add x86_64-unknown-linux-gnu x86_64-unknown-linux-musl
cat >>~/.cargo/config.toml <<EOF
target = [
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl"
]
EOF
if: ${{ runner.os == 'Linux' && runner.arch == 'X64' }}
- run: |
rustup target add aarch64-unknown-linux-gnu aarch64-unknown-linux-musl
cat >>~/.cargo/config.toml <<EOF
target = [
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl"
]
EOF
if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
- run: |
rustup target add x86_64-pc-windows-gnu x86_64-pc-windows-msvc
@"
[build]
target = [
"x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc"
]
"@ >>~/.cargo/config.toml
if: ${{ runner.os == 'Windows' && runner.arch == 'X64' }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: "global"
- run: cargo test
- run: cargo build --release
build-riscv:
name: Build RISC-V
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
release="$(lsb_release --short --codename)"
sudo tee /etc/apt/sources.list.d/ubuntu.sources <<EOF
Types: deb
URIs: http://azure.archive.ubuntu.com/ubuntu/
Suites: ${release} ${release}-updates ${release}-security
Components: main restricted universe
Architectures: amd64
Types: deb
URIs: http://azure.ports.ubuntu.com/ubuntu-ports/
Suites: ${release} ${release}-updates ${release}-security
Components: main restricted universe
Architectures: arm64 riscv64
EOF
sudo dpkg --add-architecture riscv64
sudo apt update
sudo apt install clang lld qemu-user-binfmt libclang-rt-dev {libc,musl,libssl}-dev:riscv64
cat >>"${GITHUB_ENV}" <<EOF
CC=clang
LD=ld.lld
EOF
- run: |
rustup update
rustup default nightly
rustup target add riscv64gc-unknown-linux-gnu riscv64gc-unknown-linux-musl
- run: |
mkdir -p .cargo
cat >~/.cargo/config.toml <<EOF
[build]
target = [
"riscv64gc-unknown-linux-gnu",
"riscv64gc-unknown-linux-musl"
]
[target.x86_64-unknown-linux-gnu]
rustflags = [
"-C", "linker=clang",
"-C", "link-arg=--rtlib=compiler-rt",
"-C", "link-arg=-fuse-ld=lld"
]
[target.riscv64gc-unknown-linux-gnu]
rustflags = [
"-C", "linker=clang",
"-C", "link-arg=--target=riscv64-unknown-linux-gnu",
"-C", "link-arg=--rtlib=compiler-rt",
"-C", "link-arg=-fuse-ld=lld"
]
[target.riscv64gc-unknown-linux-musl]
rustflags = [
"-C", "linker=clang",
"-C", "link-arg=--target=riscv64-unknown-linux-musl",
"-C", "link-arg=--rtlib=compiler-rt",
"-C", "link-arg=-fuse-ld=lld"
]
EOF
- uses: Swatinem/rust-cache@v2
with:
shared-key: "global"
- run: cargo test
- run: cargo build --target --release