Skip to content

Refactor global variables and thread model #72

Refactor global variables and thread model

Refactor global variables and thread model #72

Workflow file for this run

name: Build and test pawn
on:
push:
branches:
- main
- ci
pull_request:
branches:
- main
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
strategy:
fail-fast: false
matrix:
config:
- name: "Ubuntu Latest - GCC"
os: ubuntu-latest
cc: gcc
cxx: g++
shell: bash
- name: "Ubuntu Latest - Clang"
os: ubuntu-latest
cc: clang
cxx: clang++
shell: bash
- name: "Ubuntu 20.04 - GCC"
os: ubuntu-20.04
cc: gcc
cxx: g++
shell: bash
- name: "Ubuntu 20.04 - Clang"
os: ubuntu-20.04
cc: clang
cxx: clang++
shell: bash
- name: "MacOS - GCC 11"
os: macos-latest
cc: gcc-11
cxx: g++-11
shell: bash
- name: "MacOS - Clang"
os: macos-latest
cc: clang
cxx: clang++
shell: bash
- name: "Windows 2022 - GCC"
os: windows-2022
cc: gcc
cxx: g++
sys: mingw64
packages: mingw-w64-x86_64-gcc
shell: msys2 {0}
- name: "Windows 2022 - Clang"
os: windows-2022
cc: clang
cxx: clang++
sys: mingw64
packages: mingw-w64-x86_64-clang mingw-w64-x86_64-lld
shell: msys2 {0}
defaults:
run:
shell: ${{ matrix.config.shell }}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare Windows with MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.config.sys}}
install: make git diffutils ${{matrix.config.packages}}
- name: Fetch bench signature
run: |
git log HEAD | grep 'Bench: ' | head -n 1 | awk '{print $2}' > bench.sig_ref
- name: Build pawn
run: |
make -j4
- name: Run bench
run: |
build/pawn bench > bench.out 2>&1
cat bench.out
- name: Extract and verify bench signature
run: |
cat bench.out | grep 'Nodes searched:' | awk '{print $3}' > bench.sig
cmp bench.sig bench.sig_ref
- name: Run tests
run: |
build/pawn test > test.out
cat test.out
grep -q 'All tests passed' test.out
sanitisers:
name: Sanitisers
runs-on: ubuntu-latest
env:
CC: gcc
CXX: g++
shell: bash
needs: build
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt update
sudo apt install valgrind
- name: Run bench - debug build
run: |
make -B -j4 DEBUG=1
build/pawn bench
- name: Run bench - AddressSanitizer
run: |
make -B -j4 DEBUG=2 SANITIZE=address
build/pawn bench
- name: Run bench - UndefinedBehaviorSanitizer
run: |
make -B -j4 DEBUG=2 SANITIZE=undefined
build/pawn bench
- name: Run small bench - ThreadSanitizer
run: |
make -B -j4 DEBUG=2 SANITIZE=thread
TSAN_OPTIONS="suppressions=test/suppressions.tsan" build/pawn bench 11 4 64
- name: Run small bench - valgrind
run: |
sudo apt update
sudo apt install valgrind
make -B -j4 DEBUG=2
valgrind --leak-check=full --error-exitcode=1 build/pawn bench 11