Skip to content

Commit 989c810

Browse files
committed
ci: cache user build to speed up the building
Signed-off-by: Haobo Gu <haobogu@outlook.com>
1 parent 5218064 commit 989c810

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/user_build.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ jobs:
7171
- name: Create firmware project
7272
working-directory: .
7373
run: rmkit create --keyboard-toml-path ${{ inputs.keyboard_toml_path }} --vial-json-path ${{ inputs.vial_json_path }} --version ${{ inputs.rmk_version }} --target-dir rmk
74+
- name: Cache cargo registry and target
75+
uses: Swatinem/rust-cache@v2
76+
with:
77+
workspaces: "rmk -> target"
78+
key: ${{ needs.get_chip_name.outputs.chip_name }}
7479
- name: Build firmware
7580
working-directory: ./rmk
7681
run: cargo build --release
@@ -105,11 +110,25 @@ jobs:
105110
sudo dpkg -i $LIBSSL
106111
- name: Install rmkit, espflash and espup
107112
run: cargo binstall rmkit espflash espup -y
113+
- name: Cache ESP Rust toolchain
114+
id: esp-toolchain-cache
115+
uses: actions/cache@v5
116+
with:
117+
path: |
118+
~/.rustup/toolchains/esp
119+
~/export-esp.sh
120+
key: ${{ runner.os }}-esp-toolchain-${{ needs.get_chip_name.outputs.chip_name }}-v1
108121
- name: Prepare esp environment
122+
if: steps.esp-toolchain-cache.outputs.cache-hit != 'true'
109123
run: espup install
110124
- name: Create firmware project
111125
working-directory: .
112126
run: rmkit create --keyboard-toml-path ${{ inputs.keyboard_toml_path }} --vial-json-path ${{ inputs.vial_json_path }} --version ${{ inputs.rmk_version }} --target-dir rmk
127+
- name: Cache cargo registry and target
128+
uses: Swatinem/rust-cache@v2
129+
with:
130+
workspaces: "rmk -> target"
131+
key: ${{ needs.get_chip_name.outputs.chip_name }}
113132
- name: Build firmware for esp32
114133
working-directory: ./rmk
115134
run: . /home/runner/export-esp.sh && cargo +esp build --release

0 commit comments

Comments
 (0)