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