NMP Formula - #33 #82
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 & Run Tests | |
on: | |
push: | |
branches: [ "master", "dev" ] | |
jobs: | |
BlackCore: | |
name: ${{matrix.config.name}} | |
runs-on: ${{matrix.config.os}} | |
strategy: | |
matrix: | |
config: | |
- { | |
name: "Ubuntu clang popcnt", | |
os: ubuntu-latest, | |
compiler: clang++, | |
arch: popcnt, | |
target: WhiteCore-popcnt-linux, | |
} | |
- { | |
name: "Ubuntu clang avx2", | |
os: ubuntu-latest, | |
compiler: clang++, | |
arch: avx2, | |
target: WhiteCore-avx2-linux, | |
} | |
- { | |
name: "Ubuntu clang bmi2", | |
os: ubuntu-latest, | |
compiler: clang++, | |
arch: bmi2, | |
target: WhiteCore-bmi2-linux, | |
} | |
- { | |
name: "Windows clang popcnt", | |
os: windows-latest, | |
compiler: clang, | |
arch: popcnt, | |
target: WhiteCore-popcnt-win, | |
} | |
- { | |
name: "Windows clang avx2", | |
os: windows-latest, | |
compiler: clang, | |
arch: avx2, | |
target: WhiteCore-avx2-win, | |
} | |
- { | |
name: "Windows clang bmi2", | |
os: windows-latest, | |
compiler: clang, | |
arch: bmi2, | |
target: WhiteCore-bmi2-win, | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install required packages | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install clang-15 | |
- name: Build BlackCore | |
run: | | |
${{matrix.config.compiler}} --version | |
make CXX=${{matrix.config.compiler}} EXE=${{matrix.config.target}} ARCH=${{matrix.config.target}} | |
- name: Run tests | |
run: | | |
./${{matrix.config.target}} test | |
- name: Run bench on Windows | |
if: runner.os == 'Windows' | |
run: | | |
./${{matrix.config.target}} bench | |
- name: Run bench on Linux | |
id: obtain_bench | |
if: runner.os == 'Linux' | |
run: | | |
BENCH=$(./${{matrix.config.target}} bench | grep -Eo '^[0-9]+ nodes' | grep -o '[0-9]*') | |
COMMIT_BENCH=$(git log -1 --pretty=%B | grep -Eo '^Bench: *[0-9]+' | grep -o '[0-9]*') | |
echo "::set-output name=BENCH::$BENCH" | |
echo "::set-output name=COMMIT_BENCH::$COMMIT_BENCH" | |
- name: Invalid bench | |
if: | |
${{steps.obtain_bench.outputs.BENCH != steps.obtain_bench.outputs.COMMIT_BENCH && runner.os == 'Linux'}} | |
run: | | |
echo "::error::The commit bench ${{steps.obtain_bench.outputs.COMMIT_BENCH}} is not equal to the actual bench ${{steps.obtain_bench.outputs.BENCH}}!" | |
exit 1 | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: BlackCore | |
path: ${{matrix.config.target}} |