Skip to content

Commit

Permalink
GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Jan 31, 2025
1 parent 030733b commit 748a9f5
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: orthanc
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: ['https://orthanc.team']
187 changes: 187 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: build and release

on:
push:
branches:
- '*'
tags:
- '*'

pull_request:
branches: [ master ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
pre-build:
name: pre-build
runs-on: "ubuntu-latest"
outputs:
current_branch_tag: ${{steps.branch_name.outputs.current_branch_tag}}
is_tag: ${{steps.branch_name.outputs.is_tag}}
steps:
- name: Get branch/tag name
id: branch_name
run: |
echo "current_branch_tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
[[ "${GITHUB_REF_TYPE}" == "tag" ]] && echo "is_tag=true" >> $GITHUB_OUTPUT || echo "is_tag=false" >> $GITHUB_OUTPUT
- name: Echo pre_build
run: |
echo ${{ steps.branch_name.outputs.is_tag }} ${{ steps.branch_name.outputs.current_branch_tag }}
echo ${{ github.ref}}
build:
name: ${{ matrix.config.os }}-build
runs-on: ${{ matrix.config.os }}
needs: [pre-build, build-web-app]
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
artifact: "AdvancedStorage.dll",
artifactPath: "Release\\AdvancedStorage.dll",
triplet: x64-windows,
os: windows-latest,
extraCMakeFlags: ""
}
- {
name: "Ubuntu",
artifact: "libAdvancedStorage.so",
artifactPath: "libAdvancedStorage.so",
triplet: x64-linux,
os: ubuntu-latest,
extraCMakeFlags: ""
}
- {
name: "MacOSX",
artifact: "libAdvancedStorage.dylib",
artifactPath: "libAdvancedStorage.dylib",
triplet: x64-osx,
os: macos-13,
extraCMakeFlags: "-DUSE_LEGACY_BOOST=ON"
}

steps:
- uses: actions/checkout@v4

- name: show gitref / tags
run: echo ${{ github.ref }} ${{needs.pre-build.outputs.current_branch_tag}} ${{needs.pre-build.outputs.is_tag}}

- name: install Mercurial on MacOS
if: runner.os == 'MacOS'
run: pip3 install mercurial --break-system-packages

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build ${{matrix.config.extraCMakeFlags}} -DPLUGIN_VERSION="${{needs.pre-build.outputs.current_branch_tag}}" -DSTATIC_BUILD=ON -DALLOW_DOWNLOADS=ON -DUSE_SYSTEM_ORTHANC_SDK=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
env:
MAKEFLAG: -j4

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
env:
MAKEFLAG: -j4

- name: Upload
uses: actions/[email protected]
with:
path: ${{github.workspace}}/build/${{matrix.config.artifactPath}}
name: ${{matrix.config.artifact}}
if-no-files-found: error

- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
timeout-minutes: 20


release:
needs: [build, pre-build]
if: needs.pre-build.outputs.is_tag == 'true'
runs-on: ubuntu-latest

steps:
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ needs.pre-build.outputs.current_branch_tag }}
name: Release ${{ needs.pre-build.outputs.current_branch_tag }}
draft: false
prerelease: false

- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- name: Upload release url artifact
uses: actions/[email protected]
with:
path: ./upload_url
name: upload_url
if-no-files-found: error


publish:
name: ${{ matrix.config.name }}
needs: [pre-build, release]
if: needs.pre-build.outputs.is_tag == 'true'
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
artifact: "AdvancedStorage.dll",
artifact_name: "AdvancedStorage-win64.dll",
os: ubuntu-latest
}
- {
name: "Ubuntu",
artifact: "libAdvancedStorage.so",
artifact_name: "libAdvancedStorage-ubuntu.so",
os: ubuntu-latest
}
- {
name: "MacOSX",
artifact: "libAdvancedStorage.dylib",
artifact_name: "libAdvancedStorage-universal.dylib",
os: ubuntu-latest
}

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.config.artifact }}
path: ./

- name: Download URL
uses: actions/download-artifact@v4
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo "upload_url=$upload_url" >> $GITHUB_OUTPUT
- name: Upload to Release
id: upload_to_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ matrix.config.artifact }}
asset_name: ${{ matrix.config.artifact_name }}
asset_content_type: application/octet-stream
32 changes: 31 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
- add unit test project
- add unit test project

TODO_CUSTOM_DATA branch
- add REVISIONS in AttachedFiles + Metadata in SQLite since we change the DB schema
- add revisions and customData in all Database plugins
- refuse to instantiate a PluginStorage3 if a DBv4 is not instantiated !
- handle all TODO_CUSTOM_DATA
- check /attachments/... routes for path returned
- AdvancedStoragePlugin
- show warning if a tag is missing when generating the path from tags (+ option to disable this warning)
- generate path from tags from resource (CreateAttachment)
- add an instanceId or parentSeriesId arg in CreateInstance ?
- implement a 'legacy' root path to group all files with missing tags or path too long
- avoid error AdvancedStorage - Path to the default storage area should be an absolute path '"OrthancStorage"' when using PG and no StorageDirectory has been defined
- document that, once you have used the AdvancedStoragePlugin and stored DICOM files, you can not downgrade Orthanc to a previous Orthanc
without loosing access to the DICOM files
- write integration test for advanced-storage:
- launch 1.12.6
- upload 1 file
- launch 1.12.7 with advanced-storage plugin with a non default namingScheme
- upload 1 file
- access + delete initial file

- write integration test for transitions from one DB to the other (for each DB plugin):
- launch 1.11.2,
- upload 2 files,
- launch 1.12.0,
- access + delete one file,
- upload one file,
- launch 1.11.2 again,
- access + delete last 2 files

0 comments on commit 748a9f5

Please sign in to comment.