Skip to content

Commit 8415f13

Browse files
authored
Merge pull request #156 from AdaptiveParticles/github-actions-test
Move tests to Github Actions
2 parents 80943e2 + 71935e5 commit 8415f13

File tree

8 files changed

+108
-59
lines changed

8 files changed

+108
-59
lines changed

.github/workflows/cmake.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: CMake
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master, develop ]
8+
9+
jobs:
10+
job:
11+
name: ${{ matrix.os }}-build-and-test
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
include:
18+
- os: windows-latest
19+
triplet: x64-windows
20+
extblosc: ON
21+
openmp: ON
22+
buildargs: -A x64 -T ClangCL
23+
- os: ubuntu-latest
24+
triplet: x64-linux
25+
extblosc: OFF
26+
openmp: ON
27+
buildargs:
28+
- os: macos-latest
29+
triplet: x64-osx
30+
extblosc: OFF
31+
openmp: ON
32+
buildargs:
33+
env:
34+
# Indicates the CMake build directory where project files and binaries are being produced.
35+
CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/
36+
# Indicates the location of the vcpkg as a Git submodule of the project repository.
37+
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
with:
42+
submodules: true
43+
44+
# 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.
45+
- uses: lukka/get-cmake@latest
46+
# Restore both vcpkg and its artifacts from the GitHub cache service.
47+
- name: Restore vcpkg and its artifacts.
48+
uses: actions/cache@v2
49+
with:
50+
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file.
51+
# The second path is the location of vcpkg (it contains the vcpkg executable and data files).
52+
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
53+
path: |
54+
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/
55+
${{ env.VCPKG_ROOT }}
56+
!${{ env.VCPKG_ROOT }}/buildtrees
57+
!${{ env.VCPKG_ROOT }}/packages
58+
!${{ env.VCPKG_ROOT }}/downloads
59+
# 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.
60+
# 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.
61+
# 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).
62+
key: |
63+
${{ hashFiles( 'vcpkg_manifest/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
64+
65+
- name: Install OpenMP dependencies with brew for OSX
66+
if: contains(matrix.os,'macos')
67+
run: brew install libomp #todo caching
68+
69+
- name: Show content of workspace after cache has been restored
70+
run: find $RUNNER_WORKSPACE
71+
shell: bash
72+
# 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.
73+
- uses: ilammy/msvc-dev-cmd@v1
74+
75+
# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install the dependencies as specified in vcpkg.json.
76+
- name: Install dependencies and generate project files
77+
run: |
78+
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" -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_PREFER_EXTERNAL_BLOSC=${{ matrix.extblosc }} -DAPR_USE_OPENMP=${{ matrix.openmp }} ${{ matrix.buildargs }}
79+
80+
# Build the whole project with Ninja (which is spawn by CMake).
81+
- name: Build
82+
run: |
83+
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --parallel 4 --config Release
84+
85+
# Run tests
86+
- name: tests
87+
run: |
88+
ctest --test-dir "${{ env.CMAKE_BUILD_DIR }}"
89+
90+
- name: Show content of workspace at its completion
91+
run: find $RUNNER_WORKSPACE
92+
shell: bash

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "external/c-blosc"]
88
path = external/c-blosc
99
url = https://github.com/Blosc/c-blosc
10+
[submodule "vcpkg"]
11+
path = vcpkg
12+
url = https://github.com/microsoft/vcpkg.git

.travis.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Library for producing and processing on the Adaptive Particle Representation (AP
66

77
Labeled Zebrafish nuclei: Gopi Shah, Huisken Lab ([MPI-CBG](https://www.mpi-cbg.de), Dresden and [Morgridge Institute for Research](https://morgridge.org/research/medical-engineering/huisken-lab/), Madison); see also [Schmid et al., _Nature Communications_ 2017](https://www.nature.com/articles/ncomms3207)
88

9-
[![Build Status](https://travis-ci.org/AdaptiveParticles/LibAPR.svg?branch=master)](https://travis-ci.org/AdaptiveParticles/LibAPR)
9+
[![CMake](https://github.com/AdaptiveParticles/LibAPR/actions/workflows/cmake.yml/badge.svg)](https://github.com/AdaptiveParticles/LibAPR/actions/workflows/cmake.yml)
1010
[![DOI](https://zenodo.org/badge/70479293.svg)](https://zenodo.org/badge/latestdoi/70479293)
1111

1212

cmake-build.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

cmake-build_windows.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

vcpkg

Submodule vcpkg added at 57bd710

vcpkg.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "libapr",
3+
"version-string": "0.0.1",
4+
"dependencies": [
5+
"blosc",
6+
"hdf5",
7+
"szip",
8+
"gtest",
9+
"tiff"
10+
]
11+
}

0 commit comments

Comments
 (0)