2022-04-17 21:15:23 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
2024-01-11 04:01:31 +01:00
|
|
|
push: { branches: [main] }
|
2022-04-17 21:15:23 +02:00
|
|
|
pull_request:
|
|
|
|
schedule: [cron: "40 1 * * *"]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
install:
|
2024-01-13 17:03:46 +01:00
|
|
|
name: Rust ${{matrix.rust || '(default)'}} (toolchain-file=${{matrix.write-toolchain-file}}) (${{matrix.os}})
|
2023-02-13 23:21:02 +01:00
|
|
|
runs-on: ${{matrix.os}}
|
2022-04-17 21:15:23 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2024-01-13 18:44:20 +01:00
|
|
|
max-parallel: 5
|
2022-04-17 21:15:23 +02:00
|
|
|
matrix:
|
2024-01-13 16:54:38 +01:00
|
|
|
os:
|
|
|
|
- ubuntu-latest
|
|
|
|
- windows-latest
|
|
|
|
- macos-latest
|
|
|
|
write-toolchain-file:
|
|
|
|
- false
|
|
|
|
- true
|
2024-01-11 04:01:31 +01:00
|
|
|
rust:
|
2024-01-13 16:54:38 +01:00
|
|
|
# use stable toolchain as default
|
2024-01-11 04:01:31 +01:00
|
|
|
- null
|
|
|
|
|
2023-02-13 21:00:11 +01:00
|
|
|
# Test that the sparse registry check works.
|
|
|
|
# 1.66 and 1.67 don't support stable sparse registry.
|
2024-01-11 04:01:31 +01:00
|
|
|
- "1.66"
|
|
|
|
|
|
|
|
- "nightly"
|
|
|
|
- "beta"
|
|
|
|
- "stable"
|
2022-04-17 21:15:23 +02:00
|
|
|
steps:
|
2023-10-01 09:14:31 +02:00
|
|
|
- uses: actions/checkout@v4
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2022-07-21 23:26:47 +02:00
|
|
|
# Test toolchain file support
|
|
|
|
- name: Write rust-toolchain.toml
|
2024-01-13 16:54:38 +01:00
|
|
|
if: matrix.write-toolchain-file
|
2024-01-11 04:01:31 +01:00
|
|
|
shell: bash
|
2022-07-21 23:26:47 +02:00
|
|
|
run: |
|
|
|
|
cat <<EOF >>rust-toolchain.toml
|
|
|
|
[toolchain]
|
2024-01-13 16:54:38 +01:00
|
|
|
channel = "nightly-2024-01-10"
|
2022-07-21 23:26:47 +02:00
|
|
|
components = [ "rustfmt", "rustc-dev" ]
|
2023-02-15 19:06:41 +01:00
|
|
|
targets = [ "wasm32-unknown-unknown", "thumbv7m-none-eabi" ]
|
2022-07-21 23:26:47 +02:00
|
|
|
profile = "minimal"
|
|
|
|
EOF
|
|
|
|
|
2024-01-11 04:01:31 +01:00
|
|
|
- id: toolchain
|
2023-11-01 10:44:05 +01:00
|
|
|
name: Run actions-rust-lang/setup-rust-toolchain ${{matrix.rust || 'on toolchain file'}}
|
2024-01-11 04:01:31 +01:00
|
|
|
uses: ./
|
2022-04-17 21:15:23 +02:00
|
|
|
with:
|
|
|
|
toolchain: ${{matrix.rust}}
|
2023-05-20 16:29:33 +02:00
|
|
|
components: clippy
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2022-04-17 21:15:23 +02:00
|
|
|
- name: Check ${{'${{steps.toolchain.outputs.rustc-version}}'}}
|
|
|
|
run: echo '${{steps.toolchain.outputs.rustc-version}}'
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2022-04-17 21:15:23 +02:00
|
|
|
- name: Check ${{'${{steps.toolchain.outputs.cargo-version}}'}}
|
|
|
|
run: echo '${{steps.toolchain.outputs.cargo-version}}'
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2022-04-17 21:15:23 +02:00
|
|
|
- name: Check ${{'${{steps.toolchain.outputs.rustup-version}}'}}
|
|
|
|
run: echo '${{steps.toolchain.outputs.rustup-version}}'
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2024-01-13 16:54:38 +01:00
|
|
|
- name: Check lack of toolchain input or file results in stable
|
2024-01-13 16:57:48 +01:00
|
|
|
if: matrix.write-toolchain-file == false && matrix.rust == null
|
2024-01-13 16:54:38 +01:00
|
|
|
shell: bash
|
|
|
|
run: |-
|
|
|
|
rustcv="$(rustc --version)"
|
|
|
|
[[ "$rustcv" != *"nightly"* && "$rustcv" != *"beta"* ]]
|
|
|
|
|
|
|
|
- name: Check toolchain file is being overridden
|
|
|
|
if: matrix.write-toolchain-file
|
|
|
|
shell: bash
|
|
|
|
run: |-
|
|
|
|
rustcv="$(rustc --version)"
|
|
|
|
[[ ! ( "$rustcv" == *"nightly"* && "$rustcv" == *"2024-01-10"* ) ]]
|
|
|
|
|
2024-01-11 04:01:31 +01:00
|
|
|
- shell: bash
|
|
|
|
run: rustc --version && cargo --version
|
2023-02-13 21:00:11 +01:00
|
|
|
|
|
|
|
# Test with creating a small project
|
2023-02-13 21:02:26 +01:00
|
|
|
- run: cargo init . --bin --name ci
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2023-02-13 21:00:11 +01:00
|
|
|
# Add tiny empty crate.
|
|
|
|
# This checks that registry access works.
|
|
|
|
- run: cargo add serde_as
|
2024-01-11 04:01:31 +01:00
|
|
|
|
2023-05-20 16:29:33 +02:00
|
|
|
- run: cargo clippy
|
2024-01-13 18:25:41 +01:00
|
|
|
|
|
|
|
cache:
|
|
|
|
name: Cache
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
2024-01-13 18:44:20 +01:00
|
|
|
- name: Install Rust
|
2024-01-13 18:25:41 +01:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
components: clippy
|
|
|
|
cache: true
|
|
|
|
cache-workspaces: |-
|
|
|
|
./test-workspace
|
|
|
|
|
2024-01-13 18:36:31 +01:00
|
|
|
- run: cargo clippy --manifest-path=./test-workspace/Cargo.toml
|