From 79dbddb52e4c7ec038ca8d9d5bc729fc87fa40f3 Mon Sep 17 00:00:00 2001 From: Jostar Date: Wed, 4 Sep 2024 11:53:57 +0800 Subject: [PATCH] [feat] add macos workflow --- .github/workflows/build-macos.yaml | 59 +++++++++++++++++++++++++++++ .github/workflows/build-ubuntu.yaml | 1 - 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-macos.yaml diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml new file mode 100644 index 0000000..c01f648 --- /dev/null +++ b/.github/workflows/build-macos.yaml @@ -0,0 +1,59 @@ +name: Build on Mac OS +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] +jobs: + build-mac: + runs-on: macos-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Install Dependencies + run: | + brew update + brew install \ + cmake gmp \ + llvm@18 + + - name: Test LLVM + run: | + echo "/opt/homebrew/opt/llvm@18/bin" >> $GITHUB_PATH + clang --version + llvm-config --bindir + + - name: Spell Check + uses: crate-ci/typos@v1.24.3 + + - name: Clang Format + run: | + chmod +x scripts/run-clang-format + scripts/run-clang-format + + - name: Build Repo + run: | + cmake -DCMAKE_BUILD_TYPE:STRING=Release \ + -DLINK_LLVM_DYLIB=ON -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \ + -DCMAKE_INSTALL_PREFIX="/opt/knight" -DLLVM_BUILD_DIR="/opt/homebrew/opt/llvm@18" \ + -B build + cmake --build build -j16 + echo $(pwd)/build/bin >> $GITHUB_PATH + + - name: Clang Tidy + run: | + chmod +x scripts/run-clang-tidy + scripts/run-clang-tidy -j16 + + - name: Test Binary + run: | + knight --help + + - name: Unit Tests + run: | + pwd + chmod +x scripts/unittest + scripts/unittest run test/testcase/ + + \ No newline at end of file diff --git a/.github/workflows/build-ubuntu.yaml b/.github/workflows/build-ubuntu.yaml index a5b958a..b11c12d 100644 --- a/.github/workflows/build-ubuntu.yaml +++ b/.github/workflows/build-ubuntu.yaml @@ -38,7 +38,6 @@ jobs: run: | cmake -DCMAKE_BUILD_TYPE:STRING=Release -DLINK_LLVM_DYLIB=ON -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX="/opt/knight" -DLLVM_BUILD_DIR="/usr/lib/llvm-18" -B build cmake --build build -j16 - cmake --install build echo $(pwd)/build/bin >> $GITHUB_PATH - name: Clang Tidy