Skip to content

release test

release test #28

Workflow file for this run

name: Multiplatform Build and Release
on:
push:
tags:
- '*' # any tag
branches:
- develop
- feature/*
jobs:
build-linux:
runs-on: ubuntu-latest
outputs:
artifact-name: linux-artifact
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Set reusable strings'
id: strings-linux
shell: bash
run: |
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "build-name=${{ (github.ref_name == 'master' || github.ref_name == 'develop' || startsWith(github.ref_name, 'feature')) && 'latest' || github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "build-version=${{ (github.ref_name == 'master' || github.ref_name == 'develop' || startsWith(github.ref_name, 'feature')) && '0.0.0' || github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "cpu-count=4" >> "$GITHUB_OUTPUT"
- name: 'Install dependencies'
run: |
sudo apt update
sudo apt install -y build-essential debhelper-compat cmake qt6-base-dev libusb-1.0-0-dev zlib1g-dev libgl1-mesa-dev libairspy-dev librtlsdr-dev
- name: 'Build project'
run: |
dpkg-buildpackage -us -uc -j${{ steps.strings-linux.outputs.cpu-count }}
- name: Show output files
run: ls -lh ..
# - name: 'Upload artifact'
# uses: actions/upload-artifact@v4
# with:
# name: nfc-lab-${{ steps.strings-windows.outputs.build-name }}-installer-x86_64.exe
# path: ${{ steps.strings-windows.outputs.build-dir }}/nfc-lab-${{ steps.strings-windows.outputs.build-name }}-installer-x86_64.exe
build-windows:
runs-on: windows-latest
outputs:
artifact-name: windows-artifact
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Set reusable strings'
id: strings-windows
shell: bash
run: |
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "build-name=${{ (github.ref_name == 'master' || github.ref_name == 'develop' || startsWith(github.ref_name, 'feature')) && 'latest' || github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "build-version=${{ (github.ref_name == 'master' || github.ref_name == 'develop' || startsWith(github.ref_name, 'feature')) && '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-lab/data" >> "$GITHUB_OUTPUT"
echo "package-meta-dir=${{ github.workspace }}/build/installer/package/org.josevcm.nfc-lab/meta" >> "$GITHUB_OUTPUT"
echo "cpu-count=4" >> "$GITHUB_OUTPUT"
- name: 'Cache dependencies'
id: cache-dependencies
uses: actions/cache@v4
with:
key: windows-latest-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: 'Build project'
run: |
${{ steps.strings-windows.outputs.cmake-dir }}/bin/cmake `
-S ${{ github.workspace }} `
-B ${{ steps.strings-windows.outputs.build-dir }} `
-G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
-DCMAKE_PREFIX_PATH=${{ steps.strings-windows.outputs.qt-dir }} `
-DCMAKE_C_COMPILER=${{ steps.strings-windows.outputs.mingw-dir }}/bin/gcc.exe `
-DCMAKE_CXX_COMPILER=${{ steps.strings-windows.outputs.mingw-dir }}/bin/g++.exe `
-DCMAKE_MAKE_PROGRAM=${{ steps.strings-windows.outputs.ninja-dir }}/ninja.exe `
-DBUILD_PROJECT_VERSION="${{ steps.strings-windows.outputs.build-version }}"
${{ steps.strings-windows.outputs.cmake-dir }}/bin/cmake `
--build ${{ steps.strings-windows.outputs.build-dir }} `
--target nfc-lab --parallel ${{ steps.strings-windows.outputs.cpu-count }}
- name: 'Create installer'
run: |
# create installer folders
New-Item -Force -ItemType "directory" -Path ${{ steps.strings-windows.outputs.package-data-dir }}
New-Item -Force -ItemType "directory" -Path ${{ steps.strings-windows.outputs.package-meta-dir }}
# copy executable and libraries
Copy-Item -Force ${{ steps.strings-windows.outputs.build-dir }}/src/nfc-app/app-qt/nfc-lab.exe ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force ${{ steps.strings-windows.outputs.mingw-dir }}/bin/*.dll ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force ${{ github.workspace }}/dll/airspy/x86_64/bin/*.dll ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force ${{ github.workspace }}/dll/openssl/x86_64/bin/*.dll ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force ${{ github.workspace }}/dll/rtlsdr/x86_64/bin/*.dll ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force ${{ github.workspace }}/dll/usb/x86_64/bin/*.dll ${{ steps.strings-windows.outputs.package-data-dir }}
# copy drivers and firmware
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/config ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/drivers ${{ steps.strings-windows.outputs.package-data-dir }}
Copy-Item -Force -Recurse ${{ github.workspace }}/dat/firmware ${{ steps.strings-windows.outputs.package-data-dir }}
# copy installer resources
Copy-Item -Force ${{ steps.strings-windows.outputs.build-dir }}/installer/config/*.* ${{ steps.strings-windows.outputs.package-meta-dir }}
# create deployment
${{ steps.strings-windows.outputs.qt-dir }}/bin/windeployqt `
--verbose 1 `
--compiler-runtime `
--no-translations `
--no-system-d3d-compiler `
--no-opengl-sw `
${{ steps.strings-windows.outputs.package-data-dir }}/nfc-lab.exe
# create installer
${{ steps.strings-windows.outputs.installer-dir }}/bin/binarycreator `
--verbose `
-c ${{ steps.strings-windows.outputs.build-dir }}/installer/config/config.xml `
-p ${{ steps.strings-windows.outputs.package-dir }} `
${{ steps.strings-windows.outputs.build-dir }}/nfc-lab-${{ steps.strings-windows.outputs.build-name }}-installer-x86_64.exe
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: nfc-lab-${{ steps.strings-windows.outputs.build-name }}-installer-x86_64.exe
path: ${{ steps.strings-windows.outputs.build-dir }}/nfc-lab-${{ steps.strings-windows.outputs.build-name }}-installer-x86_64.exe
create-release:
runs-on: ubuntu-latest
needs:
- build-linux
- build-windows
steps:
# - name: Download Linux Artifact
# uses: actions/download-artifact@v4
# with:
# name: linux-artifact
# path: ./release
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: windows-artifact
path: ./release
- name: 'Create release (Tag)'
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v2
id: create-release-tag
with:
draft: false
prerelease: false
name: Latest Build ${{ github.run_number }}
tag_name: Latest-${{ github.run_number }}
files: ./release/*
body: |
This is the release build for version ${{ github.ref }}.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Create release (Snapshot)'
if: github.ref_type != 'tag'
uses: softprops/action-gh-release@v2
id: create-release-snapshot
with:
draft: false
prerelease: true
name: Latest Build ${{ github.run_number }}
tag_name: Latest-${{ github.run_number }}
files: ./release/*
body: |
This is the latest snapshot build for version ${{ github.ref }}.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: 'Create release (Common)'
# 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 (Windows)'
# if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_name: nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# asset_path: ${{ steps.strings-common.outputs.build-dir }}/nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# asset_content_type: application/octet-stream
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: 'Upload artifact (Windows)'
# if: runner.os == 'Windows'
# uses: actions/upload-artifact@v4
# with:
# name: nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# path: ${{ steps.strings-common.outputs.build-dir }}/nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# overwrite: true
# - name: 'Create release (Tag)'
# if: github.ref_type == 'tag'
# uses: softprops/action-gh-release@v2
# id: create-release
# with:
# draft: false
# prerelease: false
# name: Latest Build ${{ github.run_number }}
# tag_name: Latest-${{ github.run_number }}
# body: |
# This is the latest snapshot build for version ${{ github.ref }}.
# files: |
# ${{ steps.strings-common.outputs.build-dir }}/nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: 'Create release (Snapshot)'
# if: github.ref_type != 'tag'
# uses: softprops/action-gh-release@v2
# id: create-release
# with:
# draft: false
# prerelease: true
# name: Latest Build ${{ github.run_number }}
# tag_name: Latest-${{ github.run_number }}
# body: |
# This is the latest snapshot build for version ${{ github.ref }}.
# files: |
# ${{ steps.strings-common.outputs.build-dir }}/nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: 'Create release (Common)'
# 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 (Windows)'
# if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
# uses: actions/upload-release-asset@v1
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_name: nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# asset_path: ${{ steps.strings-common.outputs.build-dir }}/nfc-lab-${{ steps.strings-common.outputs.build-name }}-installer-x86_64.exe
# asset_content_type: application/octet-stream
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}