1name: Reusable workflow example 2 3on: workflow_call 4 5jobs: 6 build: 7 8 runs-on: ubuntu-latest 9 10 steps: 11 - uses: actions/checkout@v3 12 13 - name: Cache DragonOS GCC 14 id: cache-dragonos-gcc 15 uses: actions/cache@v3 16 env: 17 cache-name: cache-dragonos-gcc 18 with: 19 path: | 20 ~/opt 21 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }} 22 23 - if: ${{ steps.cache-dragonos-gcc.outputs.cache-hit != 'true' }} 24 name: build dragonos-gcc 25 continue-on-error: true 26 run: bash tools/build_gcc_toolchain.sh -f 27 28 - name: Cache build tools 29 id: cache-build-tools 30 uses: actions/cache@v3 31 env: 32 cache-name: cache-build-tools 33 dadk_version: 0.1.2 34 with: 35 path: | 36 ~/.cargo 37 ~/.rustup 38 ~/.bashrc 39 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }} 40 41 - if: ${{ steps.cache-build-tools.outputs.cache-hit != 'true' }} 42 name: Install toolchain 43 continue-on-error: true 44 run: | 45 sudo sh -c "apt update && apt install -y llvm-dev libclang-dev clang gcc-multilib libssl-dev pkg-config" 46 cargo install cargo-binutils 47 rustup toolchain install nightly 48 rustup default nightly 49 rustup component add rust-src 50 rustup component add llvm-tools-preview 51 rustup target add x86_64-unknown-none 52 rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu 53 rustup component add rustfmt 54 cargo install dadk --version 0.1.2 55 56