[feat] add macos workflow #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 install \ | |
gcc g++ 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/[email protected] | |
- 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/ | |