Migrate to github actions.

This commit is contained in:
Roman Telezhynskyi 2024-04-27 09:06:27 +03:00
parent 730c6d3de5
commit bb8ff04498
4 changed files with 277 additions and 64 deletions

231
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,231 @@
name: Windows build
on:
push:
branches:
- 'master'
- 'develop'
tags:
- 'v*'
pull_request:
branches:
- 'master'
- 'develop'
defaults:
run:
shell: cmd
env:
SOURCE_DIR: ${{ github.workspace }}
INSTALL_QT: 6.7.0
QBS_VERSION: 2.2.2
VALENTINA_VERSION: 0_7_52
ACCESS_TOKEN: ${{ secrets.DROPBOX_ACCESS_TOKEN }}
jobs:
Windows_Qt_6_7_MSVC_x64:
name: Windows Qt 6.7 (MSVC x64)
runs-on: windows-latest
env:
DEPLOY: 'true'
RUN_TESTS: 'true'
WITH_CRASH_REPORTING: 'True'
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.INSTALL_QT }}
host: 'windows'
target: 'desktop'
arch: win64_msvc2019_64
dir: ${{ runner.temp }}
modules: 'qtimageformats'
cache: true
tools: 'tools_cmake tools_opensslv3_x64'
setup-python: false
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
architecture: "x64"
cache: 'pip'
cache-dependency-path: '**/requirements-ci.txt'
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Install Python dependencies
run: |
python --version
python -m pip install --upgrade setuptools
python -m pip install -r share/requirements-ci.txt
- name: Cache Chocolatey
uses: actions/cache@v4
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
# This caches the cache, no need to make sure that this is invalidated
# chocolatey will do that for us.
key: chocolatey-cache
- name: Install Chocolatey dependencies
run: |
choco install qbs -y --version=${{ env.QBS_VERSION }}
qbs --version
- name: Find cl.exe
id: cl-path
shell: pwsh
run: |
function Locate-VSWhere {
$path = Get-Command 'vswhere' -ErrorAction SilentlyContinue
if ($path) {
$path.Path
} else {
Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio' 'Installer' 'vswhere'
}
}
function Locate-VS {
# vswhere doesn't search for Build Tools by default, God knows why.
# https://github.com/microsoft/vswhere/issues/22
$products = 'Community','Professional','Enterprise','BuildTools' | %{ "Microsoft.VisualStudio.Product.$_" }
$vswhere = Locate-VSWhere
& $vswhere -products $products -latest -format json | ConvertFrom-Json
}
function Locate-CLPath {
$vsInfo = Locate-VS
if ($vsInfo) {
$vsInstallPath = $vsInfo[0].installationPath
$clPath = Join-Path $vsInstallPath 'VC\Tools\MSVC'
$latestVersion = (Get-ChildItem -Path $clPath | Where-Object { $_.PSIsContainer } | Sort-Object -Property Name -Descending)[0].Name
$clPath = Join-Path $clPath $latestVersion
$clPath = Join-Path $clPath 'bin\Hostx64\x64\cl.exe'
return $clPath
} else {
Write-Output "Visual Studio not found."
return $null
}
}
$clPath = Locate-CLPath
echo "Found Cl at $clPath"
echo "cl-path=$clPath" >> $env:GITHUB_OUTPUT
# To cache Conan 1.x packages in GitHub Actions, you can save the .conan/data directory for every OS like this:
- name: Setup path to Conan home folder
run: echo CONAN_USER_HOME=${{ runner.temp }} >> ${{ github.env }}
- name: Cache Conan packages
uses: actions/cache@v4
with:
path: ${{ env.CONAN_USER_HOME }}\.conan\data
key: conan-packages-${{ runner.os }}-v1-${{ hashFiles('**/conanfile.py') }}
restore-keys: conan-packages-${{ runner.os }}-
# For Conan 2.0 setting conan_home=./.conan2 in the .conanrc file and saving .conan2/p directory seems to work as well.
- name: Before build
run: |
qbs-setup-toolchains --detect
qbs-setup-qt %Qt6_DIR%\bin\qmake.exe qt6
qbs-config defaultProfile qt6
qbs-setup-toolchains.exe --type msvc "${{ steps.cl-path.outputs.cl-path }}" msvc
qbs-config.exe profiles.qt6.baseProfile msvc
conan config install https://gist.github.com/dismine/0abab496338183c36661e635c2aeab8d.git
type ${{ env.CONAN_USER_HOME }}\.conan\settings.yml
conan profile new valentina
conan profile update settings.build_type=Release valentina
conan profile update settings.os=Windows valentina
conan profile update settings.arch=x86_64 valentina
conan profile update settings.compiler=msvc valentina
conan profile update settings.compiler.cppstd=17 valentina
conan profile update settings.compiler.runtime=dynamic valentina
conan profile update settings.compiler.runtime_type=Release valentina
conan profile update settings.compiler.version=192 valentina
qbs-config --list profiles
conan profile list
- name: Build Conan dependencies
run: conan install . -s os=Windows --build=missing -o with_crash_reporting=${{ env.WITH_CRASH_REPORTING }} -o with_xerces=True -pr=valentina
- name: Build Valentina
run: >
qbs build
-f valentina.qbs
-d ${{ runner.temp }}\build
config:release
qbs.installRoot:${{ runner.temp }}\build\install-root\valentina
profile:qt6
project.enableConan:true
project.conanWithCrashReporting:${{ env.WITH_CRASH_REPORTING }}
project.conanWithXerces:true
project.conanProfiles:valentina
modules.buildconfig.enablePCH:true
modules.windeployqt.compilerRuntime:true
modules.windeployqt.noCompilerRuntime:false
- name: Tests
if: env.RUN_TESTS == 'true'
run: qbs -p autotest-runner -d ${{ runner.temp }}\build profile:qt6 config:release
- name: Deploy symbols
if: env.WITH_CRASH_REPORTING == 'True'
shell: pwsh
run: |
$qmakeOutput = & "$env:Qt6_DIR\bin\qmake.exe" -query QT_VERSION
$majorMinorVersion = $qmakeOutput -replace '(\d+)\.(\d+).*', '$1_$2'
$env:CRASH_QT_VERSION = $majorMinorVersion
$env:CRASH_SHORT_SHA = git log --pretty=format:%h -n 1
./scripts/install_dump_sysms.ps1
& python ./scripts/symupload.py ${{ runner.temp }}\build\install-root\valentina $env:VALENTINA_VERSION g$env:CRASH_SHORT_SHA $env:CRASH_QT_VERSION --clean
- name: Create installer
if: github.event_name != 'pull_request' && env.DEPLOY == 'true'
run: >
qbs build
-f valentina.qbs
-d ${{ runner.temp }}\build
-p ValentinaSetup
config:release
qbs.installRoot:${{ runner.temp }}\build\install-root\valentina
profile:qt6
project.enableConan:true
project.conanWithCrashReporting:${{ env.WITH_CRASH_REPORTING }}
project.conanWithXerces:true
project.conanProfiles:valentina
modules.buildconfig.enablePCH:true
modules.windeployqt.compilerRuntime:true
modules.windeployqt.noCompilerRuntime:false
- name: Commit hash
id: commit
if: github.event_name != 'pull_request' && env.DEPLOY == 'true'
uses: prompt/actions-commit-hash@v3
- name: Deploy
if: github.event_name != 'pull_request' && env.DEPLOY == 'true'
shell: pwsh
env:
VALENTINA_BUILD_FOLDER: ${{ runner.temp }}\build
APPVEYOR_BUILD_FOLDER: ${{ env.SOURCE_DIR }}
APPVEYOR_REPO_BRANCH: ${{ github.base_ref || github.ref_name }}
APPVEYOR_REPO_COMMIT: ${{ steps.commit.outputs.hash }}
PYTHON: ${{ env.Python3_ROOT_DIR }}
TARGET_PLATFORM: "Windows10+"
ARCH: x64
COMPILER: msvc
QT_VERSION: Qt6_7
run: ./scripts/appveyor-deploy.ps1

