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

Add CI build matrix #60

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
File renamed without changes.
13 changes: 13 additions & 0 deletions .github/ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
## on pull_requrest

set -euo pipefail

# Build with all features
cargo build --features ${CHIP},embassy,rt,memory-x --no-default-features --target ${TARGET}

# Build without embassy
# cargo build --features ${CHIP},rt --no-default-features --target ${TARGET}

# Build without embassy and rt
# cargo build --features ${CHIP} --no-default-features --target ${TARGET}
37 changes: 37 additions & 0 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Examples

on:
push:
branches: ["main"]
paths-ignore:
- "*.md"
pull_request:
branches: ["main"]
paths-ignore:
- "*.md"

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use nightly Rust
run: |
rustup default nightly
rustup component add rust-src
rustup update
rustup target add riscv32imac-unknown-none-elf
rustup target add riscv32imafc-unknown-none-elf
rustup target add riscv32i-unknown-none-elf
- name: Fetch Deps
# if this is a pull request
if: github.event_name == 'pull_request'
run: |
mkdir -p ../ch32-data/build/
cd ../ch32-data/build/
git clone https://github.com/ch32-rs/ch32-metapac.git
- name: Build Only
run: ./.github/ci/build-examples.sh
41 changes: 39 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI build
name: CI Build

on:
push:
Expand All @@ -15,6 +15,40 @@ env:

jobs:
build:
strategy:
matrix:
chip:
- ch32l103f8u6
- ch32v003f4u6
- ch32v103c8t6
- ch32v203f8u6
- ch32v208wbu6
- ch32v303vct6
- ch32v305fbp6
- ch32v307vct6
- ch32x035f7p6
- ch641
include:
- chip: ch32l103f8u6
target: riscv32imac-unknown-none-elf
- chip: ch32v003f4u6
target: riscv32i-unknown-none-elf
- chip: ch32v103c8t6
target: riscv32imac-unknown-none-elf
- chip: ch32v203f8u6
target: riscv32imac-unknown-none-elf
- chip: ch32v208wbu6
target: riscv32imac-unknown-none-elf
- chip: ch32v303vct6
target: riscv32imafc-unknown-none-elf
- chip: ch32v305fbp6
target: riscv32imafc-unknown-none-elf
- chip: ch32v307vct6
target: riscv32imafc-unknown-none-elf
- chip: ch32x035f7p6
target: riscv32imafc-unknown-none-elf
- chip: ch641
target: riscv32i-unknown-none-elf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -34,4 +68,7 @@ jobs:
cd ../ch32-data/build/
git clone https://github.com/ch32-rs/ch32-metapac.git
- name: Build Only
run: ./ci.sh
run: ./.github/ci/build.sh
env:
CHIP: ${{ matrix.chip }}
TARGET: ${{ matrix.target }}
11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ license = "MIT OR Apache-2.0"
[dependencies]
ch32-metapac = { features = [
"rt",
], git = "https://github.com/ch32-rs/ch32-metapac", rev = "43066e18cf51106dff448f679dfff368a41431d7" }
], git = "https://github.com/ch32-rs/ch32-metapac", rev = "cef1944dadf3a5d198e687500b8f5964f29efdf6" }

qingke = { version = "0.4.0", features = ["critical-section-impl"] }
qingke-rt = { version = "0.4.0", optional = true }
Expand All @@ -29,8 +29,9 @@ embedded-hal-async = "1.0.0"

critical-section = { version = "1.2.0" }
defmt = { version = "0.3.8", optional = true }
embassy-sync = { version = "0.6.0", optional = true }
embassy-futures = { version = "0.1.1", optional = true }

embassy-sync = { version = "0.6.0" }
embassy-futures = { version = "0.1.1" }
embassy-time-driver = { version = "0.1.0", optional = true }
embassy-time = { version = "0.3.2", optional = true }
embassy-usb-driver = "0.1.0"
Expand All @@ -48,7 +49,7 @@ embassy-hal-internal = "0.2.0"
[build-dependencies]
ch32-metapac = { features = [
"metadata",
], git = "https://github.com/ch32-rs/ch32-metapac", rev = "43066e18cf51106dff448f679dfff368a41431d7" }
], git = "https://github.com/ch32-rs/ch32-metapac", rev = "cef1944dadf3a5d198e687500b8f5964f29efdf6" }

proc-macro2 = "1.0"
quote = "1.0"
Expand All @@ -58,8 +59,6 @@ default = ["embassy", "rt"]
rt = ["dep:qingke-rt"]
highcode = ["qingke-rt/highcode"]
embassy = [
"dep:embassy-sync",
"dep:embassy-futures",
"dep:embassy-time-driver",
"dep:embassy-time",
]
Expand Down
4 changes: 2 additions & 2 deletions src/usbpd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<'d, T: Instance> UsbPdPhy<'d, T> {
// The detection voltage is 0.22V, sufficient to detect the default power(500mA/900mA)

T::port_cc_reg(self.cc1).modify(|w| w.set_cc_ce(vals::PortCcCe::V0_22));
embassy_time::Delay.delay_us(2);
crate::delay::Delay.delay_us(2);

if T::port_cc_reg(self.cc1).read().pa_cc_ai() {
// CC1 is connected
Expand All @@ -171,7 +171,7 @@ impl<'d, T: Instance> UsbPdPhy<'d, T> {
Ok(())
} else {
T::port_cc_reg(self.cc2).modify(|w| w.set_cc_ce(vals::PortCcCe::V0_22));
embassy_time::Delay.delay_us(2);
crate::delay::Delay.delay_us(2);

if T::port_cc_reg(self.cc2).read().pa_cc_ai() {
// CC2 is connected
Expand Down
Loading