deploy test 32 #16
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
name: CMake for windows platform | |
on: | |
push: | |
tags: | |
- '*' # any tag | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
build_type: [Release] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
echo "build-version=${{ github.ref_name == 'master' && '0.0.0' || github.ref_name }}" >> "$GITHUB_OUTPUT" | |
echo "qt-dir=${{ github.workspace }}/qt/6.7.2/mingw_64" >> "$GITHUB_OUTPUT" | |
echo "ninja-dir=${{ github.workspace }}/tools/ninja" >> "$GITHUB_OUTPUT" | |
echo "cmake-dir=${{ github.workspace }}/tools/cmake_64" >> "$GITHUB_OUTPUT" | |
echo "mingw-dir=${{ github.workspace }}/tools/mingw1310_64" >> "$GITHUB_OUTPUT" | |
echo "installer-dir=${{ github.workspace }}/tools/QtInstallerFramework/4.7" >> "$GITHUB_OUTPUT" | |
echo "package-dir=${{ github.workspace }}/build/installer/package" >> "$GITHUB_OUTPUT" | |
echo "package-data-dir=${{ github.workspace }}/build/installer/package/org.josevcm.nfc-spy/data" >> "$GITHUB_OUTPUT" | |
echo "package-meta-dir=${{ github.workspace }}/build/installer/package/org.josevcm.nfc-spy/meta" >> "$GITHUB_OUTPUT" | |
echo "cpu-count=4" >> "$GITHUB_OUTPUT" | |
- name: Cache dependencies | |
id: cache-dependencies | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-qt-dependencies | |
path: | | |
${{ github.workspace }}/qt | |
${{ github.workspace }}/tools | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: | | |
choco install aqt -y --no-progress -r | |
aqt install-qt windows desktop 6.7.2 win64_mingw --outputdir ${{ github.workspace }}/qt | |
aqt install-tool windows desktop tools_mingw1310 qt.tools.win64_mingw1310 --outputdir ${{ github.workspace }} | |
aqt install-tool windows desktop tools_cmake qt.tools.cmake --outputdir ${{ github.workspace }} | |
aqt install-tool windows desktop tools_ninja qt.tools.ninja --outputdir ${{ github.workspace }} | |
aqt install-tool windows desktop tools_ifw qt.tools.ifw.47 --outputdir ${{ github.workspace }} | |
- name: Configure project | |
run: | | |
${{ steps.strings.outputs.cmake-dir }}/bin/cmake ` | |
-S ${{ github.workspace }} ` | |
-B ${{ steps.strings.outputs.build-dir }} ` | |
-G Ninja ` | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` | |
-DCMAKE_PREFIX_PATH=${{ steps.strings.outputs.qt-dir }} ` | |
-DCMAKE_C_COMPILER=${{ steps.strings.outputs.mingw-dir }}/bin/gcc.exe ` | |
-DCMAKE_CXX_COMPILER=${{ steps.strings.outputs.mingw-dir }}/bin/g++.exe ` | |
-DCMAKE_MAKE_PROGRAM=${{ steps.strings.outputs.ninja-dir }}/ninja.exe ` | |
-DBUILD_PROJECT_VERSION="${{ steps.strings.outputs.build-version }}" | |
- name: Build project | |
run: | | |
${{ steps.strings.outputs.cmake-dir }}/bin/cmake ` | |
--build ${{ steps.strings.outputs.build-dir }} ` | |
--target nfc-spy --parallel ${{ steps.strings.outputs.cpu-count }} | |
- name: Create installer | |
run: | | |
# create installer folders | |
New-Item -Force -ItemType "directory" -Path ${{ steps.strings.outputs.package-data-dir }} | |
New-Item -Force -ItemType "directory" -Path ${{ steps.strings.outputs.package-meta-dir }} | |
# copy executable and libraries | |
Copy-Item -Force ${{ steps.strings.outputs.build-dir }}/src/nfc-app/app-qt/nfc-spy.exe ${{ steps.strings.outputs.package-data-dir }} | |
Copy-Item -Force ${{ github.workspace }}/dll/usb-1.0.26/x86_64/bin/*.dll ${{ steps.strings.outputs.package-data-dir }} | |
Copy-Item -Force ${{ github.workspace }}/dll/openssl-1.1.1/x86_64/bin/*.dll ${{ steps.strings.outputs.package-data-dir }} | |
# copy drivers and firmware | |
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/config ${{ steps.strings.outputs.package-data-dir }} | |
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/drivers ${{ steps.strings.outputs.package-data-dir }} | |
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/firmware ${{ steps.strings.outputs.package-data-dir }} | |
# copy installer resources | |
Copy-Item -Force ${{ steps.strings.outputs.build-dir }}/installer/config/*.* ${{ steps.strings.outputs.package-meta-dir }} | |
# create deployment | |
${{ steps.strings.outputs.qt-dir }}/bin/windeployqt ` | |
--verbose 1 ` | |
--compiler-runtime ` | |
--no-translations ` | |
--no-system-d3d-compiler ` | |
--no-opengl-sw ` | |
${{ steps.strings.outputs.package-data-dir }}/nfc-spy.exe | |
# create installer | |
${{ steps.strings.outputs.installer-dir }}/bin/binarycreator ` | |
--verbose ` | |
-c ${{ steps.strings.outputs.build-dir }}/installer/config/config.xml ` | |
-p ${{ steps.strings.outputs.package-dir }} ` | |
${{ steps.strings.outputs.build-dir }}/nfc-spy-${{ github.ref_name }}-installer-x86_64.exe |