Skip to content

update tests

update tests #27

Workflow file for this run

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 "build-name=${{ github.ref_name == 'master' && 'latest' || 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 ${{ steps.strings.outputs.mingw-dir }}/bin/*.dll ${{ 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-${{ steps.strings.outputs.build-name }}-installer-x86_64.exe
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: nfc-spy-${{ steps.strings.outputs.build-name }}-installer-x86_64.exe
path: ${{ steps.strings.outputs.build-dir }}/nfc-spy-${{ steps.strings.outputs.build-name }}-installer-x86_64.exe
- name: 'Create release'
if: startsWith(github.ref, 'refs/tags/')
uses: actions/create-release@v1
id: create-release
with:
draft: false
prerelease: false
release_name: ${{ github.ref }}
tag_name: ${{ github.ref }}
body: |
This is the release for version ${{ github.ref }}.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Upload release'
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: nfc-spy-${{ steps.strings.outputs.build-name }}-installer-x86_64.exe
asset_path: ${{ steps.strings.outputs.build-dir }}/nfc-spy-${{ steps.strings.outputs.build-name }}-installer-x86_64.exe
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}