2020-01-06 06:13:05 +11:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches: [master]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Check_Formatting:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-02-26 03:10:31 +11:00
|
|
|
- uses: actions/checkout@v2
|
2020-01-06 06:13:05 +11:00
|
|
|
- uses: hecrj/setup-rust-action@v1
|
|
|
|
with:
|
|
|
|
rust-version: stable
|
|
|
|
components: rustfmt
|
|
|
|
- name: Check Formatting
|
|
|
|
run: cargo +stable fmt --all -- --check
|
|
|
|
|
2022-06-10 20:43:33 +10:00
|
|
|
tests:
|
|
|
|
name: Tests
|
2020-01-06 06:13:05 +11:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
rust_version: [stable, nightly]
|
|
|
|
platform:
|
|
|
|
- { target: x86_64-pc-windows-msvc, os: windows-latest, }
|
|
|
|
- { target: i686-pc-windows-msvc, os: windows-latest, }
|
|
|
|
- { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu }
|
|
|
|
- { target: i686-pc-windows-gnu, os: windows-latest, host: -i686-pc-windows-gnu }
|
|
|
|
- { target: i686-unknown-linux-gnu, os: ubuntu-latest, }
|
|
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, }
|
2020-06-16 05:49:09 +10:00
|
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: x11 }
|
2021-11-01 01:06:00 +11:00
|
|
|
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: "wayland,wayland-dlopen" }
|
2020-05-06 23:27:49 +10:00
|
|
|
- { target: aarch64-linux-android, os: ubuntu-latest, cmd: 'apk --' }
|
2020-01-06 06:13:05 +11:00
|
|
|
- { target: x86_64-apple-darwin, os: macos-latest, }
|
|
|
|
- { target: x86_64-apple-ios, os: macos-latest, }
|
|
|
|
- { target: aarch64-apple-ios, os: macos-latest, }
|
|
|
|
# We're using Windows rather than Ubuntu to run the wasm tests because caching cargo-web
|
|
|
|
# doesn't currently work on Linux.
|
2021-10-27 05:05:01 +11:00
|
|
|
- { target: wasm32-unknown-unknown, os: windows-latest, }
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
env:
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
CARGO_INCREMENTAL: 0
|
2022-05-20 10:09:23 +10:00
|
|
|
PKG_CONFIG_ALLOW_CROSS: 1
|
2021-12-11 13:02:48 +11:00
|
|
|
RUSTFLAGS: "-C debuginfo=0 --deny warnings"
|
2020-06-16 05:49:09 +10:00
|
|
|
OPTIONS: ${{ matrix.platform.options }}
|
2020-01-06 06:13:05 +11:00
|
|
|
FEATURES: ${{ format(',{0}', matrix.platform.features ) }}
|
2020-05-06 23:27:49 +10:00
|
|
|
CMD: ${{ matrix.platform.cmd }}
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
steps:
|
2020-02-26 03:10:31 +11:00
|
|
|
- uses: actions/checkout@v2
|
2020-01-06 06:13:05 +11:00
|
|
|
# Used to cache cargo-web
|
|
|
|
- name: Cache cargo folder
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cargo
|
|
|
|
key: ${{ matrix.platform.target }}-cargo-${{ matrix.rust_version }}
|
|
|
|
|
|
|
|
- uses: hecrj/setup-rust-action@v1
|
|
|
|
with:
|
|
|
|
rust-version: ${{ matrix.rust_version }}${{ matrix.platform.host }}
|
|
|
|
targets: ${{ matrix.platform.target }}
|
2022-06-10 20:43:33 +10:00
|
|
|
components: clippy
|
2020-01-06 06:13:05 +11:00
|
|
|
|
2022-05-20 10:09:23 +10:00
|
|
|
- name: Install Linux dependencies
|
|
|
|
if: (matrix.platform.os == 'ubuntu-latest')
|
|
|
|
run: sudo apt-get update && sudo apt-get install pkg-config cmake libfreetype6-dev libfontconfig1-dev
|
2020-01-06 06:13:05 +11:00
|
|
|
- name: Install GCC Multilib
|
|
|
|
if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')
|
2022-05-20 10:09:23 +10:00
|
|
|
run: sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install g++-multilib gcc-multilib libfreetype6-dev:i386 libfontconfig1-dev:i386
|
2020-05-06 23:27:49 +10:00
|
|
|
- name: Install cargo-apk
|
|
|
|
if: contains(matrix.platform.target, 'android')
|
|
|
|
run: cargo install cargo-apk
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
- name: Check documentation
|
|
|
|
shell: bash
|
|
|
|
if: matrix.platform.target != 'wasm32-unknown-unknown'
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD doc --no-deps --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
shell: bash
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
- name: Build tests
|
|
|
|
shell: bash
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
2020-01-06 06:13:05 +11:00
|
|
|
- name: Run tests
|
|
|
|
shell: bash
|
2020-05-06 23:27:49 +10:00
|
|
|
if: (
|
|
|
|
!contains(matrix.platform.target, 'android') &&
|
|
|
|
!contains(matrix.platform.target, 'ios') &&
|
|
|
|
!contains(matrix.platform.target, 'wasm32'))
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES
|
2020-01-06 06:13:05 +11:00
|
|
|
|
2022-06-10 20:43:33 +10:00
|
|
|
- name: Lint with clippy
|
|
|
|
shell: bash
|
|
|
|
if: (matrix.rust_version != 'nightly') && !contains(matrix.platform.options, '--no-default-features')
|
|
|
|
run: cargo clippy --all-targets --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES -- -Dwarnings
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
- name: Build with serde enabled
|
|
|
|
shell: bash
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
|
2020-01-06 06:13:05 +11:00
|
|
|
|
|
|
|
- name: Build tests with serde enabled
|
|
|
|
shell: bash
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
|
2020-01-06 06:13:05 +11:00
|
|
|
- name: Run tests with serde enabled
|
|
|
|
shell: bash
|
2020-05-06 23:27:49 +10:00
|
|
|
if: (
|
|
|
|
!contains(matrix.platform.target, 'android') &&
|
|
|
|
!contains(matrix.platform.target, 'ios') &&
|
|
|
|
!contains(matrix.platform.target, 'wasm32'))
|
2020-06-16 05:49:09 +10:00
|
|
|
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
|