xref: /DragonOS/.github/workflows/makefile.yml (revision 59a6bcf6aee15a11a16431bdf875905c5ecf9157)
1name: Build Check
2
3on:
4  push:
5    branches: [ "master", "feat-*", "fix-*"]
6  pull_request:
7    branches: [ "master", "feat-*", "fix-*"]
8
9jobs:
10  # ensure the toolchain is cached
11  ensure-toolchain:
12    uses: ./.github/workflows/cache-toolchain.yml
13
14  format-check:
15    name: Format check ${{ matrix.arch }}
16    runs-on: ubuntu-latest
17    needs: [ensure-toolchain]
18    continue-on-error: true
19
20    strategy:
21      matrix:
22        arch: [x86_64, riscv64]
23
24    steps:
25    - uses: actions/checkout@v3
26
27    - uses: ./.github/actions/import-toolchain
28
29    - name: Format check
30      env:
31          ARCH: ${{ matrix.arch }}
32      run: |
33            printf "\n" >> kernel/src/include/bindings/bindings.rs
34            FMT_CHECK=1 make fmt
35
36  kernel-static-test:
37    name: Kernel static test ${{ matrix.arch }}
38    runs-on: ubuntu-latest
39    needs: [ensure-toolchain]
40    continue-on-error: true
41
42    strategy:
43      matrix:
44        arch: [x86_64, riscv64]
45
46    steps:
47    - uses: actions/checkout@v3
48
49    - uses: ./.github/actions/import-toolchain
50
51    - name: Run kernel static test
52      shell: bash -ileo pipefail {0}
53      env:
54          ARCH: ${{ matrix.arch }}
55      run: bash -c "source ~/.cargo/env && cd kernel && make test"
56
57  build-x86_64:
58
59    runs-on: ubuntu-latest
60    needs: [ensure-toolchain]
61
62    steps:
63    - uses: actions/checkout@v3
64
65    - uses: ./.github/actions/import-toolchain
66
67
68    - name: build the DragonOS
69      env:
70          ARCH: x86_64
71      shell: bash -ileo pipefail {0}
72
73      run: |
74        source ~/.bashrc
75        source ~/.cargo/env
76        export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
77
78        make -j $(nproc)
79
80
81  build-riscv64:
82
83    runs-on: ubuntu-latest
84    needs: [ensure-toolchain]
85
86    steps:
87    - uses: actions/checkout@v3
88      with:
89        submodules: 'recursive'
90
91    - uses: ./.github/actions/import-toolchain
92
93    - name: build the DragonOS
94      shell: bash -ileo pipefail {0}
95      env:
96          ARCH: riscv64
97
98      run: source ~/.bashrc && source ~/.cargo/env && make kernel -j $(nproc)
99
100