Skip to content

Commit

Permalink
Merge pull request #16 from RusPiRo/development
Browse files Browse the repository at this point in the history
Prepare Release and crates.io publishing
  • Loading branch information
2ndTaleStudio authored Apr 18, 2021
2 parents 961db36 + 2ad61ab commit 95f33bb
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 23 deletions.
80 changes: 65 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ 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'

- 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: |
Expand All @@ -56,18 +56,23 @@ 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
# 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]
Expand Down Expand Up @@ -135,10 +140,10 @@ 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:
Expand All @@ -152,8 +157,48 @@ 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: 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:
# 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
Expand All @@ -167,12 +212,17 @@ 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
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/
Expand Down
6 changes: 3 additions & 3 deletions interrupt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ruspiro-interrupt"
authors = ["Andre Borrmann <[email protected]>"]
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.
"""
Expand All @@ -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" ]

4 changes: 2 additions & 2 deletions interrupt/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ruspiro-interrupt-macros"
authors = ["Andre Borrmann <[email protected]>"]
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!!
Expand Down
6 changes: 4 additions & 2 deletions macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down Expand Up @@ -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<ruspiro_interrupt::IsrSender<crate::alloc::boxed::Box<dyn Any>>>) {
pub unsafe extern "C" fn #ident(
tx: Option<ruspiro_interrupt::IsrSender<crate::alloc::boxed::Box<dyn core::any::Any>>>
) {
// 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;
Expand Down

0 comments on commit 95f33bb

Please sign in to comment.