Skip to content
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

CI optimizations #3129

Merged
merged 6 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 3 additions & 53 deletions .github/actions/check-esp-hal/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build and Check
description: Build and check the esp-hal and esp-lp-hal pacakges for a specified device
description: Build and check the esp-hal and esp-lp-hal packages for a specified device
inputs:
device:
description: "Device SOC"
Expand All @@ -13,56 +13,6 @@ inputs:
runs:
using: "composite"
steps:
- name: Set up cargo environment
- name: xtask ci
shell: bash
run: |
# Convert the target triple from kebab-case to SCREAMING_SNAKE_CASE:
big_target=$(echo "${{ matrix.device.target }}" | tr [:lower:] [:upper:] | tr '-' '_')
# Set the *target specific* RUSTFLAGS for the current device:
echo "CARGO_TARGET_${big_target}_RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV
# Linting toolchain (stable cant build documentation)
if [ "${{ inputs.toolchain }}" == "nightly" ]; then
echo "LINTING_TOOLCHAIN=+nightly" >> $GITHUB_ENV
else
echo "LINTING_TOOLCHAIN=+esp" >> $GITHUB_ENV
fi
# Clippy and docs checks
- name: Clippy
shell: bash
run: cargo $LINTING_TOOLCHAIN xtask lint-packages --chips ${{ inputs.device }}
- name: Check doc-tests
shell: bash
run: cargo $LINTING_TOOLCHAIN xtask run-doc-test esp-hal ${{ inputs.device }}
- name: Check documentation
shell: bash
run: cargo $LINTING_TOOLCHAIN xtask build-documentation --packages esp-hal --packages esp-wifi --packages esp-hal-embassy --chips ${{ inputs.device }}
# Build all supported examples for the low-power core first (if present):
- name: Build prerequisite examples (esp-lp-hal)
shell: bash
if: contains(fromJson('["esp32c6", "esp32s2", "esp32s3"]'), inputs.device)
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-lp-hal ${{ inputs.device }}
- name: Check esp-lp-hal documentation
shell: bash
if: contains(fromJson('["esp32c6", "esp32s2", "esp32s3"]'), inputs.device)
run: cargo $LINTING_TOOLCHAIN xtask build-documentation --packages esp-lp-hal --chips ${{ inputs.device }}
# Make sure we're able to build the HAL without the default features
# enabled:
- name: Build (no features)
shell: bash
run: |
cargo xtask build-package \
--no-default-features \
--toolchain=${{ inputs.toolchain }} \
--features=${{ inputs.device }} \
--target=${{ inputs.target }} \
esp-hal
- name: Build (examples)
env:
CI: 1
shell: bash
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-hal ${{ inputs.device }} --debug
- name: Build (qa-test)
env:
CI: 1
shell: bash
run: cargo +${{ inputs.toolchain }} xtask build-examples qa-test ${{ inputs.device }} --debug
run: cargo +${{ inputs.toolchain }} xtask ci ${{ inputs.device }}
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
name: esp-hal (${{ matrix.device.soc }})
runs-on: ubuntu-latest
env:
CARGO_TARGET_DIR: ${{ github.workspace }}/target
CI: 1
SSID: SSID
PASSWORD: PASSWORD
STATIC_IP: 1.1.1.1
Expand Down Expand Up @@ -79,6 +81,9 @@ jobs:
components: rust-src

- uses: Swatinem/rust-cache@v2
with:
prefix-key: "ci-${{ matrix.device.soc }}"
cache-all-crates: true

