Skip to content

Jst/annulus

Jst/annulus #284

Workflow file for this run

name: build-windows
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
workflow_call:
env:
armadillo_version: 12.6.1
QWT_version: 6.1.6
openCV_version: 4.6.0
QT_version: 5.15.2
lapack_version: 3.11.0
mingw_version: 810
jobs:
cache-mingw-from-QT:
runs-on: windows-latest
steps:
# this will restore/cache everything in /Tools depending on cache hit/miss
- name: Cache minGW
id: cache-minGW
uses: actions/cache@v4
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
# all what follows is only run on cache miss
- name: install aqtinstall tool
if: steps.cache-minGW.outputs.cache-hit != 'true'
run: pip install aqtinstall
- name: install correct minGW version
if: steps.cache-minGW.outputs.cache-hit != 'true'
run: aqt install-tool windows desktop tools_mingw qt.tools.win64_mingw${{env.mingw_version}}
# path is Tools\mingw${{env.mingw_version}}_64\bin\
- name: install QT installer framework
if: steps.cache-minGW.outputs.cache-hit != 'true'
run: aqt install-tool windows desktop tools_ifw
# path is Tools\QtInstallerFramework\4.7\bin\
build-openCV-with-QT:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: Cache QT and openCV
uses: actions/cache/@v4
id: cache-openCV-QT
with:
path: |
build_openCV\install\x64\mingw\bin\*.dll
build_openCV\install\include\*
${{env.QT_version}}\mingw81_64\bin\*
${{env.QT_version}}\mingw81_64\include\*
${{env.QT_version}}\mingw81_64\lib\*
${{env.QT_version}}\mingw81_64\mkspecs\*
${{env.QT_version}}\mingw81_64\plugins\platforms\*
${{env.QT_version}}\mingw81_64\plugins\imageformats\*
key: ${{ runner.os }}-openCV-${{env.openCV_version}}-QT-${{env.QT_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- name: install aqtinstall tool
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: pip install aqtinstall
- name: install QT
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: aqt install-qt windows desktop ${{env.QT_version}} win64_mingw81 -m qtcharts qtdatavis3d
- uses: actions/checkout@v4
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
with:
repository: 'opencv/opencv'
ref: '${{env.openCV_version}}'
path: './openCV'
- name: cmake generate
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S openCV -B build_openCV -D WITH_QT=ON -D WITH_OPENGL=ON -D Qt5_DIR=:./${{env.QT_version}}/mingw81_64/lib/cmake/Qt5
- name: cmake generate again
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S openCV -B build_openCV
- name: cmake build
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake --build ./build_openCV -j4
- name: cmake install
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake --install ./build_openCV
build-QWT:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: cache QWT
uses: actions/cache/@v4
id: cache-QWT
with:
path: |
qwt-${{env.QWT_version}}\src
qwt-${{env.QWT_version}}\lib\*.dll
key: ${{ runner.os }}-QWT-${{env.QWT_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-QWT.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-QWT.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- name: install wget
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: choco install -y wget
- name: download QWT
if: steps.cache-QWT.outputs.cache-hit != 'true'
# I specified the mirror because one of the random mirrors did not work during my tests
run: wget -O qwt-${{env.QWT_version}}.zip https://sourceforge.net/projects/qwt/files/qwt/${{env.QWT_version}}/qwt-${{env.QWT_version}}.zip/download?use_mirror=pilotfiber
- name: extract archive
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: 7z x qwt-${{env.QWT_version}}.zip
- name: install aqtinstall tool
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: pip install aqtinstall
- name: install qmake
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: aqt install-qt windows desktop ${{env.QT_version}} win64_mingw81 --archives qtbase qtsvg
- name: qmake
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: cd qwt-${{env.QWT_version}} ; ..\${{env.QT_version}}\mingw81_64\bin\qmake.exe
- name: build
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: cd qwt-${{env.QWT_version}} ; mingw32-make -j4
build-armadillo:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: Cache armadillo build
id: cache-armadillo
uses: actions/cache@v4
with:
path: |
build_armadillo\libarmadillo.dll
build_armadillo\tmp\include
key: ${{ runner.os }}-armadillo-${{env.armadillo_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-armadillo.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-armadillo.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- name: install wget
if: steps.cache-armadillo.outputs.cache-hit != 'true'
run: choco install -y wget
- name: download armadillo
if: steps.cache-armadillo.outputs.cache-hit != 'true'
# I specified the mirror because one of the random mirrors did not work during my tests
run: wget -O armadillo-${{env.armadillo_version}}.tar.xz http://sourceforge.net/projects/arma/files/armadillo-${{env.armadillo_version}}.tar.xz/download?use_mirror=versaweb
# Extract in two step. First step write to stdo and second step read from stdi.
# This avoids intermediate file creation
# It must run in CMD because powershell corrupts pipes
- name: extract archive
if: steps.cache-armadillo.outputs.cache-hit != 'true'
run: 7z x -so armadillo-${{env.armadillo_version}}.tar.xz | 7z x -si -ttar
shell: cmd
- name: cmake generate
if: steps.cache-armadillo.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S armadillo-${{env.armadillo_version}} -B build_armadillo
- name: cmake build
if: steps.cache-armadillo.outputs.cache-hit != 'true'
run: cmake --build ./build_armadillo -j4
build-lapack:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: Cache lapack build
id: cache-lapack
uses: actions/cache@v4
with:
path: |
build_lapack\lib\liblapack.a
build_lapack\lib\libblas.a
key: ${{ runner.os }}-lapack-${{env.lapack_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-lapack.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-lapack.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- uses: actions/checkout@v4
if: steps.cache-lapack.outputs.cache-hit != 'true'
with:
repository: 'Reference-LAPACK/lapack'
ref: 'v${{env.lapack_version}}'
path: './lapack'
# remove test compiler because https://github.com/Reference-LAPACK/lapack/issues/305 not needed to create DLL
- name: cmake generate
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S lapack -B build_lapack -D TEST_FORTRAN_COMPILER=OFF
- name: cmake build
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: cmake --build ./build_lapack -j4
build-DFTFringe:
runs-on: windows-latest
needs: [cache-mingw-from-QT, build-lapack, build-armadillo, build-QWT, build-openCV-with-QT]
steps:
# because problem matcher will not work when chechout in a subfolder,
# checkout at root and then copy everything in folder.
# Match will be done in build folder, and file at root will be used to link the match
# Note checkouting twice is not working.
# This copy is done before adding any more file into folders
- uses: actions/checkout@v4
# with:
# path: 'DFTFringe'
# copy all files for problem matcher to work
- name: copy files into build folder (problem matcher workaround)
run: |
mkdir ".\DFTFringe"
Copy-Item ".\*" -Destination ".\DFTFringe" -Exclude @("DFTFringe") -Recurse
# restore cached minGW
- uses: actions/cache/restore@v4
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
# restore cached lapack
- uses: actions/cache/restore@v4
id: cache-lapack
with:
path: |
build_lapack\lib\liblapack.a
build_lapack\lib\libblas.a
key: ${{ runner.os }}-lapack-${{env.lapack_version}}
fail-on-cache-miss: true
# restore cached armadillo
- uses: actions/cache/restore@v4
id: cache-armadillo
with:
path: |
build_armadillo\libarmadillo.dll
build_armadillo\tmp\include
key: ${{ runner.os }}-armadillo-${{env.armadillo_version}}
fail-on-cache-miss: true
# restore cached QWT
- uses: actions/cache/restore@v4
id: cache-QWT
with:
path: |
qwt-${{env.QWT_version}}\src
qwt-${{env.QWT_version}}\lib\*.dll
key: ${{ runner.os }}-QWT-${{env.QWT_version}}
fail-on-cache-miss: true
# restore cached openCV and QT
- uses: actions/cache/restore@v4
id: cache-openCV-QT
with:
path: |
build_openCV\install\x64\mingw\bin\*.dll
build_openCV\install\include\*
${{env.QT_version}}\mingw81_64\bin\*
${{env.QT_version}}\mingw81_64\include\*
${{env.QT_version}}\mingw81_64\lib\*
${{env.QT_version}}\mingw81_64\mkspecs\*
${{env.QT_version}}\mingw81_64\plugins\platforms\*
${{env.QT_version}}\mingw81_64\plugins\imageformats\*
key: ${{ runner.os }}-openCV-${{env.openCV_version}}-QT-${{env.QT_version}}
fail-on-cache-miss: true
# this enables the problem matcher
- uses: ammaraskar/gcc-problem-matcher@master
# Update the 2 strings automatically
# MY_AUTOMATED_VERSION_STRING
# MY_AUTOMATED_DATE_STRING
- name: Put release name into a variable (pull request)
if: ${{ github.event_name == 'pull_request' }}
# suffix will be c18a74e0f4f4db36eddc66a68eb08e91cd6c6a1c_5108ce7c3ac60bec1e0867bb10c4497db67e3606
# Because build is a merge commit, clearly identifies the PR commit and base commit
run: |
echo "WORKFLOW_VERSION=${{github.event.pull_request.head.sha}}_${{github.event.pull_request.base.sha}}" >> $env:GITHUB_ENV
- name: Put release name into a variable (tag)
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
# suffix will be tag like v1.2.3 or v1.0.0-beta+exp.sha.5114f8512 as long as it respects semver
run: |
echo "WORKFLOW_VERSION=${{github.ref_name}}" >> $env:GITHUB_ENV
- name: Put release name into a variable (single commit)
if: ${{ !startsWith(github.event.ref, 'refs/tags/v') && github.event_name != 'pull_request'}}
# suffix will be commit sha 5108ce7c3ac60bec1e0867bb10c4497db67e3606
run: |
echo "WORKFLOW_VERSION=${{github.sha}}" >> $env:GITHUB_ENV
- name: Find and Replace MY_AUTOMATED_VERSION_STRING
run: |
echo "${{env.WORKFLOW_VERSION}}"
(Get-Content DFTFringe/DFTFringeInstaller/config/config.xml).replace('MY_AUTOMATED_VERSION_STRING', '${{env.WORKFLOW_VERSION}}') | Set-Content DFTFringe/DFTFringeInstaller/config/config.xml
(Get-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml).replace('MY_AUTOMATED_VERSION_STRING', '${{env.WORKFLOW_VERSION}}') | Set-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml
(Get-Content DFTFringe/DFTFringe.pro).replace('MY_AUTOMATED_VERSION_STRING', '${{env.WORKFLOW_VERSION}}') | Set-Content DFTFringe/DFTFringe.pro
- name: Put current date into a variable
run: |
$NOW=& Get-Date -format yyyy-MM-dd
echo "NOW=$NOW" >> $env:GITHUB_ENV
- name: Find and Replace MY_AUTOMATED_DATE_STRING
run: |
echo "${{env.NOW}}"
(Get-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml).replace('MY_AUTOMATED_DATE_STRING', '${{env.NOW}}') | Set-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml
- run: cd DFTFringe ; ..\${{env.QT_version}}\mingw81_64\bin\qmake.exe
- run: echo "::add-matcher::.github/matcher/uic_matcher.json"
- run: cd DFTFringe ; mingw32-make -j4
- run: echo "::remove-matcher owner=uic-problem-matcher::"
- name: copy needed dlls not found by windeployqt
run: |
Copy-Item ".\DFTFringe\Release\DFTFringe.exe.debug" -Destination ".\"
mkdir ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\DFTFringe\Release\DFTFringe.exe" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_calib3d460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_core460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_features2d460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_flann460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_highgui460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_imgcodecs460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_imgproc460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\qwt-${{env.QWT_version}}\lib\qwt.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\${{env.QT_version}}\mingw81_64\bin\Qt5OpenGL.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\DFTFringe\ColorMaps" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\ColorMaps" -Recurse
mkdir ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\res"
Copy-Item ".\DFTFringe\res\surface_LeY_icon.ico" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\res"
Copy-Item ".\DFTFringe\res\help" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\res\help" -Recurse
Copy-Item ".\DFTFringe\RevisionHistory.html" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
- name: automatically add QT dependencies with windeployqt
run: .\${{env.QT_version}}\mingw81_64\bin\windeployqt.exe DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\DFTFringe.exe
- name: make installer using QT installer framework
run: Tools\QtInstallerFramework\4.7\bin\binarycreator.exe -c DFTFringe\DFTFringeInstaller\config\config.xml -p DFTFringe\DFTFringeInstaller\packages DFTFringeInstaller_${{env.WORKFLOW_VERSION}}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: DFTFringe-windows-build-artifact
path: |
DFTFringeInstaller_${{env.WORKFLOW_VERSION}}.exe
DFTFringe.exe.debug