-
Notifications
You must be signed in to change notification settings - Fork 7
117 lines (115 loc) · 4.18 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
clippy:
name: "Lint with clippy (${{ matrix.os }}, ${{ matrix.flags }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-latest", "ubuntu-latest"]
flags: ["--all-features", "--no-default-features"]
env:
RUSTFLAGS: -Dwarnings
steps:
- name: Ensure windows git checkout keeps \n line ending
run: |
git config --system core.autocrlf false
git config --system core.eol lf
if: matrix.os == 'windows-latest'
- uses: actions/checkout@v2
- name: Install Rust (clippy)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- run: cargo clippy --all-targets ${{ matrix.flags }}
rustfmt:
name: "Verify code formatting (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: windows-latest }
- { os: ubuntu-latest }
steps:
- name: Ensure windows git checkout keeps \n line ending
run: |
git config --system core.autocrlf false
git config --system core.eol lf
if: matrix.os == 'windows-latest'
- uses: actions/checkout@v2
- name: Install Rust (rustfmt)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check
tests:
name: "Test Rust ${{ matrix.rust }} (${{ matrix.os }}, ${{ matrix.target }} ${{ matrix.flags }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { rust: stable, os: windows-latest, target: x86_64-pc-windows-msvc, flags: "--all-features" }
- { rust: stable, os: windows-latest, target: x86_64-pc-windows-msvc, flags: "--no-default-features" }
- { rust: stable, os: macos-latest, flags: "--all-features" }
- { rust: stable, os: macos-latest, flags: "--no-default-features" }
- { rust: stable, os: ubuntu-latest, flags: "--all-features" }
- { rust: stable, os: ubuntu-latest, flags: "--no-default-features" }
- { rust: stable, os: ubuntu-latest, target: wasm32-unknown-unknown, flags: "--all-features" }
- { rust: stable, os: ubuntu-latest, target: wasm32-unknown-unknown, flags: "--no-default-features" }
- { rust: 1.58.1, os: ubuntu-latest, flags: "--all-features" }
- { rust: 1.58.1, os: ubuntu-latest, flags: "--no-default-features" }
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }} ${{ matrix.target }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- run: cargo test ${{ matrix.flags }} --target ${{ matrix.target }}
if: matrix.target != 0 && matrix.target != 'wasm32-unknown-unknown'
- run: cargo build ${{ matrix.flags }} --target ${{ matrix.target }}
if: matrix.target != 0 && matrix.target == 'wasm32-unknown-unknown'
- run: cargo test ${{ matrix.flags }}
if: matrix.target == 0
examples:
name: "Run examples using Rust ${{ matrix.rust }} (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { rust: stable, os: ubuntu-latest }
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }} ${{ matrix.target }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Unix Example
run: cargo run --example unix
- name: Unix UTF8 Example
run: cargo run --example unix_utf8
- name: Windows Example
run: cargo run --example windows
- name: Windows UTF8 Example
run: cargo run --example windows_utf8
- name: typed Example
run: cargo run --example typed
- name: typed UTF8 Example
run: cargo run --example typed_utf8