- name: Build and Check
uses: ./.github/actions/check-esp-hal
Expand Down
2 changes: 1 addition & 1 deletion esp-ieee802154/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ byte = "0.2.7"
critical-section = "1.2.0"
document-features = "0.2.10"
esp-hal = { version = "0.23.0", path = "../esp-hal" }
esp-wifi-sys = "0.7.0"
esp-wifi-sys = "0.7.1"
heapless = "0.8.0"
ieee802154 = "0.6.1"
cfg-if = "1.0.0"
Expand Down
11 changes: 3 additions & 8 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ publish = false
aligned = { version = "0.4.2", optional = true }
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "a5148d8ae679e021b78f53fd33afb8bb35d0b62e", features = [ "macros", "async"] }
blocking-network-stack = { git = "https://github.com/bjoernQ/blocking-network-stack.git", rev = "b3ecefc222d8806edd221f266999ca339c52d34e" }
bt-hci = "0.2.0"
cfg-if = "1.0.0"
critical-section = "1.1.3"
embassy-executor = { version = "0.7.0", features = ["task-arena-size-20480"] }
Expand All @@ -18,7 +17,6 @@ embassy-net = { version = "0.6.0", features = [ "tcp", "udp", "dhcpv4", "medium-
embassy-sync = "0.6.0"
embassy-time = "0.4.0"
embassy-usb = { version = "0.2.0", default-features = false }
embedded-can = "0.4.1"
embedded-hal-async = "1.0.0"
embedded-io = { version = "0.6.1", default-features = false }
embedded-io-async = "0.6.1"
Expand All @@ -37,17 +35,14 @@ ieee80211 = { version = "0.4.0", default-features = false }
ieee802154 = "0.6.1"
log = "0.4.22"
nb = "1.1.0"
portable-atomic = { version = "1.9.0", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
smoltcp = { version = "0.12.0", default-features = false, features = [ "medium-ethernet", "socket-raw"] }
embedded-time = "=0.12.1"
static_cell = { version = "2.1.0", features = ["nightly"] }
usb-device = "0.3.2"
usbd-serial = "0.2.2"
edge-dhcp = { version = "0.5.0" }
edge-raw = { version = "0.5.0" }
edge-nal = { version = "0.5.0" }
edge-nal-embassy = { version = "0.5.0" }
edge-dhcp = { version = "0.5.0" }
edge-nal = { version = "0.5.0" }
edge-nal-embassy = { version = "0.5.0" }

[features]
esp32 = ["esp-hal/esp32", "esp-backtrace/esp32", "esp-hal-embassy?/esp32", "esp-println/esp32", "esp-storage?/esp32", "esp-wifi?/esp32"]
Expand Down
9 changes: 8 additions & 1 deletion xtask/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn run(args: &[String], cwd: &Path) -> Result<()> {
/// Execute cargo with the given arguments and from the specified directory.
pub fn run_with_env<I, K, V>(args: &[String], cwd: &Path, envs: I, capture: bool) -> Result<String>
where
I: IntoIterator<Item = (K, V)>,
I: IntoIterator<Item = (K, V)> + core::fmt::Debug,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
{
Expand All @@ -45,6 +45,13 @@ where
// using now or in future!
let cwd = windows_safe_path(cwd);

log::debug!(
"Running `cargo {}` in {:?} - Environment {:?}",
args.join(" "),
cwd,
envs
);

let output = Command::new(get_cargo())
.args(args)
.current_dir(cwd)
Expand Down
7 changes: 6 additions & 1 deletion xtask/src/documentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ fn cargo_doc(workspace: &Path, package: Package, chip: Option<Chip>) -> Result<P
crate::cargo::run_with_env(&args, &package_path, envs, false)?;

// Build up the path at which the built documentation can be found:
let mut docs_path = workspace.join(package.to_string()).join("target");
let mut docs_path = if let Ok(target_path) = std::env::var("CARGO_TARGET_DIR") {
PathBuf::from(target_path)
} else {
workspace.join(package.to_string()).join("target")
};

if let Some(target) = target {
docs_path = docs_path.join(target);
}
Expand Down
7 changes: 7 additions & 0 deletions xtask/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ impl Package {
pub fn is_published(&self) -> bool {
!matches!(self, Package::Examples | Package::HilTest | Package::QaTest)
}

/// Build on host
pub fn build_on_host(&self) -> bool {
use Package::*;

matches!(self, EspBuild | EspConfig | EspMetadata)
}
}

#[derive(Debug, Clone, Copy, Display, ValueEnum)]
Expand Down
Loading