-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from fedorov/master
Migrate to Github Action
- Loading branch information
Showing
9 changed files
with
229 additions
and
222 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: C/C++ CI Linux | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
deployments: write | ||
packages: write | ||
|
||
jobs: | ||
build-linux: | ||
|
||
runs-on: ubuntu-latest | ||
timeout-minutes: 40 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.7.14' | ||
|
||
- name: "Install jsondiff" | ||
run: pip install jsondiff | ||
- name: "Install cmake" | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install rsync | ||
sudo apt-get install cmake | ||
- name: "Build dcmqi" | ||
run: | | ||
cd docker && make dcmqi | ||
- name: "Test dcmqi" | ||
run: | | ||
cd docker && make dcmqi.test | ||
- name: "Publish docker image" | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASS }} && \ | ||
docker push fedorov/dcmqi:`git describe --tags --exact-match 2> /dev/null || echo "latest"` \ | ||
|| echo "skipping docker push" | ||
- name: "Publish linux package" | ||
run: | | ||
pip install -U "scikit-ci-addons>=0.22.0" | ||
# python -m scikit-ci publish --package-name dcmqi --package-version `git | ||
# describe --tags --exact-match 2> /dev/null || echo "latest"` --platform linux | ||
# --commit-range ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --repository ${{ github.event.pull_request.head.repo.full_name }} --token ${{ secrets.GITHUB_TOKEN }} --verbose | ||
ci_addons publish_github_release fedorov/dcmqi \ | ||
--prerelease-packages "build/dcmqi-build/dcmqi-*-linux-*.tar.gz" \ | ||
--prerelease-packages-clear-pattern "dcmqi-*-linux-*" \ | ||
--prerelease-packages-keep-pattern "*<COMMIT_DATE>-<COMMIT_SHORT_SHA>*" \ | ||
--exit-success-if-missing-token --token ${{ secrets.GA_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: C/C++ CI macOS | ||
|
||
# We only run this on pushes and pull requests to master branch, | ||
# as well as on manual trigger (workflow_dispatch, useful if workflow | ||
# has been disabled earlier). | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-macos: | ||
|
||
runs-on: macos-latest | ||
# So far, a full superbuild (no caches) has always been complete in < 45 minutes. | ||
timeout-minutes: 45 | ||
|
||
# Checkout and install python | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.7.14' | ||
|
||
# Install build tools (cmake and ninja) as well as jsondiff | ||
- name: "Install jsondiff" | ||
run: pip install jsondiff | ||
- name: "Install cmake" | ||
run: | | ||
cmake --version | ||
echo ${PATH} | ||
wget --no-check-certificate https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-mac.zip | ||
unzip ninja-mac.zip && sudo cp ninja /usr/local/bin/ | ||
# Make sure all directories required for computing the hash actually exist | ||
- name: "Prepare cache directories" | ||
run: | | ||
mkdir -p ${{ github.workspace }}/dcmqi-build/DCMTK-build | ||
mkdir -p ${{ github.workspace }}/dcmqi-build/DCMTK | ||
mkdir -p ${{ github.workspace }}/dcmqi-build/ITK | ||
mkdir -p ${{ github.workspace }}/dcmqi-build/ITK-build | ||
mkdir -p ${{ github.workspace }}/dcmqi-build/zlib-install | ||
# Prepare the cache directories, which are DCMTK/ITK source and build directories | ||
# since dcmqi build later requires DCMTK/ITK headers from source, and libraries from | ||
# build directories. For ZLIB, installation directory is sufficient since it contains | ||
# both, headers and libraries. | ||
- name: Check for cached DCMTK, ITK and ZLIB | ||
id: cache-dcmtk-itk-zlib | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-dcmtk-itk-zlib | ||
with: | ||
# The recursive content of these directories goes into the cache | ||
path: | | ||
${{ github.workspace }}/dcmqi-build/DCMTK | ||
${{ github.workspace }}/dcmqi-build/DCMTK-build | ||
${{ github.workspace }}/dcmqi-build/ITK | ||
${{ github.workspace }}/dcmqi-build/ITK-build | ||
${{ github.workspace }}/dcmqi-build/zlib-install | ||
# The hash key decides whether cache entry is out of date or can be used. | ||
# We use the hash of the CMakeExternals files to decide whether | ||
# we must rebuild it. Also a change in the OS will trigger cash rebuild. | ||
# A hashkey will have the form of macOS-build-cache-dcmtk-itk-<hash> | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('CMakeExternals/DCMTK.cmake','CMakeExternals/ITK.cmake', 'CMakeExternals/zlib.cmake') }} | ||
# Below is the key pattern that defines, which cache entries stored on the | ||
# GitHub repository will match our key. We simply use the name of OS and | ||
# name of the cache, i.e. every cache entry with key pattern | ||
# macOS-build-cache-dcmtk-itk-<hash> will match. | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
# This is step executed if a cache entry is found | ||
- name: "Configure dcmqi w/ cached DCMTK/ITK/ZLIB" | ||
if: ${{ steps.cache-dcmtk-itk-zlib.outputs.cache-hit == 'true' }} | ||
# Make sure to set ITK, DCMTK and ZLIB directories to dcmqi cmake configuration step | ||
run: | | ||
cd ${{ github.workspace }}/dcmqi-build && cmake -G Ninja ${{ github.workspace }} -DDCMTK_DIR=${{ github.workspace }}/dcmqi-build/DCMTK-build -DITK_DIR=${{ github.workspace }}/dcmqi-build/ITK-build -DZLIB_ROOT=${{ github.workspace }}/dcmqi-build/zlib-install | ||
# If we don't have a matching cache entry, configure for full rebuild (regular dcmqi superbuild) | ||
- name: "Configure dcmqi w/o cached DCMTK/ITK/ZLIB" | ||
if: ${{ steps.cache-dcmtk-itk-zlib.outputs.cache-hit != 'true' }} | ||
run: | | ||
cd ${{ github.workspace }}/dcmqi-build && cmake -G Ninja ${{ github.workspace }} | ||
# Build dcmqi | ||
- name: "Build dcmqi" | ||
run: | | ||
cd ${{ github.workspace }}/dcmqi-build && ninja | ||
# ...and finally package it. | ||
- name: "Package dcmqi" | ||
run: | | ||
cd ${{ github.workspace }}/dcmqi-build/dcmqi-build && ninja package |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: C/C++ CI Windows | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build-windows: | ||
|
||
runs-on: windows-latest | ||
timeout-minutes: 30 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: microsoft/setup-msbuild@v1.1 | ||
with: | ||
vs-version: '17' | ||
msbuild-architecture: x64 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8.0' | ||
|
||
- name: Download prerequisite packages | ||
run: | | ||
$client = new-object System.Net.WebClient; | ||
$client.DownloadFile("https://github.com/QIICR/dicom3tools/releases/download/20200512090031/dicom3tools_winexe_1.00.snapshot.20200512090031.zip", "c:\dicom3tools.zip") | ||
$client.DownloadFile("https://github.com/QIICR/zlib-dcmqi/releases/download/zlib-dcmqi-1.2.3-VS17-Win64-Release-static/zlib-dcmqi.zip", "c:\zlib-dcmqi.zip") | ||
$client.DownloadFile("https://github.com/QIICR/dcmtk-dcmqi/releases/download/DCMTK-dcmqi-3.6.7_20220105-VS12-Win64-Release-v0.0.32-static/DCMTK-dcmqi.zip", "c:\DCMTK-dcmqi.zip") | ||
$client.DownloadFile("https://github.com/QIICR/ITK-dcmqi/releases/download/ITK-dcmqi-VS17-Win64-Release-v0.0.40-static/ITK-dcmqi.zip", "c:\ITK-dcmqi.zip") | ||
shell: pwsh | ||
|
||
- name: Uncompress prerequisite packages | ||
run: | | ||
7z x c:\dicom3tools.zip -oc:\dicom3tools | ||
7z x c:\zlib-dcmqi.zip -oc:\zlib-install | ||
7z x c:\DCMTK-dcmqi.zip -oc:\DCMTK-install | ||
7z x c:\ITK-dcmqi.zip -oc:\ITK-install | ||
- name: Install prerequisite python packages | ||
run: | | ||
pip install jsondiff | ||
- name: Configure project | ||
|
||
run: | | ||
ls ${{ github.workspace }} | ||
echo "WORKSPACE dir: ${{ github.workspace }}" | ||
cmake --version | ||
mkdir ${{ github.workspace }}\dcmqi-build | ||
echo "Step 2" | ||
cd ${{ github.workspace }}\dcmqi-build | ||
echo "Step 3" | ||
cmake -G "Visual Studio 17 2022" -Ax64 -DITK_DIR:PATH=c:\ITK-install\lib\cmake\ITK-5.3 -DDCMTK_DIR:PATH=c:\DCMTK-install\cmake -DZLIB_ROOT:PATH=c:\zlib-install -DZLIB_INCLUDE_DIR:PATH=c:\zlib-install\include -DZLIB_LIBRARY:FILEPATH=c:\zlib-install\lib\zlib.lib -DBUILD_SHARED_LIBS:BOOL=OFF ${{ github.workspace }} | ||
- name: Build dcmqi and package | ||
run: | | ||
cd ${{ github.workspace }}\dcmqi-build/ | ||
cmake --build . --config Release -- /m | ||
cd ${{ github.workspace }}\dcmqi-build\dcmqi-build | ||
cmake --build . --config Release --target PACKAGE -- /m | ||
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
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
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
Oops, something went wrong.