From f4f34a05ae374d6981dc2fa67f612c77ab852a54 Mon Sep 17 00:00:00 2001 From: H <19694277+gnullme@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:46:27 +0100 Subject: [PATCH 01/14] fix(config) check if either board or chip is set --- rmk-macro/src/keyboard_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmk-macro/src/keyboard_config.rs b/rmk-macro/src/keyboard_config.rs index 1861f7ae..407c9edc 100644 --- a/rmk-macro/src/keyboard_config.rs +++ b/rmk-macro/src/keyboard_config.rs @@ -186,7 +186,7 @@ impl KeyboardConfig { /// /// The chip model can be either configured to a board or a microcontroller chip. pub(crate) fn get_chip_model(config: &KeyboardTomlConfig) -> Result { - if config.keyboard.board.is_none() ^ config.keyboard.board.is_none() { + if config.keyboard.board.is_none() ^ config.keyboard.chip.is_none() { let message = format!( "Either \"board\" or \"chip\" should be set in keyboard.toml, but not both" ); From 884cef4e20c54ea42c67a24a6a005ca482cab01d Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 11:03:12 +0800 Subject: [PATCH 02/14] fix(macro): fix the chip & board check in macro Signed-off-by: Haobo Gu --- rmk-macro/src/keyboard_config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmk-macro/src/keyboard_config.rs b/rmk-macro/src/keyboard_config.rs index 407c9edc..70c40309 100644 --- a/rmk-macro/src/keyboard_config.rs +++ b/rmk-macro/src/keyboard_config.rs @@ -186,7 +186,7 @@ impl KeyboardConfig { /// /// The chip model can be either configured to a board or a microcontroller chip. pub(crate) fn get_chip_model(config: &KeyboardTomlConfig) -> Result { - if config.keyboard.board.is_none() ^ config.keyboard.chip.is_none() { + if config.keyboard.board.is_none() == config.keyboard.chip.is_none() { let message = format!( "Either \"board\" or \"chip\" should be set in keyboard.toml, but not both" ); From 494b82f000af70c599d8b9334ac0dd43d7adb224 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 11:38:39 +0800 Subject: [PATCH 03/14] ci(esp): simplify esp ci script Signed-off-by: Haobo Gu --- .github/workflows/build esp.yml | 108 ++++---------------------------- 1 file changed, 12 insertions(+), 96 deletions(-) diff --git a/.github/workflows/build esp.yml b/.github/workflows/build esp.yml index 2c92e266..586e9fd7 100644 --- a/.github/workflows/build esp.yml +++ b/.github/workflows/build esp.yml @@ -21,8 +21,17 @@ env: CARGO_TERM_COLOR: always jobs: - build_esp32c3_ble: + build_esp_example: runs-on: ubuntu-22.04 + strategy: + matrix: + chip: + - esp32c3_ble + - esp32c6_ble + - esp32s3_ble + example_type: + - use_rust + - use_config steps: - uses: cargo-bins/cargo-binstall@main - uses: actions/checkout@v3 @@ -30,101 +39,8 @@ jobs: run: cargo binstall ldproxy espup -y - name: Install esp toolchain run: espup install - - name: Build esp32c3_ble - working-directory: ./examples/use_rust/esp32c3_ble - run: | - cargo +esp build --release - cargo clean - build_esp32c3_ble_with_config: - runs-on: ubuntu-22.04 - steps: - - uses: cargo-bins/cargo-binstall@main - - uses: actions/checkout@v3 - - name: Install ldproxy and espup - run: cargo binstall ldproxy espup -y - - name: Install esp toolchain - run: espup install - - name: Build esp32c3_ble with config - working-directory: ./examples/use_config/esp32c3_ble - run: | - cargo +esp build --release - cargo clean - build_esp32c6_ble: - runs-on: ubuntu-22.04 - steps: - - uses: cargo-bins/cargo-binstall@main - - uses: actions/checkout@v3 - - name: Install ldproxy and espup - run: cargo binstall ldproxy espup -y - - name: Install esp toolchain - run: espup install - - name: Build esp32c6_ble - working-directory: ./examples/use_rust/esp32c6_ble - run: | - cargo +esp build --release - cargo clean - build_esp32c6_ble_with_config: - runs-on: ubuntu-22.04 - steps: - - uses: cargo-bins/cargo-binstall@main - - uses: actions/checkout@v3 - - name: Install ldproxy and espup - run: cargo binstall ldproxy espup -y - - name: Install esp toolchain - run: espup install - - name: Build esp32c6_ble with config - working-directory: ./examples/use_config/esp32c6_ble - run: | - cargo +esp build --release - cargo clean - - build_esp32s3_ble: - runs-on: ubuntu-22.04 - steps: - - uses: cargo-bins/cargo-binstall@main - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - id: cache-cargo - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ./examples/use_rust/esp32s3_ble/target/ - ./examples/use_rust/esp32s3_ble/.embuild/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install ldproxy and espup - run: cargo binstall ldproxy espup -y - - name: Install esp toolchain - run: espup install - - name: Build esp32s3_ble - working-directory: ./examples/use_rust/esp32s3_ble - run: | - cargo +esp build --release - cargo clean - build_esp32s3_ble_with_config: - runs-on: ubuntu-22.04 - steps: - - uses: cargo-bins/cargo-binstall@main - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - id: cache-cargo - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - ./examples/use_rust/esp32s3_ble/target/ - ./examples/use_rust/esp32s3_ble/.embuild/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install ldproxy and espup - run: cargo binstall ldproxy espup -y - - name: Install esp toolchain - run: espup install - - name: Build esp32s3_ble with config - working-directory: ./examples/use_config/esp32s3_ble + - name: Build + working-directory: ./examples/${{ matrix.example_type }}/${{ matrix.chip }}_ble run: | cargo +esp build --release cargo clean From 74e20cc96884fd8c16da857ca5d76ada14063c53 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 11:54:58 +0800 Subject: [PATCH 04/14] ci: fix ci errors in PRs Signed-off-by: Haobo Gu --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e1ce5df..a96fb914 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: with: primary-runner: "self-hosted" fallback-runner: "ubuntu-latest" - github-token: ${{ vars.RMK_GITHUB_TOKEN }} + github-token: "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" build_rmk: needs: determine-runner From e16d14194f331fc40fb8f5e03d6920b01ad81c83 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 11:58:48 +0800 Subject: [PATCH 05/14] ci: fix esp32 ci script Signed-off-by: Haobo Gu --- .github/workflows/build esp.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build esp.yml b/.github/workflows/build esp.yml index 586e9fd7..bfc3f088 100644 --- a/.github/workflows/build esp.yml +++ b/.github/workflows/build esp.yml @@ -26,9 +26,9 @@ jobs: strategy: matrix: chip: - - esp32c3_ble - - esp32c6_ble - - esp32s3_ble + - esp32c3 + - esp32c6 + - esp32s3 example_type: - use_rust - use_config From 3da1b8044e9968b6a4b8fb9b3659e29a21ed7dad Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 12:01:07 +0800 Subject: [PATCH 06/14] ci: fix ci error Signed-off-by: Haobo Gu --- .github/workflows/build esp.yml | 2 +- .github/workflows/build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build esp.yml b/.github/workflows/build esp.yml index bfc3f088..553d48f7 100644 --- a/.github/workflows/build esp.yml +++ b/.github/workflows/build esp.yml @@ -21,7 +21,7 @@ env: CARGO_TERM_COLOR: always jobs: - build_esp_example: + build_esp: runs-on: ubuntu-22.04 strategy: matrix: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a96fb914..51073c60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,7 @@ jobs: with: primary-runner: "self-hosted" fallback-runner: "ubuntu-latest" - github-token: "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" + github-token: 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 build_rmk: needs: determine-runner From be0d313b162fd9fe3d1326241b2045aaf7df4d49 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 14:33:27 +0800 Subject: [PATCH 07/14] ci: simplify ci script, use matrix Signed-off-by: Haobo Gu --- .github/workflows/build.yml | 282 +++--------------------------------- 1 file changed, 21 insertions(+), 261 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51073c60..fb9e670b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,281 +19,41 @@ concurrency: env: CARGO_TERM_COLOR: always - # By default, RUSTFLAGS with “-D warnings” turns warnings into errors. - RUSTFLAGS: jobs: - determine-runner: + build_examples: runs-on: ubuntu-latest - outputs: - runner: ${{ steps.set-runner.outputs.use-runner }} - steps: - - name: Determine which runner to use - id: set-runner - uses: jimmygchen/runner-fallback-action@v1 - with: - primary-runner: "self-hosted" - fallback-runner: "ubuntu-latest" - github-token: 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 - - build_rmk: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} + strategy: + matrix: + example: + - nrf52832_ble + - nrf52840_ble + - nrf52840_ble_split + - rp2040 + - rp2040_split + - rp2040_direct_pin + - stm32f1 + - stm32f4 + - stm32h7 + example_type: + - use_rust + - use_config steps: - uses: actions/setup-python@v5 with: python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make + - uses: cargo-bins/cargo-binstall@main - uses: actions/checkout@v3 - - name: Build rmk - working-directory: ./rmk - run: cargo build --release - build_rp2040: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 + run: cargo binstall cargo-make - name: Install target - run: rustup target add thumbv6m-none-eabi + run: rustup target add thumbv6m-none-eabi thumbv7em-none-eabihf thumbv7m-none-eabi - name: Build rp2040 - working-directory: ./examples/use_rust/rp2040 - run: cargo make uf2 --release - build_rp2040_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv6m-none-eabi - - name: Build rp2040 with config - working-directory: ./examples/use_config/rp2040 - run: cargo make uf2 --release - build_stm32h7: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build stm32h7 - working-directory: ./examples/use_rust/stm32h7 - run: cargo make uf2 --release - build_stm32h7_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build stm32h7 with config - working-directory: ./examples/use_config/stm32h7 - run: cargo make uf2 --release - build_stm32f1: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7m-none-eabi - - name: Build stm32f1 - working-directory: ./examples/use_rust/stm32f1 - run: cargo make uf2 --release - build_stm32f1_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7m-none-eabi - - name: Build stm32f1 with config - working-directory: ./examples/use_config/stm32f1 - run: cargo make uf2 --release - build_stm32f4: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build stm32f4 - working-directory: ./examples/use_rust/stm32f4 - run: cargo make uf2 --release - build_stm32f4_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build stm32f4 with config - working-directory: ./examples/use_config/stm32f4 - run: cargo make uf2 --release - build_nrf52840_ble: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build nrf52840_ble - working-directory: ./examples/use_rust/nrf52840_ble - run: cargo make uf2 --release - build_nrf52832_ble: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build nrf52832_ble - working-directory: ./examples/use_rust/nrf52832_ble - run: cargo make uf2 --release - build_nrf52832_ble_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build nrf52832_ble with config - working-directory: ./examples/use_config/nrf52832_ble - run: cargo make uf2 --release - build_rp2040_split: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv6m-none-eabi - - name: Build rp2040 split - working-directory: ./examples/use_rust/rp2040_split - run: cargo make uf2 --release - build_rp2040_split_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv6m-none-eabi - - name: Build rp2040 split with config - working-directory: ./examples/use_config/rp2040_split - run: cargo make uf2 --release - build_nrf52840: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build nrf52840 split - working-directory: ./examples/use_rust/nrf52840_ble_split - run: cargo make uf2 --release - build_nrf52840_split_with_config: - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Install cargo-make - run: cargo install cargo-make - - uses: actions/checkout@v3 - - name: Install target - run: rustup target add thumbv7em-none-eabihf - - name: Build nrf52840 split with config - working-directory: ./examples/use_config/nrf52840_ble_split + working-directory: ./examples/${{ matrix.example_type }}/${{ matrix.example }} run: cargo make uf2 --release binary-size: # Copied from sequential-storage: https://github.com/tweedegolf/sequential-storage/blob/master/.github/workflows/ci.yaml - needs: determine-runner - runs-on: ${{ fromJson(needs.determine-runner.outputs.runner) }} + runs-on: ubuntu-latest permissions: actions: read pull-requests: write From 2f7b0c9e099077ed0c8489f787af92f4e75055a9 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 14:40:52 +0800 Subject: [PATCH 08/14] ci: add use workflow Signed-off-by: Haobo Gu --- .github/workflows/build.yml | 6 ++--- .github/workflows/user_build.yml | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/user_build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb9e670b..f061f160 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: steps: - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: "3.11" - uses: cargo-bins/cargo-binstall@main - uses: actions/checkout@v3 - name: Install cargo-make @@ -78,7 +78,7 @@ jobs: - name: Check out the repo with the full git history uses: actions/checkout@v3 with: - fetch-depth: '0' + fetch-depth: "0" - name: Build new binary working-directory: ./examples/use_config/nrf52840_ble run: | @@ -114,4 +114,4 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, body: `## PR build size\n \`\`\`\n${{ join(steps.new-size.outputs.*, '\n') }}\n\`\`\`\n ### Diff\n\`\`\`\n${{ steps.bloaty-comparison.outputs.bloaty-output-encoded }}\`\`\`\n` - }) + }) diff --git a/.github/workflows/user_build.yml b/.github/workflows/user_build.yml new file mode 100644 index 00000000..ac02cdc0 --- /dev/null +++ b/.github/workflows/user_build.yml @@ -0,0 +1,42 @@ +name: Build firmware according to user config file + +on: + workflow_call: + inputs: + keyboard_toml_path: + description: "Path to the keyboard.toml" + default: "keyboard.toml" + required: false + type: string + vial_json_path: + description: "Path to the vial.json" + default: "vial.json" + required: false + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: cargo-bins/cargo-binstall@main + - name: Install rmkit and cargo-make + run: cargo binstall cargo-make rmkit -y + - uses: actions/checkout@v3 + - name: Install libssl + run: wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb + - name: Create firmware project + working-directory: . + run: rmkit create --keyboard-toml-path ${{ inputs.keyboard_toml_path }} --vial-json-path ${{ inputs.vial_json_path }} --target-dir rmk + - name: Build firmware + working-directory: ./rmk + run: cargo make uf2 --release + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: firmware_uf2 + path: rmk/*.uf2 + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: firmware_hex + path: rmk/*.hex From d0ab5432b0f1c5eba47123e4861cc24b7c3cd34b Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 14:44:27 +0800 Subject: [PATCH 09/14] ci: fix ci error Signed-off-by: Haobo Gu --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f061f160..d73694ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,7 +70,7 @@ jobs: ./example/target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install flip-link - run: cargo install flip-link + run: cargo install flip-link --force - run: rustup target add thumbv7em-none-eabihf - run: rustup component add rust-src llvm-tools - if: steps.cache-cargo.outputs.cache-hit != 'true' From 31f9cc23a84bcb187c4e54732b8f2412bb779a7f Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 16:12:27 +0800 Subject: [PATCH 10/14] ci: update user_build script, support esp32 Signed-off-by: Haobo Gu --- .github/workflows/user_build.yml | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/.github/workflows/user_build.yml b/.github/workflows/user_build.yml index ac02cdc0..486f886e 100644 --- a/.github/workflows/user_build.yml +++ b/.github/workflows/user_build.yml @@ -15,8 +15,33 @@ on: type: string jobs: + get_chip_name: + runs-on: ubuntu-latest + outputs: + chip_name: ${{ steps.capture.outputs.chip_name }} + steps: + - uses: cargo-bins/cargo-binstall@main + - name: Install rmkit + run: cargo binstall rmkit -y + - name: Get chip name + id: capture + working-directory: ./rmk + run: | + # Run rmkit command to get the chip name + OUTPUT=$(rmkit get-chip --keyboard-toml-path ${{ inputs.keyboard_toml_path }}) + + # Print the output to confirm + echo "Command output: $OUTPUT" + + # Save the output as a GitHub Actions output variable + echo "chip=$OUTPUT" >> $GITHUB_ENV + + # Set chip_name output + echo "::set-output name=chip_name::$OUTPUT" build: runs-on: ubuntu-latest + needs: get_chip_name + if: needs.get_chip_name.outputs.chip_name != 'esp32c3' && needs.get_chip_name.outputs.chip_name != 'esp32s3' && needs.get_chip_name.outputs.chip_name != 'esp32c6' steps: - uses: cargo-bins/cargo-binstall@main - name: Install rmkit and cargo-make @@ -40,3 +65,43 @@ jobs: with: name: firmware_hex path: rmk/*.hex + build_esp: + runs-on: ubuntu-latest + needs: get_chip_name + if: needs.get_chip_name.outputs.chip_name == 'esp32c3' || needs.get_chip_name.outputs.chip_name == 'esp32s3' || needs.get_chip_name.outputs.chip_name == 'esp32c6' + steps: + - uses: cargo-bins/cargo-binstall@main + - name: Install rmkit and espflash + run: cargo binstall rmkit espflash -y + - uses: actions/checkout@v3 + - name: Install libssl + run: wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb + - name: Prepare esp environment + run: | + cargo binstall ldproxy espup -y + espup install + - name: Build firmware for esp32 + working-directory: ./rmk + run: cargo +esp build --release + - name: Get target arch + id: arch + run: | + if [ "${{ needs.get_chip_name.outputs.chip_name }}" == "esp32c3" ]; then + ARCH="riscv32imc-esp-espidf" + elif [ "${{ needs.get_chip_name.outputs.chip_name }}" == "esp32s3" ]; then + ARCH="riscv32imac-esp-espidf" + elif [ "${{ needs.get_chip_name.outputs.chip_name }}" == "esp32c6" ]; then + ARCH="xtensa-esp32s3-espidf" + else + ARCH="" + fi + echo "::set-output name=arch::$ARCH" + - name: convert firmware to bin + working-directory: ./rmk + run: espflash save-image --chip ${{ needs.get_chip_name.outputs.chip_name }} target/${{ steps.arch.outputs.arch }}/release/rmk-${{ needs.get_chip_name.outputs.chip_name }} ./rmk.bin + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: firmware_bin + path: rmk/*.bin + From c066d50e9f5fc7538e0ec04bbee1b05957a13a24 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 16:16:57 +0800 Subject: [PATCH 11/14] ci: fix ci error Signed-off-by: Haobo Gu --- .github/workflows/user_build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/user_build.yml b/.github/workflows/user_build.yml index 486f886e..6c21598d 100644 --- a/.github/workflows/user_build.yml +++ b/.github/workflows/user_build.yml @@ -25,7 +25,6 @@ jobs: run: cargo binstall rmkit -y - name: Get chip name id: capture - working-directory: ./rmk run: | # Run rmkit command to get the chip name OUTPUT=$(rmkit get-chip --keyboard-toml-path ${{ inputs.keyboard_toml_path }}) From f16f157284520bd22b8c6e7747477e6da40b5e49 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 16:19:58 +0800 Subject: [PATCH 12/14] ci: fix ci error Signed-off-by: Haobo Gu --- .github/workflows/user_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/user_build.yml b/.github/workflows/user_build.yml index 6c21598d..366f38ed 100644 --- a/.github/workflows/user_build.yml +++ b/.github/workflows/user_build.yml @@ -21,6 +21,7 @@ jobs: chip_name: ${{ steps.capture.outputs.chip_name }} steps: - uses: cargo-bins/cargo-binstall@main + - uses: actions/checkout@v3 - name: Install rmkit run: cargo binstall rmkit -y - name: Get chip name From 27f4085236f90c82c1deb4ae1c264d2e22fd63f6 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 16:28:56 +0800 Subject: [PATCH 13/14] ci: improve ci variable saving Signed-off-by: Haobo Gu --- .github/workflows/user_build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/user_build.yml b/.github/workflows/user_build.yml index 366f38ed..3907c62d 100644 --- a/.github/workflows/user_build.yml +++ b/.github/workflows/user_build.yml @@ -34,10 +34,8 @@ jobs: echo "Command output: $OUTPUT" # Save the output as a GitHub Actions output variable - echo "chip=$OUTPUT" >> $GITHUB_ENV + echo "chip=$OUTPUT" >> $GITHUB_OUTPUT - # Set chip_name output - echo "::set-output name=chip_name::$OUTPUT" build: runs-on: ubuntu-latest needs: get_chip_name @@ -80,6 +78,9 @@ jobs: run: | cargo binstall ldproxy espup -y espup install + - name: Create firmware project + working-directory: . + run: rmkit create --keyboard-toml-path ${{ inputs.keyboard_toml_path }} --vial-json-path ${{ inputs.vial_json_path }} --target-dir rmk - name: Build firmware for esp32 working-directory: ./rmk run: cargo +esp build --release From bbc48d73cbb6723b8b91a0b59793286a0be15d1e Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Wed, 25 Dec 2024 16:34:25 +0800 Subject: [PATCH 14/14] ci: fix var name Signed-off-by: Haobo Gu --- .github/workflows/user_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/user_build.yml b/.github/workflows/user_build.yml index 3907c62d..0884ee91 100644 --- a/.github/workflows/user_build.yml +++ b/.github/workflows/user_build.yml @@ -34,7 +34,7 @@ jobs: echo "Command output: $OUTPUT" # Save the output as a GitHub Actions output variable - echo "chip=$OUTPUT" >> $GITHUB_OUTPUT + echo "chip_name=$OUTPUT" >> $GITHUB_OUTPUT build: runs-on: ubuntu-latest