Skip to content

Commit 7821b16

Browse files
committed
ENH: Add GitHub Actions CI and update Azure Pipelines configurations
- Introduced GitHub Actions CI workflows for `main` branch with multi-platform support (Ubuntu, macOS, Windows). - Remove Azure Pipelines - Remove Travis Pipelines - Standardized dependency installations, CMake configurations, and testing procedures across platforms. - Improved artifact handling, test result publishing, and code coverage reporting in CI workflows.
1 parent 1dc1ff1 commit 7821b16

File tree

9 files changed

+163
-346
lines changed

9 files changed

+163
-346
lines changed

.github/workflows/build.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: ${{ matrix.config.name }}
12+
runs-on: ${{ matrix.config.os }}
13+
timeout-minutes: 360 # Added timeout
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
config:
18+
- {
19+
name: "Ubuntu Latest GCC",
20+
os: ubuntu-latest,
21+
cc: "gcc",
22+
cxx: "g++",
23+
parallel: "$(nproc)"
24+
}
25+
- {
26+
name: "macOS Latest Clang",
27+
os: macos-latest,
28+
cc: "clang",
29+
cxx: "clang++",
30+
parallel: "$(sysctl -n hw.ncpu)"
31+
}
32+
# - {
33+
# name: "Windows Latest MSVC",
34+
# os: windows-latest,
35+
# cc: "cl",
36+
# cxx: "cl",
37+
# parallel: "$env:NUMBER_OF_PROCESSORS"
38+
# }
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Setup Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.12'
47+
48+
- name: Install Dependencies (Ubuntu)
49+
if: matrix.config.os == 'ubuntu-latest'
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get install -y ninja-build
53+
54+
- name: Install Dependencies (macOS)
55+
if: matrix.config.os == 'macos-latest'
56+
run: |
57+
brew install ninja
58+
59+
- name: Install Dependencies (Windows)
60+
if: matrix.config.os == 'windows-latest'
61+
run: |
62+
choco install ninja
63+
64+
- name: Configure CMake
65+
shell: bash
66+
run: |
67+
cmake -B build -G Ninja \
68+
-DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
69+
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} \
70+
-DCMAKE_CXX_STANDARD:STRING=17 \
71+
${{ matrix.config.os != 'windows-latest' && '-DCMAKE_CXX_FLAGS="-mtune=native -march=native"' || '' }} \
72+
${{ matrix.config.os != 'windows-latest' && '-DCMAKE_C_FLAGS="-mtune=native -march=native"' || '' }} \
73+
-DCMAKE_BUILD_TYPE=Release \
74+
-DEXTERNAL_PROJECT_BUILD_TYPE:STRING=Release \
75+
-DBUILD_TESTING=ON \
76+
-DBUILD_SHARED_LIBS=ON \
77+
-DBRAINSTools_REQUIRES_VTK=OFF \
78+
-DUSE_BRAINSABC:BOOL=OFF \
79+
-DUSE_BRAINSCreateLabelMapFromProbabilityMaps:BOOL=OFF \
80+
-DUSE_BRAINSDWICleanup:BOOL=OFF \
81+
-DUSE_BRAINSInitializedControlPoints:BOOL=OFF \
82+
-DUSE_BRAINSLabelStats:BOOL=OFF \
83+
-DUSE_BRAINSLandmarkInitializer:BOOL=OFF \
84+
-DUSE_BRAINSMultiModeSegment:BOOL=OFF \
85+
-DUSE_BRAINSMultiSTAPLE:BOOL=OFF \
86+
-DUSE_BRAINSMush:BOOL=OFF \
87+
-DUSE_BRAINSPosteriorToContinuousClass:BOOL=OFF \
88+
-DUSE_BRAINSResample:BOOL=ON \
89+
-DUSE_BRAINSROIAuto:BOOL=OFF \
90+
-DUSE_BRAINSSnapShotWriter:BOOL=OFF \
91+
-DUSE_BRAINSStripRotation:BOOL=OFF \
92+
-DUSE_BRAINSTransformConvert:BOOL=OFF \
93+
-DUSE_ConvertBetweenFileFormats:BOOL=OFF \
94+
-DUSE_ImageCalculator:BOOL=OFF \
95+
-DUSE_ReferenceAtlas:BOOL=OFF \
96+
-DBRAINSTools_BUILD_DICOM_SUPPORT:BOOL=OFF \
97+
-DUSE_DWIConvert:BOOL=OFF
98+
99+
# Disable testing that requires VTK
100+
# -DBRAINSTools_BUILD_DICOM_SUPPORT:BOOL=OFF \
101+
# -DUSE_DWIConvert:BOOL=OFF
102+
103+
- name: Build
104+
shell: bash
105+
run: cmake --build build --config Release --parallel ${{ matrix.config.parallel }}
106+
107+
- name: Clean build/BRAINSTools-Release-EPRelease-build
108+
working-directory: build/BRAINSTools-Release-EPRelease-build
109+
shell: bash
110+
run: ninja clean
111+
112+
- name: ExperimentalStart
113+
working-directory: build/BRAINSTools-Release-EPRelease-build
114+
shell: bash
115+
run: ctest -D ExperimentalStart
116+
117+
- name: ExperimentalConfigure
118+
working-directory: build/BRAINSTools-Release-EPRelease-build
119+
shell: bash
120+
run: ctest -D ExperimentalConfigure
121+
122+
- name: ExperimentalBuild
123+
working-directory: build/BRAINSTools-Release-EPRelease-build
124+
shell: bash
125+
run: ctest -D ExperimentalBuild -j ${{ matrix.config.parallel }}
126+
127+
- name: ExperimentalTest
128+
working-directory: build/BRAINSTools-Release-EPRelease-build
129+
shell: bash
130+
run: ctest -D ExperimentalTest --schedule-random --output-on-failure -j ${{ matrix.config.parallel }}
131+
132+
- name: ExperimentalSubmit
133+
working-directory: build/BRAINSTools-Release-EPRelease-build
134+
shell: bash
135+
run: ctest -D ExperimentalSubmit
136+
137+
- name: Upload Build Logs
138+
uses: actions/upload-artifact@v4
139+
if: always() # Changed from failure() to always()
140+
with:
141+
name: build-logs-${{ matrix.config.name }}
142+
path: |
143+
build/CMakeFiles/CMakeOutput.log
144+
build/CMakeFiles/CMakeError.log
145+
build/Testing/Temporary/LastTest.log

.travis.yml

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

.travis_build_script.sh

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

CMake/ProjectSourceVersion.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ get_git_head_revision(GIT_REFVAR _GIT_VERSION_HASH)
3434
# if there is not git directory we should be in a distributed package
3535
# which should contain this additional cmake file with the
3636
# _GIT_VERSION variables
37-
if(_GIT_VERSION_HASH STREQUAL "GITDIR-NOTFOUND")
37+
string(FIND "${_GIT_VERSION_HASH}" "-NOTFOUND" found_index)
38+
if(found_index EQUAL -1)
3839
include( "${CMAKE_CURRENT_SOURCE_DIR}/CMake/ProjectSourceVersionVars.cmake" )
3940
return()
4041
endif()

0 commit comments

Comments
 (0)