Skip to content

Commit

Permalink
Merge pull request #475 from fedorov/master
Browse files Browse the repository at this point in the history
Migrate to Github Action
  • Loading branch information
fedorov authored Sep 11, 2023
2 parents 451bf84 + 1c47368 commit 4810ff6
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 222 deletions.
136 changes: 0 additions & 136 deletions .circleci/config.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/cmake-linux.yml
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 }}
96 changes: 96 additions & 0 deletions .github/workflows/cmake-macos.yml
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
68 changes: 68 additions & 0 deletions .github/workflows/cmake-win.yml
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
2 changes: 1 addition & 1 deletion CMake/dcmqiVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#
# Name of the latest tag. It is used to reference the "bleeding edge"
# version on GitHub. This lightweight tag is automatically updated
# by a script running on CI services like Appveyor, CircleCI or TravisCI.
# by the workflow files fueling GitHub Actions.
#
# .. variable:: DCMQI_SOURCE_DIR
#
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Then, click on the "Delete branch" button that appears afterward.

#### Automatic testing of pull requests

Every pull request is tested automatically using continuous integration using CircleCI, Appveyor and TravisCI
Every pull request is tested automatically using continuous integration using GitHub Actions
each time you push a commit to it. No PR should be merged until all CI are green, unless there is
a good reason to merge it first (as an example, proper testing cannot be done due to the references of
the components that are changing, but must be available in the `master` branch).
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[![OpenHub](https://www.openhub.net/p/dcmqi/widgets/project_thin_badge.gif)](https://www.openhub.net/p/dcmqi) [![codecov](https://codecov.io/gh/QIICR/dcmqi/branch/master/graph/badge.svg)](https://codecov.io/gh/QIICR/dcmqi)
[![](https://img.shields.io/docker/pulls/qiicr/dcmqi.svg?maxAge=604800)](https://hub.docker.com/r/qiicr/dcmqi)
[![OpenHub](https://www.openhub.net/p/dcmqi/widgets/project_thin_badge.gif)](https://www.openhub.net/p/dcmqi) [![codecov](https://codecov.io/gh/QIICR/dcmqi/branch/master/graph/badge.svg)](https://codecov.io/gh/QIICR/dcmqi)
[![](https://img.shields.io/docker/pulls/qiicr/dcmqi.svg?maxAge=604800)](https://hub.docker.com/r/qiicr/dcmqi)

| CI Build | Linux | Windows | Mac |
|--------------|-------|---------|-----|
| Build Status for latest | ![GitHub CI Linux](https://github.com/fedorov/dcmqi/actions/workflows/cmake-linux.yml/badge.svg) | ![GitHub CI Windows](https://github.com/fedorov/dcmqi/actions/workflows/cmake-win.yml/badge.svg) | ![GitHub CI Mac](https://github.com/fedorov/dcmqi/actions/workflows/cmake-macos.yml/badge.svg)

| | Linux | Windows |
|--------------|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| Build Status for latest | [![Circle CI](https://circleci.com/gh/QIICR/dcmqi.svg?style=shield)](https://circleci.com/gh/QIICR/dcmqi) | [![Appveyor](https://ci.appveyor.com/api/projects/status/04l87y2j6prboap7?svg=true)](https://ci.appveyor.com/project/fedorov/dcmqi) |

# Introduction

Expand Down
Loading

0 comments on commit 4810ff6

Please sign in to comment.