-
Notifications
You must be signed in to change notification settings - Fork 37
Use cargo-make to build the packages #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JohnAZoidberg
merged 10 commits into
FrameworkComputer:main
from
jscatena88:integrate-cargo-make
Sep 4, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c2225c9
First pass of cargo-make integration
jscatena88 0ff92e6
cargo-make: Add profile for Windows
JohnAZoidberg 9979744
cargo-make: Update README and CI
JohnAZoidberg 69c843d
cargo-make: Build UF2 file
JohnAZoidberg 4789931
cargo-make: Automatically detect target platform
JohnAZoidberg c3e134f
cargo-make: Allow running tool
JohnAZoidberg cfde97e
cargo-make: Add .bin file conversion
JohnAZoidberg ccb5928
gh-actions: Test traditional cargo workflow
JohnAZoidberg cf19160
gh-actions: Build on external PRs
JohnAZoidberg bbb3e85
gh-actions: Fix typos
JohnAZoidberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Test builds without cargo-make | ||
# Not the recommended path, but should make sure it still works | ||
name: Traditional Cargo Workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev-* | ||
paths-ignore: | ||
- '*.py' | ||
pull_request: | ||
branches: | ||
- '*' | ||
paths-ignore: | ||
- '*.py' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
|
||
jobs: | ||
firmware: | ||
name: Building | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust toolchain | ||
run: rustup show | ||
|
||
- run: cargo install flip-link | ||
|
||
- run: cargo build -p ledmatrix | ||
- run: cargo build -p b1display | ||
- run: cargo build -p c1minimal | ||
|
||
linux-software: | ||
name: Build Linux | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libudev-dev libasound2-dev | ||
|
||
- name: Setup Rust toolchain | ||
run: rustup show | ||
|
||
- name: Build tool | ||
run: cargo build --release --target x86_64-unknown-linux-gnu -p inputmodule-control | ||
|
||
- name: Check if tool can start | ||
run: cargo run --release --target x86_64-unknown-linux-gnu -p inputmodule-control -- --help | grep 'RAW HID and VIA commandline' | ||
|
||
windows-software: | ||
name: Build Windows | ||
runs-on: windows-2022 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Rust toolchain | ||
run: rustup show | ||
|
||
- run: cargo install cargo-make | ||
|
||
- name: Build tool | ||
run: cargo build --release --target x86_64-pc-windows-msvc -p inputmodule-control | ||
|
||
- name: Check if tool can start | ||
run: cargo run --release --target x86_64-pc-windows-msvc -p inputmodule-control -- --help | grep 'RAW HID and VIA commandline' | ||
|
||
lint-format: | ||
name: Lint and format check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libudev-dev libasound2-dev | ||
|
||
- name: Setup Rust toolchain | ||
run: rustup show | ||
|
||
- name: Firmware clippy | ||
run: | | ||
cargo clippy -p b1display -- --deny=warnings | ||
cargo clippy -p c1minimal -- --deny=warnings | ||
cargo clippy -p ledmatrix -- --deny=warnings | ||
|
||
- name: Software clippy | ||
run: cargo clippy --target x86_64-unknown-linux-gnu -p inputmodule-control -- -D warnings | ||
|
||
- name: All cargo fmt | ||
run: cargo fmt --all -- --check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[env] | ||
TARGET_TRIPLE = "thumbv6m-none-eabi" | ||
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true | ||
FEATURES = "" | ||
|
||
[tasks.build] | ||
args = [ | ||
"build", | ||
"@@remove-empty(BUILD_TYPE)", | ||
"--target", | ||
"${TARGET_TRIPLE}", | ||
"--features", | ||
"${FEATURES}", | ||
] | ||
|
||
[tasks.build-release] | ||
clear = true | ||
env.BUILD_TYPE = "--release" | ||
run_task = "build" | ||
|
||
[tasks.test] | ||
disabled = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extend = "../Makefile.toml" | ||
|
||
[tasks.uf2] | ||
command = "elf2uf2-rs" | ||
args = ["../target/thumbv6m-none-eabi/release/b1display", "../target/thumbv6m-none-eabi/release/b1display.uf2"] | ||
dependencies = ["build-release"] | ||
install_crate = "elf2uf2-rs" | ||
|
||
[tasks.bin] | ||
command = "llvm-objcopy" | ||
args = ["-Obinary", "../target/thumbv6m-none-eabi/release/b1display", "../target/thumbv6m-none-eabi/release/b1display.bin"] | ||
dependencies = ["build-release"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extend = "../Makefile.toml" | ||
|
||
[tasks.uf2] | ||
command = "elf2uf2-rs" | ||
args = ["../target/thumbv6m-none-eabi/release/c1minimal", "../target/thumbv6m-none-eabi/release/c1minimal.uf2"] | ||
dependencies = ["build-release"] | ||
install_crate = "elf2uf2-rs" | ||
|
||
[tasks.bin] | ||
command = "llvm-objcopy" | ||
args = ["-Obinary", "../target/thumbv6m-none-eabi/release/c1minimal", "../target/thumbv6m-none-eabi/release/c1minimal.bin"] | ||
dependencies = ["build-release"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
extend = "../Makefile.toml" | ||
|
||
[tasks.build-all] | ||
run_task = { name = [ | ||
"build-ledmatrix", | ||
"build-b1display", | ||
"build-c1minimal", | ||
], parallel = true } | ||
|
||
|
||
[tasks.build-ledmatrix] | ||
env.FEATURES = "ledmatrix" | ||
run_task = "build" | ||
|
||
[tasks.build-b1display] | ||
env.FEATURES = "b1display" | ||
run_task = "build" | ||
|
||
[tasks.build-c1minimal] | ||
env.FEATURES = "c1minimal" | ||
run_task = "build" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
extend = "../Makefile.toml" | ||
|
||
# Since it's a tool, build it for the platform we're running on | ||
[env] | ||
TARGET_TRIPLE = "${CARGO_MAKE_RUST_TARGET_TRIPLE}" | ||
|
||
[tasks.run] | ||
command = "cargo" | ||
args = [ | ||
"run", | ||
"--target", | ||
"${CARGO_MAKE_RUST_TARGET_TRIPLE}", | ||
"${@}", | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
extend = "../Makefile.toml" | ||
|
||
[tasks.uf2] | ||
command = "elf2uf2-rs" | ||
args = ["../target/thumbv6m-none-eabi/release/ledmatrix", "../target/thumbv6m-none-eabi/release/ledmatrix.uf2"] | ||
dependencies = ["build-release"] | ||
install_crate = "elf2uf2-rs" | ||
|
||
[tasks.bin] | ||
command = "llvm-objcopy" | ||
args = ["-Obinary", "../target/thumbv6m-none-eabi/release/ledmatrix", "../target/thumbv6m-none-eabi/release/ledmatrix.bin"] | ||
dependencies = ["build-release"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running
cargo make
and thencargo make build-release
in the top level directory will also work, it will essentially run all the tasks you have listed out here, as well as a bunch more that are part of the default dev-test-flow task, but that can be customized; to, for instance, not run any tests. I would also definitely recommend looking through the all the rest of the pre-defined tasks in the link above, it provides a bunch of sane defaults that can be tweaked as necessary to support your use case, including things like building binaries for release, or CI workflows.In general, the default behavior when run you run
cargo make
in a workspace root is to go down into each workspace member and run the task that was called.