Skip to content

Commit

Permalink
调整toolchain缓存使用方式
Browse files Browse the repository at this point in the history
  • Loading branch information
fslongjin committed Aug 24, 2023
1 parent 484368c commit 8465840
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 45 deletions.
31 changes: 3 additions & 28 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,16 @@ on:
branches: [ "master" ]

jobs:
# ensure the toolchain is cached
ensure-toolchain:
uses: ./.github/workflows/cache-toolchain.yml


build:

runs-on: ubuntu-latest
needs: [ensure-toolchain]

steps:
- uses: actions/checkout@v3

- name: Cache DragonOS GCC
id: cache-dragonos-gcc
uses: actions/cache@v3
env:
cache-name: cache-dragonos-gcc
with:
path: |
~/opt
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}

- name: Cache build tools
id: cache-build-tools
uses: actions/cache@v3
env:
cache-name: cache-build-tools
dadk_version: 0.1.2
with:
path: |
~/.cargo
~/.rustup
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}

- name: Load toolchain
uses: ./.github/workflows/cache-toolchain.yml

- name: build the DragonOS
run: bash -c "source ~/.cargo/env && export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin && make -j $(nproc) "
21 changes: 4 additions & 17 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,16 @@ name: Rust format check
on: [push, pull_request]

jobs:
# ensure the toolchain is cached
ensure-toolchain:
uses: ./.github/workflows/cache-toolchain.yml

fmt:
name: check
runs-on: ubuntu-latest
needs: [ensure-toolchain]
steps:
- uses: actions/checkout@v3
- name: Cache build tools
id: cache-build-tools
uses: actions/cache@v3
env:
cache-name: cache-build-tools
dadk_version: 0.1.2
with:
path: |
~/.cargo
~/.rustup
~/.bashrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}


- name: Load toolchain
uses: ./.github/workflows/cache-toolchain.yml

# 准备 bindings.rs
# 由于 bindings.rs 是在 build.rs 中生成的,而这里为了方便,直接 touch 一个空文件
- name: prepare bindings
Expand Down

0 comments on commit 8465840

Please sign in to comment.