Replace workflows #67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust build | |
| on: | |
| - push | |
| - pull_request | |
| - workflow_dispatch | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_TERM_UNICODE: true | |
| RUSTUP_TERM_COLOR: always | |
| RUSTC_BOOTSTRAP: 1 | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| lint: | |
| name: Clippy Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up development environment | |
| run: | | |
| sudo apt update | |
| sudo apt install clang lld {libclang-rt,libc,libssl}-dev | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup set profile minimal | |
| rustup set auto-self-update disable | |
| rustup toolchain install stable | |
| rustup component add clippy | |
| 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 | |
| - name: Set up Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "global" | |
| - run: cargo clippy --all-targets --all-features | |
| check-native: | |
| name: Check 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 | |
| - name: Set up development environment (Linux) | |
| run: | | |
| sudo apt update | |
| sudo apt install clang lld {libclang-rt,libc,musl,libssl}-dev | |
| 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' }} | |
| - name: Set up development environment (Darwin) | |
| run: | | |
| brew update | |
| brew install llvm lld openssl | |
| 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' }} | |
| - name: Set up development environment (Windows) | |
| run: | | |
| choco install openssl | |
| if: ${{ runner.os == 'Windows' }} | |
| - name: Set up Rust toolchain | |
| run: | | |
| rustup set profile minimal | |
| rustup set auto-self-update disable | |
| rustup toolchain install stable | |
| - name: Configure Rust targets (Linux x86-64) | |
| 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' }} | |
| - name: Configure Rust targets (Linux Arch64) | |
| 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' }} | |
| - name: Configure Rust targets (Windows x86-64) | |
| 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' }} | |
| - name: Set up Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "global" | |
| - run: cargo check | |
| - run: cargo test | |
| check-riscv: | |
| name: Check RISC-V | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up development environment | |
| 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 gcc-riscv64-linux-gnu qemu-user-binfmt {libc,libssl}-dev:riscv64 | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup set profile minimal | |
| rustup set auto-self-update disable | |
| rustup toolchain install stable | |
| rustup target add riscv64gc-unknown-linux-gnu | |
| mkdir -p .cargo | |
| cat >~/.cargo/config.toml <<EOF | |
| [build] | |
| target = [ "riscv64gc-unknown-linux-gnu" ] | |
| [target.riscv64gc-unknown-linux-gnu] | |
| rustflags = [ "-C", "linker=riscv64-linux-gnu-gcc" ] | |
| EOF | |
| - name: Set up Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "global" | |
| - run: cargo check | |
| - run: cargo test |