From 2feaabdd6c33ce464c7ee58d4b96b12a2b951d56 Mon Sep 17 00:00:00 2001 From: Jonathan 'theJPster' Pallant Date: Sat, 17 Aug 2024 20:41:14 +0100 Subject: [PATCH] Re-organise Github Actions workflows. Now there's one workflow per package, with a job for each thing (formatting, clippy, building, testing, etc). --- .github/workflows/clippy.yml | 26 ------ .github/workflows/on_target_tests.yml | 70 ++++++++++++++++ .../{build_and_test.yml => rp2040_hal.yml} | 84 ++++++++++--------- .github/workflows/rp2040_hal_examples.yml | 72 ++++++++++++++++ .github/workflows/rp_binary_info.yml | 77 +++++++++++++++++ .github/workflows/rustfmt.yml | 24 ------ 6 files changed, 262 insertions(+), 91 deletions(-) delete mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/on_target_tests.yml rename .github/workflows/{build_and_test.yml => rp2040_hal.yml} (52%) create mode 100644 .github/workflows/rp2040_hal_examples.yml create mode 100644 .github/workflows/rp_binary_info.yml delete mode 100644 .github/workflows/rustfmt.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml deleted file mode 100644 index 846673aaa..000000000 --- a/.github/workflows/clippy.yml +++ /dev/null @@ -1,26 +0,0 @@ -on: [push, pull_request] -name: Clippy check -jobs: - clippy_check: - name: Run Clippy - runs-on: ubuntu-20.04 - env: - RUSTFLAGS: "-D warnings" - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - target: thumbv6m-none-eabi - components: clippy - - name: Build rp2040-hal - run: cd rp2040-hal && cargo clippy --target=thumbv6m-none-eabi - - name: Build rp2040-hal (with all features) - run: cd rp2040-hal && cargo clippy --target=thumbv6m-none-eabi --all-features - - name: Build rp2040-hal-macros - run: cd rp2040-hal-macros && cargo clippy - - name: Build on-target-tests - run: cd on-target-tests && cargo clippy - - name: Build rp2040-hal-examples - run: cd rp2040-hal-examples && cargo clippy - - name: Build rp-binary-info - run: cd rp-binary-info && cargo clippy diff --git a/.github/workflows/on_target_tests.yml b/.github/workflows/on_target_tests.yml new file mode 100644 index 000000000..2c268e0aa --- /dev/null +++ b/.github/workflows/on_target_tests.yml @@ -0,0 +1,70 @@ +on: [push, pull_request] +name: Check on-target-tests +env: + PACKAGE: on-target-tests +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: thumbv6m-none-eabi + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Build + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature + udeps: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-01-30 + target: thumbv6m-none-eabi + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Install cargo-udeps + run: | + curl -sSL https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - --strip-components=2 -C ~/.cargo/bin ./cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu/cargo-udeps + - name: Run cargo-udeps + run: cd ${PACKAGE} && cargo hack udeps --optional-deps --each-feature + msrv: + name: Verify build on MSRV + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.77 + target: thumbv6m-none-eabi + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Build on-target-tests (on MSRV) + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature + fmt: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Check format + run: cd ${PACKAGE} && cargo fmt -- --check + clippy: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: thumbv6m-none-eabi + components: clippy + - name: Run cargo clippy + run: cd ${PACKAGE} && cargo clippy diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/rp2040_hal.yml similarity index 52% rename from .github/workflows/build_and_test.yml rename to .github/workflows/rp2040_hal.yml index ec6ca5a36..52b75c24a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/rp2040_hal.yml @@ -1,8 +1,9 @@ on: [push, pull_request] -name: Build and Test check +name: Check rp2040-hal +env: + PACKAGE: rp2040-hal jobs: - rp2040-hal-builds: - name: Build rp2040-hal's features + build: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -13,17 +14,10 @@ jobs: run: | curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin - name: Build rp2040-hal - run: cd rp2040-hal && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi - name: Build rp2040-hal-macros - run: cd rp2040-hal-macros && cargo hack build --optional-deps --each-feature - - name: Build on-target-tests - run: cd on-target-tests && cargo hack build --optional-deps --each-feature - - name: Build rp2040-hal-examples - run: cd rp2040-hal-examples && cargo hack build --optional-deps --each-feature - - name: Build rp-binary-info - run: cd rp-binary-info && cargo hack build --optional-deps --each-feature - tests: - name: Execute host-runable tests + run: cd ${PACKAGE}-macros && cargo hack build --optional-deps --each-feature + test: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -34,19 +28,14 @@ jobs: run: | curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin - name: Test rp2040-hal - run: cd rp2040-hal && cargo hack test --optional-deps --each-feature --tests --features critical-section-impl + run: cd ${PACKAGE} && cargo hack test --optional-deps --each-feature --tests --features critical-section-impl - name: Test rp2040-hal docs - run: cd rp2040-hal && cargo hack test --optional-deps --each-feature --doc --features critical-section-impl + run: cd ${PACKAGE} && cargo hack test --optional-deps --each-feature --doc --features critical-section-impl - name: Test rp2040-hal-macros - run: cd rp2040-hal-macros && cargo hack test --optional-deps --tests --each-feature + run: cd ${PACKAGE}-macros && cargo hack test --optional-deps --tests --each-feature - name: Test rp2040-hal-macros docs - run: cd rp2040-hal-macros && cargo hack test --optional-deps --doc --each-feature - - name: Test rp-binary-info - run: cd rp-binary-info && cargo hack test --optional-deps --each-feature --tests - - name: Test rp-binary-info docs - run: cd rp-binary-info && cargo hack test --optional-deps --each-feature --doc + run: cd ${PACKAGE}-macros && cargo hack test --optional-deps --doc --each-feature udeps: - name: Check rp2040-hal for unused dependencies runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -60,16 +49,10 @@ jobs: - name: Install cargo-udeps run: | curl -sSL https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - --strip-components=2 -C ~/.cargo/bin ./cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu/cargo-udeps - - name: Check unused deps in rp2040-hal - run: cd rp2040-hal && cargo hack udeps --optional-deps --each-feature --target=thumbv6m-none-eabi - - name: Check unused deps in rp2040-hal-macros - run: cd rp2040-hal-macros && cargo hack udeps --optional-deps --each-feature - - name: Check unused deps in rp2040-hal-examples - run: cd rp2040-hal-examples && cargo hack udeps --optional-deps --each-feature - - name: Check unused deps in on-target-tests - run: cd on-target-tests && cargo hack udeps --optional-deps --each-feature - - name: Check unused deps in rp-binary-info - run: cd rp-binary-info && cargo hack udeps --optional-deps --each-feature + - name: Run cargo-udeps on rp2040-hal + run: cd ${PACKAGE} && cargo hack udeps --optional-deps --each-feature --target=thumbv6m-none-eabi + - name: Run cargo-udeps on rp2040-hal-macros + run: cd ${PACKAGE}-macros && cargo hack udeps --optional-deps --each-feature msrv: name: Verify build on MSRV runs-on: ubuntu-20.04 @@ -83,14 +66,33 @@ jobs: run: | curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin - name: Use older version of regex - run: cd rp2040-hal-examples && cargo update -p regex --precise 1.9.3 + run: cd ${PACKAGE}-examples && cargo update -p regex --precise 1.9.3 - name: Build rp2040-hal (on MSRV) - run: cd rp2040-hal && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature --target=thumbv6m-none-eabi - name: Build rp2040-hal-macros (on MSRV) - run: cd rp2040-hal-macros && cargo hack build --optional-deps --each-feature - - name: Build on-target-tests (on MSRV) - run: cd on-target-tests && cargo hack build --optional-deps --each-feature - - name: Build rp2040-hal-examples (on MSRV) - run: cd rp2040-hal-examples && cargo hack build --optional-deps --each-feature - - name: Build rp-binary-info (on MSRV) - run: cd rp-binary-info && cargo hack build --optional-deps --each-feature + run: cd ${PACKAGE}-macros && cargo hack build --optional-deps --each-feature + fmt: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Check format of rp2040-hal + run: cd ${PACKAGE} && cargo fmt -- --check + - name: Check format of rp2040-hal-macros + run: cd ${PACKAGE}-macros && cargo fmt -- --check + clippy: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: thumbv6m-none-eabi + components: clippy + - name: Run cargo clippy + run: cd ${PACKAGE} && cargo clippy --target=thumbv6m-none-eabi diff --git a/.github/workflows/rp2040_hal_examples.yml b/.github/workflows/rp2040_hal_examples.yml new file mode 100644 index 000000000..bdf8e46f5 --- /dev/null +++ b/.github/workflows/rp2040_hal_examples.yml @@ -0,0 +1,72 @@ +on: [push, pull_request] +name: Check rp2040-hal-examples +env: + PACKAGE: rp2040-hal-examples +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: thumbv6m-none-eabi + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Build + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature + udeps: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-01-30 + target: thumbv6m-none-eabi + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Install cargo-udeps + run: | + curl -sSL https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - --strip-components=2 -C ~/.cargo/bin ./cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu/cargo-udeps + - name: Run cargo-udeps + run: cd ${PACKAGE} && cargo hack udeps --optional-deps --each-feature + msrv: + name: Verify build on MSRV + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.77 + target: thumbv6m-none-eabi + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Use older version of regex + run: cd ${PACKAGE} && cargo update -p regex --precise 1.9.3 + - name: Build on MSRV + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature + fmt: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Check format + run: cd ${PACKAGE} && cargo fmt -- --check + clippy: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + target: thumbv6m-none-eabi + components: clippy + - name: Run cargo clippy + run: cd ${PACKAGE} && cargo clippy diff --git a/.github/workflows/rp_binary_info.yml b/.github/workflows/rp_binary_info.yml new file mode 100644 index 000000000..8b1f4e854 --- /dev/null +++ b/.github/workflows/rp_binary_info.yml @@ -0,0 +1,77 @@ +on: [push, pull_request] +name: Check rp-binary-info +env: + PACKAGE: rp-binary-info +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Build + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature + test: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Test + run: cd ${PACKAGE} && cargo hack test --optional-deps --each-feature --tests + - name: Test docs + run: cd ${PACKAGE} && cargo hack test --optional-deps --each-feature --doc + udeps: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2024-01-30 + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Install cargo-udeps + run: | + curl -sSL https://github.com/est31/cargo-udeps/releases/download/v0.1.45/cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - --strip-components=2 -C ~/.cargo/bin ./cargo-udeps-v0.1.45-x86_64-unknown-linux-gnu/cargo-udeps + - name: Run cargo-udeps + run: cd ${PACKAGE} && cargo hack udeps --optional-deps --each-feature + msrv: + name: Verify build on MSRV + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@master + with: + toolchain: 1.77 + - name: Install cargo-hack + run: | + curl -sSL https://github.com/taiki-e/cargo-hack/releases/download/v0.6.17/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xvzf - -C ~/.cargo/bin + - name: Build on MSRV + run: cd ${PACKAGE} && cargo hack build --optional-deps --each-feature + fmt: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: Check format + run: cd ${PACKAGE} && cargo fmt -- --check + clippy: + runs-on: ubuntu-20.04 + env: + RUSTFLAGS: "-D warnings" + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Run cargo clippy + run: cd ${PACKAGE} && cargo clippy diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml deleted file mode 100644 index 448a57205..000000000 --- a/.github/workflows/rustfmt.yml +++ /dev/null @@ -1,24 +0,0 @@ -on: [push, pull_request] -name: Code formatting check -jobs: - fmt: - name: Rustfmt - runs-on: ubuntu-20.04 - env: - RUSTFLAGS: "-D warnings" - steps: - - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - with: - target: thumbv6m-none-eabi - components: rustfmt - - name: Check format of rp2040-hal - run: cd rp2040-hal && cargo fmt -- --check - - name: Check format of rp2040-hal-macros - run: cd rp2040-hal-macros && cargo fmt -- --check - - name: Check format of on-target-tests - run: cd on-target-tests && cargo fmt -- --check - - name: Check format of rp2040-hal-examples - run: cd rp2040-hal-examples && cargo fmt -- --check - - name: Check format of rp-binary-info - run: cd rp-binary-info && cargo fmt -- --check