xref: /DragonOS/.github/workflows/makefile.yml (revision a381e482cbe742b2e4bbeaacae134a8131bf3f91)
1name: Build Check
2
3on:
4  push:
5    branches: [ "master" ]
6  pull_request:
7    branches: [ "master" ]
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            printf "\n" >> user/libs/libc/src/include/internal/bindings/bindings.rs
35            FMT_CHECK=1 make fmt
36
37  kernel-static-test:
38    name: Kernel static test ${{ matrix.arch }}
39    runs-on: ubuntu-latest
40    needs: [ensure-toolchain]
41    continue-on-error: true
42
43    strategy:
44      matrix:
45        arch: [x86_64, riscv64]
46
47    steps:
48    - uses: actions/checkout@v3
49
50    - uses: ./.github/actions/import-toolchain
51
52    - name: Run kernel static test
53      shell: bash -ileo pipefail {0}
54      env:
55          ARCH: ${{ matrix.arch }}
56      run: bash -c "source ~/.cargo/env && cd kernel && make test"
57
58  build-x86_64:
59
60    runs-on: ubuntu-latest
61    needs: [ensure-toolchain]
62
63    steps:
64    - uses: actions/checkout@v3
65
66    - uses: ./.github/actions/import-toolchain
67
68
69    - name: build the DragonOS
70      env:
71          ARCH: x86_64
72      shell: bash -ileo pipefail {0}
73
74      run: |
75        source ~/.bashrc
76        source ~/.cargo/env
77        export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin
78
79        make -j $(nproc)
80
81
82  build-riscv64:
83
84    runs-on: ubuntu-latest
85    needs: [ensure-toolchain]
86
87    steps:
88    - uses: actions/checkout@v3
89      with:
90        submodules: 'recursive'
91
92    - uses: ./.github/actions/import-toolchain
93
94    - name: build the DragonOS
95      shell: bash -ileo pipefail {0}
96      env:
97          ARCH: riscv64
98
99      run: source ~/.bashrc && source ~/.cargo/env && make kernel -j $(nproc)
100
101