|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +jobs: |
| 9 | + tests: |
| 10 | + name: Tests |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + rust_version: ['1.60.0', stable, nightly] |
| 15 | + platform: |
| 16 | + - { target: x86_64-pc-windows-msvc, os: windows-latest, } |
| 17 | + - { target: i686-pc-windows-msvc, os: windows-latest, } |
| 18 | + - { target: x86_64-pc-windows-gnu, os: windows-latest, host: -x86_64-pc-windows-gnu } |
| 19 | + - { target: i686-pc-windows-gnu, os: windows-latest, host: -i686-pc-windows-gnu } |
| 20 | + - { target: i686-unknown-linux-gnu, os: ubuntu-latest, } |
| 21 | + - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, } |
| 22 | + - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: x11 } |
| 23 | + - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: "wayland,wayland-dlopen" } |
| 24 | + - { target: x86_64-unknown-redox, os: ubuntu-latest, } |
| 25 | + - { target: x86_64-apple-darwin, os: macos-latest, } |
| 26 | + # We're using Windows rather than Ubuntu to run the wasm tests because caching cargo-web |
| 27 | + # doesn't currently work on Linux. |
| 28 | + - { target: wasm32-unknown-unknown, os: windows-latest, } |
| 29 | + |
| 30 | + env: |
| 31 | + RUST_BACKTRACE: 1 |
| 32 | + CARGO_INCREMENTAL: 0 |
| 33 | + RUSTFLAGS: "-C debuginfo=0 --deny warnings" |
| 34 | + OPTIONS: ${{ matrix.platform.options }} |
| 35 | + FEATURES: ${{ format(',{0}', matrix.platform.features ) }} |
| 36 | + CMD: ${{ matrix.platform.cmd }} |
| 37 | + RUSTDOCFLAGS: -Dwarnings |
| 38 | + |
| 39 | + runs-on: ${{ matrix.platform.os }} |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + |
| 43 | + # Used to cache cargo-web |
| 44 | + - name: Cache cargo folder |
| 45 | + uses: actions/cache@v1 |
| 46 | + with: |
| 47 | + path: ~/.cargo |
| 48 | + key: ${{ matrix.platform.target }}-cargo-${{ matrix.rust_version }} |
| 49 | + |
| 50 | + - uses: hecrj/setup-rust-action@v1 |
| 51 | + with: |
| 52 | + rust-version: ${{ matrix.rust_version }}${{ matrix.platform.host }} |
| 53 | + targets: ${{ matrix.platform.target }} |
| 54 | + components: clippy |
| 55 | + |
| 56 | + - name: Install GCC Multilib |
| 57 | + if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686') |
| 58 | + run: sudo apt-get update && sudo apt-get install gcc-multilib |
| 59 | + |
| 60 | + - name: Build crate |
| 61 | + shell: bash |
| 62 | + run: cargo $CMD build --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES |
| 63 | + |
| 64 | + - name: Build tests |
| 65 | + shell: bash |
| 66 | + if: > |
| 67 | + !((matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')) && |
| 68 | + !contains(matrix.platform.target, 'redox') && |
| 69 | + matrix.rust_version != '1.60.0' |
| 70 | + run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES |
| 71 | + |
| 72 | + - name: Run tests |
| 73 | + shell: bash |
| 74 | + if: > |
| 75 | + !((matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')) && |
| 76 | + !contains(matrix.platform.target, 'wasm32') && |
| 77 | + !contains(matrix.platform.target, 'redox') |
| 78 | + run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES |
| 79 | + |
| 80 | + - name: Lint with clippy |
| 81 | + shell: bash |
| 82 | + if: > |
| 83 | + (matrix.rust_version == 'stable') && |
| 84 | + !contains(matrix.platform.options, '--no-default-features') && |
| 85 | + !((matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686')) && |
| 86 | + !contains(matrix.platform.target, 'redox') |
| 87 | + run: cargo clippy --all-targets --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES -- -Dwarnings |
0 commit comments