fix #182 #136
Workflow file for this run
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 and Test | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
branches: [ master, develop ] | |
jobs: | |
job: | |
name: ${{ matrix.os }}-build-and-test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: windows-latest | |
triplet: x64-windows | |
extblosc: ON | |
openmp: ON | |
buildargs: -A x64 -T ClangCL | |
- os: ubuntu-latest | |
triplet: x64-linux | |
extblosc: OFF | |
openmp: ON | |
buildargs: | |
- os: macos-latest | |
triplet: x64-osx | |
extblosc: OFF | |
openmp: ON | |
buildargs: | |
env: | |
# Indicates the CMake build directory where project files and binaries are being produced. | |
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/ | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. | |
- 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@v3 | |
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 termporary 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' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate | |
- name: Install OpenMP dependencies with brew for OSX | |
if: contains(matrix.os,'macos') | |
run: brew install libomp pkg-config #todo caching | |
- name: Show content of workspace after cache has been restored | |
run: find $RUNNER_WORKSPACE | |
shell: bash | |
# 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 | |
# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install the dependencies as specified in vcpkg.json. | |
- name: Install dependencies and generate project files | |
run: | | |
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -DAPR_BUILD_STATIC_LIB=ON -DAPR_BUILD_SHARED_LIB=OFF -DAPR_BUILD_EXAMPLES=ON -DAPR_TESTS=ON -DAPR_USE_CUDA=OFF -DAPR_PREFER_EXTERNAL_BLOSC=${{ matrix.extblosc }} -DAPR_USE_OPENMP=${{ matrix.openmp }} ${{ matrix.buildargs }} | |
# Build the whole project with Ninja (which is spawn by CMake). | |
- name: Build | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --parallel 4 --config Release | |
# Run tests | |
- name: tests | |
run: | | |
ctest --test-dir "${{ env.CMAKE_BUILD_DIR }}" --output-on-failure | |
- name: Show content of workspace at its completion | |
run: find $RUNNER_WORKSPACE | |
shell: bash |