Add bitpacked maps #32
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: Builds | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "*.*.*" | |
pull_request: | |
types: [opened, reopened] | |
defaults: | |
run: | |
shell: bash | |
env: | |
VCPKG_FETCH_DEPTH: 1 # Depth to fetch vcpkg commits, must include the baseline. | |
jobs: | |
CMake: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
triplet: x64-linux | |
shared: dynamic | |
config: Debug | |
- os: ubuntu-24.04 | |
triplet: x64-linux | |
shared: static | |
config: Debug | |
- os: ubuntu-24.04 | |
triplet: x64-linux | |
shared: dynamic | |
config: Release | |
- os: macos-14 | |
triplet: arm64-osx | |
shared: static | |
config: Debug | |
- os: macos-14 | |
triplet: arm64-osx | |
shared: dynamic | |
config: Release | |
- os: windows-2022 | |
triplet: x64-windows | |
shared: static | |
config: Debug | |
- os: windows-2022 | |
triplet: x64-windows | |
shared: dynamic | |
config: Release | |
env: | |
CMAKE_BUILD_DIR: build | |
VCPKG_ROOT: ${{github.workspace}}/vcpkg | |
VCPKG_LIBRARY_LINKAGE: ${{matrix.shared}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch Vcpkg commits | |
working-directory: vcpkg | |
run: git fetch --depth=${{env.VCPKG_FETCH_DEPTH}} | |
# Install latest CMake. | |
- uses: lukka/get-cmake@latest | |
# Restore both vcpkg and its artifacts from the GitHub cache service. | |
- name: Restore vcpkg and its artifacts. | |
uses: actions/cache@v4 | |
with: | |
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. | |
# The second path is the location of vcpkg (it contains the vcpkg executable and data files). | |
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. | |
path: | | |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ | |
${{ env.VCPKG_ROOT }} | |
!${{ env.VCPKG_ROOT }}/buildtrees | |
!${{ env.VCPKG_ROOT }}/packages | |
!${{ env.VCPKG_ROOT }}/downloads | |
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. | |
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. | |
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). | |
key: | | |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json', '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate | |
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: CMake configure | |
run: | | |
cmake -S . -B ${{env.CMAKE_BUILD_DIR}} -GNinja \ | |
-DVCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \ | |
-DCMAKE_BUILD_TYPE=${{matrix.config}} \ | |
-DCMAKE_INSTALL_PREFIX=local \ | |
-DBUILD_SHARED_LIBS=${{ matrix.shared == 'dynamic' && 'TRUE' || 'FALSE' }} \ | |
-DLIBTCODFOV_TESTS=ON \ | |
-Wdev \ | |
${{ matrix.cmake_extra_args }} | |
- name: CMake build | |
run: | | |
cmake --build ${{env.CMAKE_BUILD_DIR}} | |
- name: List build files | |
run: find ${{env.CMAKE_BUILD_DIR}} | |
- name: Run tests | |
env: | |
LD_LIBRARY_PATH: ${{env.CMAKE_BUILD_DIR}}/lib | |
run: | | |
${{env.CMAKE_BUILD_DIR}}/bin/unittest ~[!nonportable] ${{ matrix.config != 'Release' && '~[benchmark]' || '' }} | |
- name: CMake test install | |
run: | | |
cmake --install ${{env.CMAKE_BUILD_DIR}} --config ${{matrix.config}} | |
coverage: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: ubuntu-24.04 | |
triplet: x64-linux | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Fetch Vcpkg commits | |
working-directory: vcpkg | |
run: git fetch --depth=${{env.VCPKG_FETCH_DEPTH}} | |
- name: Install the latest CMake | |
uses: lukka/get-cmake@latest | |
- name: Restore vcpkg and its artifacts. | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ | |
${{ env.VCPKG_ROOT }} | |
!${{ env.VCPKG_ROOT }}/buildtrees | |
!${{ env.VCPKG_ROOT }}/packages | |
!${{ env.VCPKG_ROOT }}/downloads | |
key: | | |
${{ hashFiles( 'vcpkg_manifest/vcpkg.json', '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate | |
- name: CMake configure | |
run: | | |
cmake . -GNinja \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DCMAKE_CXX_FLAGS="--coverage" \ | |
-DCMAKE_C_FLAGS="--coverage" \ | |
-DLIBTCODFOV_TESTS=ON \ | |
-Wdev | |
- name: CMake build | |
run: | | |
cmake --build . | |
- name: Run tests | |
env: | |
LD_LIBRARY_PATH: lib | |
run: | | |
bin/unittest ~[!nonportable] ~[benchmark] | |
- name: List coverage files | |
run: find . | grep -e ".gc..$" | |
- name: Generate coverage data | |
run: gcov CMakeFiles/libtcod-fov.dir/src/libtcod-fov/**.o tests/CMakeFiles/unittest.dir/*.o | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
Autotools: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-24.04, macos-14] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Install APT dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libsdl2-dev | |
- name: Install Brew dependencies | |
if: runner.os == 'macOS' | |
run: | | |
brew install automake sdl2 libtool | |
- name: libtoolize | |
run: ${{ runner.os == 'macOS' && 'glibtoolize' || 'libtoolize' }} --install | |
working-directory: buildsys/autotools | |
- name: Configure package | |
working-directory: buildsys/autotools | |
run: | | |
autoreconf --install | |
./configure --prefix=$HOME/.local | |
- name: Build package | |
working-directory: buildsys/autotools | |
run: | | |
make -j 3 install | |
- name: Run tests | |
working-directory: buildsys/autotools | |
run: | | |
make check | |
amalgam: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cpp-amalgamate | |
run: | | |
wget --no-verbose https://github.com/Felerius/cpp-amalgamate/releases/download/1.0.1/cpp-amalgamate-x86_64-unknown-linux-gnu -O ~/cpp-amalgamate | |
chmod +x ~/cpp-amalgamate | |
- name: Generate source amalgam | |
run: ~/cpp-amalgamate -v src/libtcod-fov/*.c --dir-quote include/libtcod-fov --unresolvable-quote-include error -o libtcod-fov.c | |
- name: Generate header amalgam | |
run: ~/cpp-amalgamate -v include/libtcod-fov.h --unresolvable-quote-include error -o libtcod-fov.h | |
- name: Upload amalgams | |
uses: actions/upload-artifact@v4 | |
with: | |
name: amalgams | |
path: | | |
libtcod-fov.h | |
libtcod-fov.c | |
if-no-files-found: error | |
- name: Test compile sources | |
run: gcc -c --std=c99 -Wall -Wextra libtcod-fov.c | |
- name: Test compile headers (C99) | |
run: gcc -c --std=c99 -Wall -Wextra libtcod-fov.h | |
- name: Test compile headers (C++17) | |
run: g++ -c --std=c++17 -Wall -Wextra libtcod-fov.h |