-
Notifications
You must be signed in to change notification settings - Fork 6
119 lines (113 loc) · 3.35 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
---
"on":
push:
pull_request:
name: CI
env:
VCPKG_ROOT: "${{ github.workspace }}/vcpkg"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Run cargo fmt
run: cargo fmt --check
build_and_test:
name: Other build/test
strategy:
fail-fast: false
matrix:
rust_version: [stable, 1.70.0]
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
components: clippy
- uses: mozilla-actions/[email protected]
with:
version: v0.4.2
- if: runner.os != 'windows'
run: |
sudo apt-get update && \
sudo apt-get -y upgrade
- if: runner.os == 'windows'
uses: johnwason/vcpkg-action@v4
with:
pkgs: openssl
triplet: x64-windows-static-md
token: ${{ github.token }}
- run: cargo build
# Don't run clippy on Windows, we only need to run it on Linux
- name: Clippy
if: runner.os != 'windows'
run: |
cargo clippy --no-deps
- name: Cargo test (Debug)
run: cargo test
- name: Cargo test (Release)
run: cargo test --release
docs:
name: Documentation
strategy:
fail-fast: false
matrix:
rust_version: [stable, nightly]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_version }}
- name: Install dependencies
run: |
sudo apt-get update && \
sudo apt-get -y upgrade && \
sudo apt-get -y install \
libtss2-dev
- uses: mozilla-actions/[email protected]
with:
version: v0.4.2
- name: Build documentation with zero dependencies / features.
# This tests that all the stubs work properly for optional dependencies,
run: |
cargo ${{ matrix.rust_version == 'nightly' && '+nightly' || '' }} doc \
--all --no-deps --document-private-items
env:
RUSTDOCFLAGS: ${{ matrix.rust_version == 'nightly' && '--cfg docsrs' || '' }}
- uses: actions/upload-artifact@v3
with:
name: docs-${{ matrix.rust_version }}
path: |
target/doc/
!target/doc/src/
if-no-files-found: error
retention-days: 14
# Build with all features
- run: |
cargo ${{ matrix.rust_version == 'nightly' && '+nightly' || '' }} doc \
--all --no-deps --document-private-items --all-features
env:
RUSTDOCFLAGS: ${{ matrix.rust_version == 'nightly' && '--cfg docsrs' || '' }}
- uses: actions/upload-artifact@v3
with:
name: docs-${{ matrix.rust_version }}-all_features
path: |
target/doc/
!target/doc/src/
if-no-files-found: error
retention-days: 14