xref: /DragonReach/.github/workflows/cache-toolchain.yml (revision 2069cc0dc0984a2981454b00316ba607f88ac512)
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
14        - name: Cache build tools
15          id: cache-build-tools
16          uses: actions/cache@v3
17          env:
18              cache-name: cache-build-tools
19              dadk_version: 0.1.2
20          with:
21            path: |
22              ~/.cargo
23              ~/.rustup
24              ~/.bashrc
25            key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}
26
27        - if: ${{ steps.cache-build-tools.outputs.cache-hit != 'true' }}
28          name: Install toolchain
29          continue-on-error: true
30          run:  |
31            sudo sh -c "apt update && apt install -y llvm-dev libclang-dev clang gcc-multilib libssl-dev pkg-config"
32            cargo install cargo-binutils
33            rustup toolchain install nightly
34            rustup default nightly
35            rustup component add rust-src
36            rustup component add llvm-tools-preview
37            rustup target add x86_64-unknown-none
38            rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
39            rustup component add rustfmt
40
41            rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu
42            rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
43            rustup target add x86_64-unknown-linux-musl --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
44            rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
45
46            cargo install dadk --version 0.1.2