Update bootstrap #15
This file contains hidden or 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 GCC", artifact: "nanconvert-linux.tar.gz", | |
| os: ubuntu-18.04, | |
| cc: "gcc-10", cxx: "g++-10" | |
| } | |
| - { | |
| name: "macOS", artifact: "nanconvert-macos.tar.gz", | |
| os: macos-11, | |
| cc: "clang", cxx: "clang++" | |
| } | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| submodules: 'recursive' | |
| - name: Install GNU tar | |
| shell: bash | |
| run: | | |
| if [ "${{runner.os}}" == "macOS" ]; then | |
| brew install gnu-tar | |
| fi | |
| - name: Restore vcpkg binary cache | |
| id: cache | |
| uses: actions/cache@v2 | |
| 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: Save release | |
| run: | | |
| cd ${{github.workspace}} | |
| mv ./build/{nanconvert_bruker,nanconvert_dicom} ./ | |
| cp Scripts/{nanbruker,nanbruker_sge.qsub,nandicom} ./ | |
| ALL="nanconvert_bruker nanbruker nanbruker_sge.qsub nanconvert_dicom nandicom" | |
| 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: Upload | |
| uses: actions/upload-artifact@v1 | |
| with: | |
| path: ./${{matrix.config.artifact}} | |
| name: ${{matrix.config.artifact}} | |
| release: | |
| if: contains(github.ref, 'tags/v') | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1.0.0 | |
| env: | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| with: | |
| tag_name: ${{github.ref}} | |
| release_name: Release ${{github.ref}} | |
| draft: true | |
| prerelease: false | |
| - name: Store Release URL | |
| run: | | |
| echo "${{steps.create_release.outputs.upload_url}}" > ./upload_url | |
| - uses: actions/upload-artifact@v1 | |
| with: | |
| path: ./upload_url | |
| name: upload_url | |
| publish: | |
| if: contains(github.ref, 'tags/v') | |
| name: ${{matrix.config.name}} | |
| runs-on: ${{matrix.config.os}} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { | |
| name: "Ubuntu GCC", artifact: "nanconvert-linux.tar.gz", | |
| os: ubuntu-18.04 | |
| } | |
| - { | |
| name: "macOS", artifact: "nanconvert-macos.tar.gz", | |
| os: macos-11 | |
| } | |
| needs: release | |
| steps: | |
| - name: Download Artifact | |
| uses: actions/download-artifact@v1 | |
| with: | |
| name: ${{matrix.config.artifact}} | |
| path: ./ | |
| - name: Download URL | |
| uses: actions/download-artifact@v1 | |
| with: | |
| name: upload_url | |
| path: ./ | |
| - name: Set Upload URL | |
| id: set_upload_url | |
| run: | | |
| URL=`cat ./upload_url` | |
| echo ${URL} | |
| echo "::set-output name=upload_url::${URL}" | |
| - name: Upload to Release | |
| id: upload_to_release | |
| uses: actions/upload-release-asset@v1.0.1 | |
| 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 }} | |
| asset_content_type: application/gzip |