-
-
Notifications
You must be signed in to change notification settings - Fork 30
134 lines (123 loc) · 4.54 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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-24.04, 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: startsWith(matrix.os, 'macos')
run: |
brew install gnu-tar llvm
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install --quiet -y clang wine-stable
- name: Install Clang
if: startsWith(matrix.os, 'windows')
run: choco install -y llvm
- uses: dtolnay/rust-toolchain@master
id: rustup
with:
toolchain: ${{ matrix.toolchain }}
components: llvm-tools
- 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: startsWith(matrix.os, 'ubuntu')
run: |
cargo run --release xwin run --target x86_64-pc-windows-msvc --manifest-path tests/hello-windows/Cargo.toml
- name: xwin test - x86_64
if: startsWith(matrix.os, 'ubuntu')
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