xref: /DragonOS/.github/workflows/makefile.yml (revision d46c6d27941a26de14f55a2bbf956219bcc70871)
1name: Build Check
2
3on:
4  push:
5    branches: [ "master", "patch-add-riscv64-github-workflow" ]
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      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      run: bash -c "source ~/.cargo/env && export DragonOS_GCC=$HOME/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin && make -j $(nproc) "
72
73
74  build-riscv64:
75
76    runs-on: ubuntu-latest
77    needs: [ensure-toolchain]
78
79    steps:
80    - uses: actions/checkout@v3
81      with:
82        submodules: 'recursive'
83
84    - uses: ./.github/actions/import-toolchain
85
86    - name: build the DragonOS
87      env:
88          ARCH: riscv64
89
90      run: bash -c "source ~/.cargo/env && make kernel -j $(nproc)"
91
92