Skip to content

feat: cross platform tracing #131

feat: cross platform tracing

feat: cross platform tracing #131

Workflow file for this run

name: Build artifacts
on:
push:
branches: [ master ]
tags:
- 'v*'
pull_request:
branches: [ master ]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- name: Install Qt environment
uses: jurplel/install-qt-action@v3
with:
version: '6.7.0'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
install-deps: 'true'
cache: 'true'
tools: 'tools_opensslv3_x64 tools_ifw'
modules: 'qtlocation qtpositioning'
- name: Checkout codes
uses: actions/checkout@v4
- name: Build exectuable
shell: cmd
run: |
for /f "delims=" %%d in ( 'vswhere.exe -latest -property installationPath' ) do @( call "%%d\VC\Auxiliary\Build\vcvars64.bat" )
qmake "CONFIG+=qtquickcompiler" CONFIG+=release
nmake
- name: Set short SHA as package name
if: "!startsWith(github.event.ref, 'refs/tags/')"
run: echo "ARCHIVE_NAME=NyaTrace-$(git rev-parse --short HEAD)-MSVC-64bit" >> $env:GITHUB_ENV
- name: Set tag version into env
if: startsWith(github.event.ref, 'refs/tags/')
run: echo "TAG_NAME=${env:GITHUB_REF_NAME}" >> $env:GITHUB_ENV
- name: Set tag version as package name
if: startsWith(github.event.ref, 'refs/tags/')
run: echo "ARCHIVE_NAME=NyaTrace-${env:TAG_NAME}-MSVC-64bit" >> $env:GITHUB_ENV
- name: Prepare workspace
shell: pwsh
run: |
# Prepare workspace dir
New-Item -ItemType Directory workspace
# Prepare target dir
New-Item -ItemType Directory workspace\${env:ARCHIVE_NAME}
# Copy executable
Copy-Item release\NyaTrace.exe workspace\${env:ARCHIVE_NAME}\
- name: Win Deploy Qt
shell: cmd
run: |
call "%Qt6_DIR%\bin\qtenv2.bat"
for /f "delims=" %%d in ( 'vswhere.exe -latest -property installationPath' ) do @( call "%%d\VC\Auxiliary\Build\vcvars64.bat" )
chdir /d %GITHUB_WORKSPACE%\workspace\%ARCHIVE_NAME%
windeployqt --qmldir %GITHUB_WORKSPACE% --release NyaTrace.exe
- name: Move VC Redist installer out (no need to pack into installer)
shell: pwsh
run: |
Move-Item workspace\${env:ARCHIVE_NAME}\vc_redist.x64.exe workspace\
- name: Upload vc_redist
uses: actions/upload-artifact@v4
with:
name: vc_redist.x64.exe
path: workspace\vc_redist.x64.exe
- name: Prepare theme files
shell: pwsh
run: |
Copy-Item -Recurse theme workspace\${env:ARCHIVE_NAME}\
- name: Prepare icon file
shell: pwsh
run: |
Copy-Item icon.ico workspace\${env:ARCHIVE_NAME}\
- name: Prepare MMDB notices
shell: pwsh
run: |
New-Item -ItemType Directory workspace\${env:ARCHIVE_NAME}\mmdb
$mmdbNotice = '请将 MMDB 文件放置在这里,具体操作请参见 https://github.com/Candinya/NyaTrace 相关的说明。'
$mmdbNotice | Out-File workspace\${env:ARCHIVE_NAME}\mmdb\'请将 MMDB 文件放置在这里.txt'
- name: Prepare OpenSSL DLLs
shell: pwsh
run: |
Copy-Item ${env:IQTA_TOOLS}'\OpenSSLv3\Win_x64\bin\lib*-x64.dll' workspace\${env:ARCHIVE_NAME}\
- name: Prepare AGPL-3.0 license file
shell: pwsh
run: |
Copy-Item AGPL-3.0.txt LICENSE
- name: Package artifacts
shell: pwsh
run: |
Compress-Archive -Path workspace\${env:ARCHIVE_NAME}, LICENSE, workspace\vc_redist.x64.exe -DestinationPath ${env:ARCHIVE_NAME}'.zip'
- name: Upload built zip
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}.zip
path: ${{ env.ARCHIVE_NAME }}.zip
- name: Create installer
shell: pwsh
run: |
New-Item -ItemType Directory installer\packages\net.candymade.nyatrace\data
Copy-Item -Recurse workspace\${env:ARCHIVE_NAME}\* installer\packages\net.candymade.nyatrace\data\
& "${env:IQTA_TOOLS}\QtInstallerFramework\4.7\bin\binarycreator.exe" -c installer\config\config.xml -p installer\packages ${{ env.ARCHIVE_NAME }}-Installer.exe -v
- name: Upload built installer
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}-Installer.exe
path: ${{ env.ARCHIVE_NAME }}-Installer.exe
- name: Move VC Redist installer out (let release action find it)
if: startsWith(github.event.ref, 'refs/tags/')
shell: pwsh
run: |
Move-Item workspace\vc_redist.x64.exe .\
- name: Create release (draft)
if: startsWith(github.event.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
name: NyaTrace - ${{ env.TAG_NAME }}
tag_name: ${{ env.TAG_NAME }}
generate_release_notes: true
draft: true
files: |
${{ env.ARCHIVE_NAME }}.zip
${{ env.ARCHIVE_NAME }}-Installer.exe
vc_redist.x64.exe
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}