1name: CI 2 3on: 4 push: 5 pull_request: 6 workflow_dispatch: 7 schedule: [cron: "40 1 * * *"] 8 9permissions: 10 contents: read 11 12env: 13 RUSTFLAGS: -Dwarnings 14 15jobs: 16 pre_ci: 17 uses: dtolnay/.github/.github/workflows/pre_ci.yml@master 18 19 test: 20 name: ${{matrix.name || format('Rust {0}', matrix.rust)}} 21 needs: pre_ci 22 if: needs.pre_ci.outputs.continue 23 runs-on: ${{matrix.os}}-latest 24 strategy: 25 fail-fast: false 26 matrix: 27 rust: [nightly, beta, stable, 1.62.0] 28 os: [ubuntu] 29 include: 30 - name: macOS 31 os: macos 32 rust: nightly 33 - name: Windows (gnu) 34 os: windows 35 rust: nightly-x86_64-pc-windows-gnu 36 - name: Windows (msvc) 37 os: windows 38 rust: nightly-x86_64-pc-windows-msvc 39 timeout-minutes: 45 40 steps: 41 - uses: actions/checkout@v3 42 - uses: dtolnay/rust-toolchain@master 43 with: 44 toolchain: ${{matrix.rust}} 45 - name: Enable deny(non_exhaustive_omitted_patterns) 46 run: echo RUSTFLAGS=${RUSTFLAGS}\ --cfg=exhaustive >> $GITHUB_ENV 47 if: matrix.rust == 'nightly' 48 - name: Enable type layout randomization 49 run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV 50 if: matrix.rust == 'nightly' 51 - run: cargo check --manifest-path tests/crate/Cargo.toml 52 - run: cargo test -p linkme -p linkme-impl 53 # windows-gnu: https://github.com/dtolnay/linkme/issues/25 54 continue-on-error: ${{matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} 55 - run: cargo test -p linkme -p linkme-impl --features used_linker 56 if: startsWith(matrix.rust, 'nightly') 57 continue-on-error: ${{matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} 58 - run: cargo test -p linkme -p linkme-impl --release 59 continue-on-error: ${{matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} 60 - run: cargo test -p linkme -p linkme-impl --release --features used_linker 61 if: startsWith(matrix.rust, 'nightly') 62 continue-on-error: ${{matrix.rust == 'nightly-x86_64-pc-windows-gnu'}} 63 64 cortex: 65 name: Cortex-M 66 needs: pre_ci 67 if: needs.pre_ci.outputs.continue 68 runs-on: ubuntu-latest 69 timeout-minutes: 45 70 steps: 71 - uses: actions/checkout@v3 72 - uses: dtolnay/rust-toolchain@nightly 73 with: 74 target: thumbv7m-none-eabi 75 - name: Install QEMU 76 run: | 77 sudo apt-get update 78 sudo apt-get install -y qemu-system-arm 79 - run: cargo run --release 80 env: 81 RUSTFLAGS: -C link-arg=-Tlink.x -D warnings 82 working-directory: tests/cortex 83 continue-on-error: true 84 - run: cargo run --release --features used_linker 85 env: 86 RUSTFLAGS: -C link-arg=-Tlink.x -D warnings 87 working-directory: tests/cortex 88 89 clippy: 90 name: Clippy 91 runs-on: ubuntu-latest 92 if: github.event_name != 'pull_request' 93 timeout-minutes: 45 94 steps: 95 - uses: actions/checkout@v3 96 - uses: dtolnay/rust-toolchain@clippy 97 - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic 98 99 outdated: 100 name: Outdated 101 runs-on: ubuntu-latest 102 if: github.event_name != 'pull_request' 103 timeout-minutes: 45 104 steps: 105 - uses: actions/checkout@v3 106 - uses: dtolnay/install@cargo-outdated 107 - run: cargo outdated --workspace --exit-code 1 108