Skip to content

Add clang support

Add clang support #442

Workflow file for this run

on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo check --all
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable, nightly]
cross-compiler: [clang-cl, clang]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XWIN_CROSS_COMPILER: ${{ matrix.cross-compiler }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: messense/crfsuite-rs
path: tests/crfsuite-rs
submodules: true
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Install dependencies
if: matrix.os == 'macos-latest'
run: |
brew install gnu-tar llvm
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install --quiet -y clang wine-stable winetricks
winetricks nocrashdialog
- name: Install Clang
if: matrix.os == 'windows-latest'
run: choco install -y llvm
- uses: dtolnay/rust-toolchain@master
id: rustup
with:
toolchain: ${{ matrix.toolchain }}
components: llvm-tools-preview
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
- name: Cache test crates cargo build
uses: actions/cache@v4
with:
path: |
tests/hello-tls/target
tests/hello-windows/target
tests/libhello/target
key: test-crates-${{ runner.os }}-${{ steps.rustup.outputs.cachekey }}-${{ hashFiles('tests/*/Cargo.lock') }}
- run: cargo build --release
- name: xwin build - x86_64
run: |
rustup target add x86_64-pc-windows-msvc
cargo run --release xwin build --target x86_64-pc-windows-msvc --manifest-path tests/libhello/Cargo.toml
cargo run --release xwin build --target x86_64-pc-windows-msvc --manifest-path tests/hello-tls/Cargo.toml
cargo run --release xwin build --target x86_64-pc-windows-msvc --manifest-path tests/hello-rustls/Cargo.toml
# Test using default build target from config
cargo run --release xwin build --manifest-path tests/hello-windows/Cargo.toml
# Test CMake support
cargo run --release xwin build --target x86_64-pc-windows-msvc --manifest-path tests/crfsuite-rs/Cargo.toml
- name: xwin run - x86_64
if: matrix.os == 'ubuntu-latest'
run: |
cargo run --release xwin run --target x86_64-pc-windows-msvc --manifest-path tests/hello-windows/Cargo.toml
# xwin test requires newer wine version
# - name: xwin test - x86_64
# if: matrix.os == 'ubuntu-latest'
# run: |
# cargo run --release xwin test --target x86_64-pc-windows-msvc --manifest-path tests/hello-windows/Cargo.toml
- name: xwin build - aarch64
run: |
rustup target add aarch64-pc-windows-msvc
cargo run --release xwin build --target aarch64-pc-windows-msvc --manifest-path tests/libhello/Cargo.toml
cargo run --release xwin build --target aarch64-pc-windows-msvc --manifest-path tests/hello-windows/Cargo.toml
cargo run --release xwin build --target aarch64-pc-windows-msvc --manifest-path tests/hello-tls/Cargo.toml
# Test CMake support
cargo run --release xwin build --target aarch64-pc-windows-msvc --manifest-path tests/crfsuite-rs/Cargo.toml
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- run: cargo check
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --all-features
spellcheck:
name: spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@master