| 1 |
on: |
| 2 |
pull_request: |
| 3 |
push: |
| 4 |
branches: |
| 5 |
- main |
| 6 |
|
| 7 |
name: Continuous Integration |
| 8 |
|
| 9 |
env: |
| 10 |
RUSTFLAGS: -D warnings |
| 11 |
|
| 12 |
jobs: |
| 13 |
ci: |
| 14 |
name: ${{ matrix.target.name }} [${{ matrix.rust_version }}] |
| 15 |
runs-on: ${{ matrix.target.os }} |
| 16 |
strategy: |
| 17 |
fail-fast: false |
| 18 |
matrix: |
| 19 |
rust_version: ["stable", "1.62.1"] |
| 20 |
target: |
| 21 |
- name: Linux |
| 22 |
os: ubuntu-latest |
| 23 |
extra_flags: --all-features |
| 24 |
run_tests: true |
| 25 |
|
| 26 |
- name: Linux (no-std) |
| 27 |
os: ubuntu-latest |
| 28 |
extra_flags: --no-default-features |
| 29 |
run_tests: true |
| 30 |
|
| 31 |
- name: Windows |
| 32 |
os: windows-latest |
| 33 |
extra_flags: --all-features |
| 34 |
run_tests: true |
| 35 |
|
| 36 |
- name: Windows (no-std) |
| 37 |
os: windows-latest |
| 38 |
extra_flags: --no-default-features |
| 39 |
run_tests: true |
| 40 |
|
| 41 |
- name: Bare Metal (no-std) |
| 42 |
os: ubuntu-latest |
| 43 |
extra_flags: --no-default-features |
| 44 |
run_tests: false |
| 45 |
env: |
| 46 |
TARGET: thumbv7em-none-eabihf |
| 47 |
|
| 48 |
|
| 49 |
steps: |
| 50 |
- uses: actions/checkout@v3 |
| 51 |
|
| 52 |
- uses: dtolnay/rust-toolchain@master |
| 53 |
with: |
| 54 |
targets: ${{ matrix.target.env.TARGET || '' }} |
| 55 |
toolchain: ${{ matrix.rust_version }} |
| 56 |
components: clippy, rustfmt |
| 57 |
|
| 58 |
- run: cargo fmt --check --all |
| 59 |
- run: cargo clippy ${{ matrix.target.extra_flags }} |
| 60 |
- run: cargo build ${{ matrix.target.extra_flags }} |
| 61 |
|
| 62 |
- if: matrix.target.run_tests |
| 63 |
run: | |
| 64 |
cargo test ${{ matrix.target.extra_flags }} |
| 65 |
cargo run ${{ matrix.target.extra_flags }} --example 256_colors |
| 66 |
cargo run ${{ matrix.target.extra_flags }} --example hyperlink |
| 67 |
cargo run ${{ matrix.target.extra_flags }} --example title |