From ac4a029fa5b34888cebb7423c8a64da1256c1519 Mon Sep 17 00:00:00 2001 From: 2ndTaleStudio <43264484+2ndTaleStudio@users.noreply.github.com> Date: Sat, 17 Apr 2021 16:56:36 +0200 Subject: [PATCH 1/5] fix macro bug and adjust CI actions --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++-------- interrupt/Cargo.toml | 6 ++-- interrupt/Makefile.toml | 4 +-- macros/Cargo.toml | 2 +- macros/src/lib.rs | 6 ++-- 5 files changed, 63 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10fb0be..863b65c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,8 @@ jobs: profile: minimal toolchain: nightly override: true - components: rustfmt, clippy, rust-src, llvm-tools-preview - target: aarch64-unknown-none + components: rust-src, llvm-tools-preview + target: aarch64-unknown-linux-gnu - name: Install Cargo Make uses: davidB/rust-cargo-make@v1 @@ -56,18 +56,20 @@ jobs: profile: minimal toolchain: nightly override: true - components: rustfmt, clippy, rust-src, llvm-tools-preview - target: aarch64-unknown-none + components: rust-src, llvm-tools-preview + target: aarch64-unknown-linux-gnu - name: Install Cargo Make uses: davidB/rust-cargo-make@v1 with: version: 'latest' - - name: Publish-Dry-Run + - name: Publish-Dry-Run-Macros run: | - cd ./interrupt + cd ./macros cargo make publish_dry + cd ./interrupt + cargo make publish_dry --profile pipeline prepare_release: needs: [build, publish_dry] @@ -135,10 +137,50 @@ jobs: draft: false prerelease: false - publish: + publish-macros: if: ${{ github.ref == 'refs/heads/release' }} needs: deploy - name: Run Cargo Publish + name: Run Cargo Publish for Macros + runs-on: ubuntu-latest + + steps: + # Checkout the current code from github into the CI machine + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Install Rust Nightly and Cargo + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rust-src, llvm-tools-preview + target: aarch64-unknown-linux-gnu + + - name: Install Cargo Make + uses: davidB/rust-cargo-make@v1 + with: + version: 'latest' + + - name: Get current version + run: echo 'CRATE_VERSION='$(sed -En 's/^version.*=.*\"(.*)\".*$/\1/p' < ./macros/Cargo.toml) >> $GITHUB_ENV + + - name: Update version place holder in files + run: | + # before actually publishing replace the final version for doc and repository in the Crago.toml + sed -i -e 's/||VERSION||/'$CRATE_VERSION'/g' ./macros/Cargo.toml + # also update the version in the lib.rs doc root url + sed -i -e 's/||VERSION||/'$CRATE_VERSION'/g' ./macros/src/lib.rs + + - name: Publish-Run + run: | + cd ./macros/ + cargo make publish --env CRATES_TOKEN=${{ secrets.CRATES_TOKEN }} --profile pipeline + + publish-interrups: + if: ${{ github.ref == 'refs/heads/release' }} + needs: [deploy, publish-macros] + name: Run Cargo Publish Interrupts runs-on: ubuntu-latest steps: @@ -152,8 +194,8 @@ jobs: profile: minimal toolchain: nightly override: true - components: rustfmt, clippy, rust-src, llvm-tools-preview - target: aarch64-unknown-none + components: rust-src, llvm-tools-preview + target: aarch64-unknown-linux-gnu - name: Install Cargo Make uses: davidB/rust-cargo-make@v1 @@ -167,7 +209,6 @@ jobs: run: | # before actually publishing replace the final version for doc and repository in the Crago.toml sed -i -e 's/||VERSION||/'$CRATE_VERSION'/g' ./interrupt/Cargo.toml - sed -i -e 's/||VERSION||/'$CRATE_VERSION'/g' ./macros/Cargo.toml # also update the version in the lib.rs doc root url sed -i -e 's/||VERSION||/'$CRATE_VERSION'/g' ./interrupt/src/lib.rs # and the README.md @@ -175,5 +216,5 @@ jobs: - name: Publish-Run run: | - cd ./interrupt/ + cd ../interrupt/ cargo make publish --env CRATES_TOKEN=${{ secrets.CRATES_TOKEN }} diff --git a/interrupt/Cargo.toml b/interrupt/Cargo.toml index 4716323..a0d2784 100644 --- a/interrupt/Cargo.toml +++ b/interrupt/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ruspiro-interrupt" authors = ["Andre Borrmann "] -version = "0.4.1" # remember to update html_root_url +version = "0.4.2" # remember to update html_root_url description = """ Providing a simple and convinient way to implement interrupt handler for Raspberry Pi interrupts. """ @@ -25,11 +25,11 @@ maintenance = { status = "actively-developed" } paste = "~1.0" futures-util = { version = "~0.3", default-features = false, optional = true } ruspiro-mmio-register = "~0.1" -ruspiro-interrupt-macros = "~0.2" +ruspiro-interrupt-macros = { path = "../macros", version = "~0.3" } ruspiro-singleton = "~0.4" ruspiro-channel = "~0.1" - [features] ruspiro_pi3 = [] async = ["futures-util", "ruspiro-interrupt-macros/async", "ruspiro-channel/async" ] + diff --git a/interrupt/Makefile.toml b/interrupt/Makefile.toml index 15f9dcf..4724800 100644 --- a/interrupt/Makefile.toml +++ b/interrupt/Makefile.toml @@ -9,8 +9,8 @@ AR = "aarch64-none-elf-ar" CFLAGS = "-march=armv8-a -Wall -O3 -nostdlib -nostartfiles -ffreestanding -mtune=cortex-a53" RUSTFLAGS = "-C linker=${CC} -C target-cpu=cortex-a53 -C link-arg=-nostartfiles -C link-arg=-T./link64.ld" -# AARCH64 specific Travis CI env. variables. "aarch64-none-elf" is not available there as it seems -[env.travis] +# AARCH64 specific Pipeline env. variables. "aarch64-none-elf" is not available there as it seems +[env.pipeline] CC = "aarch64-linux-gnu-gcc" AR = "aarch64-linux-gnu-ar" CFLAGS = "-march=armv8-a -Wall -O3 -nostdlib -nostartfiles -ffreestanding -mtune=cortex-a53" diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 7c5223d..b0a28e0 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ruspiro-interrupt-macros" authors = ["Andre Borrmann "] -version = "0.2.2" # remember to update html_root_url +version = "0.3.1" # remember to update html_root_url description = """ Macros used to implement interrupt handler. !!This crate is only useful in conjunction with the `ruspiro-interrupt` crate and shall never be used standalone!! diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 28d8bf2..5e547e1 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -4,7 +4,7 @@ * Author: André Borrmann * License: Apache License 2.0 **********************************************************************************************************************/ -#![doc(html_root_url = "https://docs.rs/ruspiro-interrupt-macros/0.2.2")] +#![doc(html_root_url = "https://docs.rs/ruspiro-interrupt-macros/||VERSION||")] //! # Interrupt Macros //! @@ -105,7 +105,9 @@ pub fn IrqHandler(attr: TokenStream, item: TokenStream) -> TokenStream { #[export_name = #irq_name_s] #(#attrs)* #[no_mangle] - pub unsafe extern "C" fn #ident(tx: Option>>) { + pub unsafe extern "C" fn #ident( + tx: Option>> + ) { // force compiler error if the irq_name does not appear in the Interrupt enum that need to be // referred to in the crate using this attribute ruspiro_interrupt::Interrupt::#irq_name; From aea8a5a214b160d8eaa8a6df380467307fc1cca3 Mon Sep 17 00:00:00 2001 From: 2ndTaleStudio <43264484+2ndTaleStudio@users.noreply.github.com> Date: Sat, 17 Apr 2021 17:09:27 +0200 Subject: [PATCH 2/5] fix publish_dry step --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 863b65c..a4dc96d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: run: | cd ./macros cargo make publish_dry - cd ./interrupt + cd ../interrupt cargo make publish_dry --profile pipeline prepare_release: From 42dcea9cc319171208ea71c834cca235e44f4089 Mon Sep 17 00:00:00 2001 From: 2ndTaleStudio <43264484+2ndTaleStudio@users.noreply.github.com> Date: Sun, 18 Apr 2021 09:23:44 +0200 Subject: [PATCH 3/5] no publish dry-run for interrupt crate --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4dc96d..47e86e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,8 +68,11 @@ jobs: run: | cd ./macros cargo make publish_dry - cd ../interrupt - cargo make publish_dry --profile pipeline + # As interrupt depend on macros it's dry run would always fail + # as the dry run expects all dependencies to be available at crates.io + # already ! + # cd ../interrupt + # cargo make publish_dry --profile pipeline prepare_release: needs: [build, publish_dry] From 6a429cb41e482f941cbd8d6f74a85c34bb6b9c49 Mon Sep 17 00:00:00 2001 From: 2ndTaleStudio <43264484+2ndTaleStudio@users.noreply.github.com> Date: Sun, 18 Apr 2021 09:39:36 +0200 Subject: [PATCH 4/5] keep patches also on branch builds --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47e86e6..bf92d8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,10 @@ jobs: with: version: 'latest' - - if: ${{ github.event_name != 'pull_request' }} - name: Remove patches if not a PR build - run: | - sed -i "/{^\[patch\.crates-io\] /{:a;N;/\Z}/!ba};/^ruspiro-.*\(git\|path\).*/d" ./interrupt/Cargo.toml; + # - if: ${{ github.event_name != 'pull_request' }} + # name: Remove patches if not a PR build + # run: | + # sed -i "/{^\[patch\.crates-io\] /{:a;N;/\Z}/!ba};/^ruspiro-.*\(git\|path\).*/d" ./interrupt/Cargo.toml; - name: Compile run: | From 444b8a5e7549ec6f18bd05e618959e2e264b20d8 Mon Sep 17 00:00:00 2001 From: 2ndTaleStudio <43264484+2ndTaleStudio@users.noreply.github.com> Date: Sun, 18 Apr 2021 09:44:01 +0200 Subject: [PATCH 5/5] fix github action --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf92d8c..251475f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,7 +217,13 @@ jobs: # and the README.md sed -i -e 's/||VERSION||/'$CRATE_VERSION'/g' README.md + # as macros are published now - do the dry run for interrupt followed by the real publish + - name: Publish-Dry-Run + run: | + cd ./interrupt/ + cargo make publish_dry --profile pipeline + - name: Publish-Run run: | - cd ../interrupt/ + cd ./interrupt/ cargo make publish --env CRATES_TOKEN=${{ secrets.CRATES_TOKEN }}