cache-toolchain.yml 2.4 KB

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