View File

@ -47,53 +47,6 @@ environment:
VALENTINA_VERSION: 0_7_52 VALENTINA_VERSION: 0_7_52
matrix: matrix:
- job_name: Windows_Qt_6_7_(MSVC_x64)
job_group: 'Windows (qbs)'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
COMPILER: msvc
QT: Qt\6.7\msvc2019_64
QT_VERSION: Qt6_7
BUILD_SYSTEM: "qbs"
QMAKE: qmake.exe
ENABLE_PCH: true
MSVC_PATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.39.33519\\bin\\Hostx64\\x64"
VSINSTALLDIR: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\"
ARCH: x64
PYTHON: "C:\\Python311-x64"
TARGET_PLATFORM: "Windows10+"
CHOCOLATEY_PACKAGES: false
WINDEPLOYQT_BIN_PATH: "undefined"
WINDEPLOYQT_COMPILER_RUNTIME: "true"
WINDEPLOYQT_NO_COMPILER_RUNTIME: "false"
DEPLOY: true
RUN_TESTS: true
WITH_CRASH_REPORTING: True
# - job_name: Windows_Qt_6_7_(GCC_x64)
# job_group: 'Windows (qbs)'
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
# COMPILER: mingw
# COMPILER_CPPSTD: gnu17
# COMPILER_LIBCXX: libstdc++11
# QT: Qt\6.7\mingw_64
# QT_VERSION: Qt6_7
# BUILD_SYSTEM: "qbs"
# QMAKE: qmake.exe
# ENABLE_PCH: true
# GCC_VERSION: 13.2
# MINGW_PATH: C:\ProgramData\mingw64\mingw64\bin
# ARCH: x64
# PYTHON: "C:\\Python311-x64"
# TARGET_PLATFORM: "Windows10+"
# CHOCOLATEY_PACKAGES: true
# CHOCOLATEY_MINGW_VERSION: 13.2.0
# WINDEPLOYQT_BIN_PATH: "undefined"
# WINDEPLOYQT_COMPILER_RUNTIME: "false"
# WINDEPLOYQT_NO_COMPILER_RUNTIME: "true"
# DEPLOY: true
# RUN_TESTS: true
# WITH_CRASH_REPORTING: False
- job_name: MacOS_12_Qt_5_15 (qbs, multibundle) - job_name: MacOS_12_Qt_5_15 (qbs, multibundle)
job_group: 'MacOS_12 (qbs)' job_group: 'MacOS_12 (qbs)'
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
@ -273,10 +226,6 @@ environment:
matrix: matrix:
fast_finish: false fast_finish: false
exclude: exclude:
# - platform: x86
# job_name: Windows_Qt_6_7_(GCC_x64)
- platform: x86
job_name: Windows_Qt_6_7_(MSVC_x64)
- platform: x86 - platform: x86
job_name: Windows_Qt_5_15_(make_GCC_x64) job_name: Windows_Qt_5_15_(make_GCC_x64)
- platform: x86 - platform: x86
@ -419,11 +368,12 @@ for:
- conan profile list - conan profile list
- conan install . -s os=Windows --build=missing -o with_crash_reporting=%WITH_CRASH_REPORTING% -o with_xerces=True -pr=valentina - conan install . -s os=Windows --build=missing -o with_crash_reporting=%WITH_CRASH_REPORTING% -o with_xerces=True -pr=valentina
- git fetch --tags - git fetch --tags
- qbs build -f valentina.qbs -d %APPVEYOR_BUILD_FOLDER%\build --jobs %NUMBER_OF_PROCESSORS% config:release qbs.installRoot:%APPVEYOR_BUILD_FOLDER%\build\install-root\valentina profile:qt6 project.enableConan:true project.conanWithCrashReporting:%WITH_CRASH_REPORTING% project.conanWithXerces:true modules.buildconfig.enableCcache:false project.conanProfiles:valentina modules.buildconfig.enablePCH:%ENABLE_PCH% modules.windeployqt.windeployqtProgramBinPath:%WINDEPLOYQT_BIN_PATH% modules.windeployqt.compilerRuntime:%WINDEPLOYQT_COMPILER_RUNTIME% modules.windeployqt.noCompilerRuntime:%WINDEPLOYQT_NO_COMPILER_RUNTIME% - set VALENTINA_BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER%\build
- qbs build -f valentina.qbs -d %VALENTINA_BUILD_FOLDER% --jobs %NUMBER_OF_PROCESSORS% config:release qbs.installRoot:%VALENTINA_BUILD_FOLDER%\install-root\valentina profile:qt6 project.enableConan:true project.conanWithCrashReporting:%WITH_CRASH_REPORTING% project.conanWithXerces:true modules.buildconfig.enableCcache:false project.conanProfiles:valentina modules.buildconfig.enablePCH:%ENABLE_PCH% modules.windeployqt.windeployqtProgramBinPath:%WINDEPLOYQT_BIN_PATH% modules.windeployqt.compilerRuntime:%WINDEPLOYQT_COMPILER_RUNTIME% modules.windeployqt.noCompilerRuntime:%WINDEPLOYQT_NO_COMPILER_RUNTIME%
test_script: test_script:
- path - path
- if "%RUN_TESTS%" == "true" (qbs -p autotest-runner -d %APPVEYOR_BUILD_FOLDER%\build profile:qt6 config:release) - if "%RUN_TESTS%" == "true" (qbs -p autotest-runner -d %VALENTINA_BUILD_FOLDER% profile:qt6 config:release)
deploy_script: deploy_script:
- ps: | - ps: |
@ -435,8 +385,8 @@ for:
$env:CRASH_SHORT_SHA = git log --pretty=format:%h -n 1 $env:CRASH_SHORT_SHA = git log --pretty=format:%h -n 1
} }
- ps: scripts/install_dump_sysms.ps1 - ps: scripts/install_dump_sysms.ps1
- if "%WITH_CRASH_REPORTING%" == "True" (python scripts/symupload.py %APPVEYOR_BUILD_FOLDER%\build\install-root\valentina %VALENTINA_VERSION% g%CRASH_SHORT_SHA% %CRASH_QT_VERSION% --clean) - if "%WITH_CRASH_REPORTING%" == "True" (python scripts/symupload.py %VALENTINA_BUILD_FOLDER%\install-root\valentina %VALENTINA_VERSION% g%CRASH_SHORT_SHA% %CRASH_QT_VERSION% --clean)
- if "%DEPLOY%" == "true" (qbs build -f valentina.qbs -d %APPVEYOR_BUILD_FOLDER%\build -p ValentinaSetup --jobs %NUMBER_OF_PROCESSORS% config:release qbs.installRoot:%APPVEYOR_BUILD_FOLDER%\build\install-root\valentina profile:qt6 project.enableConan:true project.conanWithCrashReporting:%WITH_CRASH_REPORTING% project.conanWithXerces:true modules.buildconfig.enableCcache:false project.conanProfiles:valentina modules.buildconfig.enablePCH:%ENABLE_PCH% modules.windeployqt.windeployqtProgramBinPath:%WINDEPLOYQT_BIN_PATH% modules.windeployqt.compilerRuntime:%WINDEPLOYQT_COMPILER_RUNTIME% modules.windeployqt.noCompilerRuntime:%WINDEPLOYQT_NO_COMPILER_RUNTIME%) - if "%DEPLOY%" == "true" (qbs build -f valentina.qbs -d %VALENTINA_BUILD_FOLDER% -p ValentinaSetup --jobs %NUMBER_OF_PROCESSORS% config:release qbs.installRoot:%VALENTINA_BUILD_FOLDER%\install-root\valentina profile:qt6 project.enableConan:true project.conanWithCrashReporting:%WITH_CRASH_REPORTING% project.conanWithXerces:true modules.buildconfig.enableCcache:false project.conanProfiles:valentina modules.buildconfig.enablePCH:%ENABLE_PCH% modules.windeployqt.windeployqtProgramBinPath:%WINDEPLOYQT_BIN_PATH% modules.windeployqt.compilerRuntime:%WINDEPLOYQT_COMPILER_RUNTIME% modules.windeployqt.noCompilerRuntime:%WINDEPLOYQT_NO_COMPILER_RUNTIME%)
- ps: scripts/appveyor-deploy.ps1 - ps: scripts/appveyor-deploy.ps1
on_finish: on_finish:

