|
| 1 | +# Copyright 2025 Nuo Shen, Nanjing University |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: CI Build and Test |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: [ main, master, dev ] |
| 20 | + pull_request: |
| 21 | + branches: [ main, master, dev ] |
| 22 | + workflow_dispatch: |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-and-test: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + submodules: recursive |
| 33 | + |
| 34 | + - name: Install system dependencies |
| 35 | + run: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get install -y \ |
| 38 | + build-essential \ |
| 39 | + cmake \ |
| 40 | + ninja-build \ |
| 41 | + pkg-config \ |
| 42 | + git \ |
| 43 | + wget \ |
| 44 | + xz-utils \ |
| 45 | + libx11-dev \ |
| 46 | + libxext-dev \ |
| 47 | + libxrandr-dev \ |
| 48 | + libxcursor-dev \ |
| 49 | + libxinerama-dev \ |
| 50 | + libasound2-dev \ |
| 51 | + libpulse-dev \ |
| 52 | + libdbus-1-dev \ |
| 53 | + libudev-dev \ |
| 54 | + libegl1-mesa-dev \ |
| 55 | + libgl1-mesa-dev \ |
| 56 | + libxkbcommon-dev \ |
| 57 | + libwayland-dev |
| 58 | +
|
| 59 | + - name: Install RISC-V toolchain |
| 60 | + run: | |
| 61 | + wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.11.04/riscv64-elf-ubuntu-24.04-gcc.tar.xz |
| 62 | + tar -xJf riscv64-elf-ubuntu-24.04-gcc.tar.xz -C $HOME |
| 63 | + echo "$HOME/riscv/bin" >> $GITHUB_PATH |
| 64 | +
|
| 65 | + - name: Verify RISC-V toolchain |
| 66 | + run: | |
| 67 | + riscv64-unknown-elf-gcc --version |
| 68 | +
|
| 69 | + - name: Build and install SDL3 from source |
| 70 | + run: | |
| 71 | + git clone https://github.com/libsdl-org/SDL.git --depth=1 -b release-3.2.26 |
| 72 | + cd SDL |
| 73 | + mkdir -p build |
| 74 | + cd build |
| 75 | + cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja -DSDL_TEST=OFF |
| 76 | + cmake --build . --parallel $(nproc) |
| 77 | + sudo cmake --install . --parallel $(nproc) |
| 78 | + cd ../.. |
| 79 | +
|
| 80 | + - name: Install Abseil |
| 81 | + run: | |
| 82 | + git clone https://github.com/abseil/abseil-cpp.git -b 20250814.1 --depth=1 |
| 83 | + cd abseil-cpp |
| 84 | + mkdir build && cd build |
| 85 | + cmake .. \ |
| 86 | + -DCMAKE_BUILD_TYPE=Release \ |
| 87 | + -DABSL_BUILD_TESTING=OFF \ |
| 88 | + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ |
| 89 | + -DABSL_PROPAGATE_CXX_STD=ON \ |
| 90 | + -G Ninja |
| 91 | + cmake --build . --parallel $(nproc) |
| 92 | + sudo cmake --install . --parallel $(nproc) |
| 93 | + cd ../.. |
| 94 | +
|
| 95 | + - name: Configure CMake |
| 96 | + run: | |
| 97 | + mkdir build |
| 98 | + cd build |
| 99 | + cmake .. \ |
| 100 | + -DCMAKE_BUILD_TYPE=Release |
| 101 | + cd .. |
| 102 | +
|
| 103 | + - name: Build project (parallel) |
| 104 | + run: | |
| 105 | + cd build |
| 106 | + make -j$(nproc) |
| 107 | + cd .. |
| 108 | +
|
| 109 | + - name: Run tests (parallel) |
| 110 | + run: | |
| 111 | + cd build |
| 112 | + ctest --output-on-failure -j $(nproc) |
| 113 | + cd .. |
0 commit comments