Add more ubuntu build runs for CI #2
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 | |
# This workflow is triggered on pushes to the repository. | |
on: push | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
name: ${{matrix.config.name}} | |
runs-on: ${{matrix.config.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu 24.04 GCC", artifact: "qi-linux-ubuntu24.04.tar.gz", | |
os: ubuntu-24.04, | |
cc: "gcc", cxx: "g++" | |
} | |
- { | |
name: "Ubuntu 22.04 GCC", artifact: "qi-linux-ubuntu22.04.tar.gz", | |
os: ubuntu-22.04, | |
cc: "gcc", cxx: "g++" | |
} | |
- { | |
name: "Ubuntu 20.04 GCC", artifact: "qi-linux-ubuntu20.04.tar.gz", | |
os: ubuntu-20.04, | |
cc: "gcc", cxx: "g++" | |
} | |
- { | |
name: "macOS", artifact: "qi-macos.tar.gz", | |
os: macos-12, | |
cc: "clang", cxx: "clang++" | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- name: Install Build Tools | |
shell: bash | |
run: | | |
if [ "${{runner.os}}" == "macOS" ]; then | |
brew install gnu-tar automake autoconf autoconf-archive | |
else | |
sudo apt-get update | |
sudo apt-get install -y automake autoconf autoconf-archive make | |
fi | |
- name: Restore vcpkg binary cache | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/vcpkg/ | |
key: ${{runner.os}}-${{hashFiles( 'vcpkg.json' ) }}-${{hashFiles( '.git/modules/cmake/HEAD' )}}-vcpkg-cache | |
- name: Build | |
shell: bash | |
env: | |
CC: ${{matrix.config.cc}} | |
CXX: ${{matrix.config.cxx}} | |
run: | | |
TC="${{github.workspace}}/cmake/toolchain.cmake" | |
export VCPKG_OVERLAY_TRIPLETS="${{github.workspace}}/cmake/triplets" | |
export FLAGS="ci" | |
cd ${{github.workspace}} | |
cmake -B build -S . \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_TOOLCHAIN_FILE="$TC" | |
cmake --build build | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Prepare Python | |
run: | | |
python -m pip install --upgrade pip | |
pip install nipype | |
pip install -e ./Python/ | |
shell: bash | |
- name: Run Tests | |
working-directory: ./Python/Tests | |
shell: bash | |
run: | | |
if [ "${{runner.os}}" != "macOS" ]; then # MacOS runners do not have AVX2 | |
export PATH="$PWD/../../build/Source:$PATH"; python -m unittest discover | |
fi | |
- name: Tarball | |
run: | | |
cd ${{github.workspace}} | |
mv ./build/Source/qi ./ | |
ALL="qi" | |
if [ "${{runner.os}}" == "macOS" ]; then | |
echo "Using GNU tar" | |
gtar -cvzf ${{matrix.config.artifact}} $ALL | |
else | |
echo "Using system tar" | |
tar -cvzf ${{matrix.config.artifact}} $ALL | |
fi | |
shell: bash | |
- name: Release | |
if: contains(github.ref, 'tags/v') | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
artifacts: ${{github.workspace}}/${{matrix.config.artifact}} | |
artifactErrorsFailBuild: true | |
draft: true |