View File

@ -1,18 +1,16 @@
$env:BUILD_FOLDER = "$env:APPVEYOR_BUILD_FOLDER\build"; $INSTALL_ROOT = "$env:VALENTINA_BUILD_FOLDER\install-root\valentina";
$env:INSTALL_ROOT = "$env:BUILD_FOLDER\install-root\valentina";
$type = "$env:TARGET_PLATFORM-$env:COMPILER-$env:ARCH-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT"; $type = "$env:TARGET_PLATFORM-$env:COMPILER-$env:ARCH-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT";
$file_name = "valentina-${type}.exe"; $file_name = "valentina-${type}.exe";
$portable_file_name = "valentina-portable-${type}.7z"; $portable_file_name = "valentina-portable-${type}.7z";
if($env:DEPLOY -eq "true") { if($env:DEPLOY -eq "true") {
Write-Host "[CI] Preparing installer." -ForegroundColor Green; Write-Host "[CI] Checking installer." -ForegroundColor Green;
$installerPath = "$env:INSTALL_ROOT\ValentinaInstaller.exe"; $installerPath = "$INSTALL_ROOT\ValentinaInstaller.exe";
if (-not (Test-Path $installerPath)) { if (-not (Test-Path $installerPath)) {
Write-Error -Message "[CI] Installer file not found at $installerPath" -Category InvalidResult; Write-Error -Message "[CI] Installer file not found at $installerPath" -Category InvalidResult;
exit 1; exit 1;
} }
Write-Host "[CI] Done." -ForegroundColor Green;
Write-Host "[CI] Starting cleaning." -ForegroundColor Green; Write-Host "[CI] Starting cleaning." -ForegroundColor Green;
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" clean $env:ACCESS_TOKEN; & $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" clean $env:ACCESS_TOKEN;
@ -24,7 +22,7 @@ if($env:DEPLOY -eq "true") {
} }
Write-Host "[CI] Uploading installer." -ForegroundColor Green; Write-Host "[CI] Uploading installer." -ForegroundColor Green;
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$env:INSTALL_ROOT\ValentinaInstaller.exe" "/0.7.x/Windows/$file_name"; & $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$INSTALL_ROOT\ValentinaInstaller.exe" "/0.7.x/Windows/$file_name";
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult; Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult;
exit 1; exit 1;
@ -33,8 +31,8 @@ if($env:DEPLOY -eq "true") {
} }
Write-Host "[CI] Starting packing." -ForegroundColor Green; Write-Host "[CI] Starting packing." -ForegroundColor Green;
Remove-Item -Path "$env:INSTALL_ROOT\ValentinaInstaller.exe"; Remove-Item -Path "$INSTALL_ROOT\ValentinaInstaller.exe";
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" pack "$env:INSTALL_ROOT" "$env:BUILD_FOLDER\install-root\$portable_file_name"; & $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" pack "$INSTALL_ROOT" "$env:VALENTINA_BUILD_FOLDER\install-root\$portable_file_name";
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult; Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult;
exit 1; exit 1;
@ -43,7 +41,7 @@ if($env:DEPLOY -eq "true") {
} }
Write-Host "[CI] Uploading portable bundle." -ForegroundColor Green; Write-Host "[CI] Uploading portable bundle." -ForegroundColor Green;
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$env:BUILD_FOLDER\install-root\$portable_file_name" "/0.7.x/Windows/$portable_file_name"; & $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$env:VALENTINA_BUILD_FOLDER\install-root\$portable_file_name" "/0.7.x/Windows/$portable_file_name";
if ($LastExitCode -ne 0) { if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult; Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult;
exit 1; exit 1;

34
share/requirements-ci.txt Normal file
View File

@ -0,0 +1,34 @@
bottle==0.12.25
Brotli==1.1.0
certifi==2024.2.2
charset-normalizer==3.3.2
colorama==0.4.6
conan==1.63.0
distro==1.8.0
dropbox==11.36.2
fasteners==0.19
idna==3.7
inflate64==1.0.0
Jinja2==3.1.3
MarkupSafe==2.1.5
multivolumefile==0.2.3
node-semver==0.6.1
patch-ng==1.17.4
pluginbase==1.0.1
ply==3.11
psutil==5.9.8
py7zr==0.21.0
pybcj==1.0.2
pycryptodomex==3.20.0
Pygments==2.17.2
PyJWT==2.8.0
pyppmd==1.1.0
python-dateutil==2.9.0.post0
PyYAML==6.0.1
pyzstd==0.15.10
requests==2.31.0
six==1.16.0
stone==3.3.3
texttable==1.7.0
tqdm==4.66.2
urllib3==1.26.18