yubioath-flutter/.github/workflows/windows-x64.yml
2020-03-05 08:53:42 +01:00

156 lines
6.2 KiB
YAML

name: windows 64 bit
on: [push, pull_request]
env:
PYTHON_VER: '3.8.2'
PYTHON_VER_DIRNAME: 'python38'
PYOTHERSIDE_VER: '1.5.9'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v1
with:
python-version: ${{ env.PYTHON_VER }}
architecture: 'x64'
- name: Install Qt
uses: jurplel/install-qt-action@v2.4.1
with:
version: '5.14.1'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2017_64'
aqtversion: '==0.8a3'
- name: Download dependencies
run: |
wget https://download.qt.io/official_releases/jom/jom.zip -OutFile jom.zip
wget https://github.com/thp/pyotherside/archive/$env:PYOTHERSIDE_VER.zip -OutFile pyotherside-$env:PYOTHERSIDE_VER.zip
wget https://developers.yubico.com/yubikey-personalization/Releases/ykpers-1.20.0-win64.zip -OutFile ykpers-1.20.0-win64.zip
wget https://developers.yubico.com/yubikey-personalization/Releases/ykpers-1.20.0-win64.zip.sig -OutFile ykpers-1.20.0-win64.zip.sig
wget https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z -OutFile libusb-1.0.22.7z
wget https://www.python.org/ftp/python/$env:PYTHON_VER/python-$env:PYTHON_VER-embed-amd64.zip -OutFile python-$env:PYTHON_VER-embed-amd64.zip
shell: powershell
- name: Fetch GPG keys
run: gpg --no-default-keyring --keyring yubico --keyserver hkps://keys.openpgp.org --recv-keys 0A3B0262BCA1705307D5FF06BCA00FD4B2168C0A
- name: Verify signature/checksums of downloaded files
run: |
sha256sum -c ./.github/workflows/windows-libs.sha256sum
gpg --no-default-keyring --keyring yubico --verify ykpers-1.20.0-win64.zip.sig ykpers-1.20.0-win64.zip
- name: Install swig
run: choco install swig
- name: Install jom
run: |
7z x jom.zip
- name: Prepare pyotherside
run: |
7z x pyotherside-$env:PYOTHERSIDE_VER.zip
cd pyotherside-$env:PYOTHERSIDE_VER
(Get-Content .\src\qmldir).replace('pyothersideplugin', 'pyothersideplugin1') | Set-Content .\src\qmldir
Clear-Content python.pri
Add-Content python.pri "PYTHON_CONFIG = python3-config`nQMAKE_LIBS += -LC:\hostedtoolcache\windows\Python\$env:PYTHON_VER\x64\libs -l$env:PYTHON_VER_DIRNAME`nQMAKE_CXXFLAGS += -IC:\hostedtoolcache\windows\Python\$env:PYTHON_VER\x64\include`n"
shell: powershell
- name: Build and install pyotherside
run: |
set PATH=D:\a\yubioath-desktop\yubioath-desktop\5.14.1\msvc2017_64\bin;D:\a\yubioath-desktop\yubioath-desktop;%PATH%
call C:\"Program Files (x86)\Microsoft Visual Studio"\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64
cd pyotherside-%PYOTHERSIDE_VER%
qmake
jom
jom install
shell: cmd
- name: Build app
run: |
set PATH=D:\a\yubioath-desktop\yubioath-desktop\5.14.1\msvc2017_64\bin;D:\a\yubioath-desktop\yubioath-desktop;%PATH%
call C:\"Program Files (x86)\Microsoft Visual Studio"\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64
qmake
jom
shell: cmd
- name: Run windeployqt
run: |
set PATH=D:\a\yubioath-desktop\yubioath-desktop\5.14.1\msvc2017_64\bin;D:\a\yubioath-desktop\yubioath-desktop;%PATH%
call C:\"Program Files (x86)\Microsoft Visual Studio"\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64
windeployqt .\release\yubioath-desktop.exe --qmldir=qml --no-translations --angle --release
shell: cmd
- name: Copy over files to release folder
shell: powershell
run: |
Copy-Item .\pymodules .\release -recurse
Get-ChildItem -File -Include *.pyc -Recurse | Remove-Item -Force
Get-ChildItem -Include __pycache__ -Recurse | Remove-Item -Force
Get-ChildItem -Include *.cpp -Recurse | Remove-Item -Force
Get-ChildItem -Include *.obj -Recurse | Remove-Item -Force
7z x ykpers-1.20.0-win64.zip
Copy-Item .\bin\*.dll .\release\pymodules\ykman\native -Force
7z x libusb-1.0.22.7z
Copy-Item .\MS64\dll\*.dll .\release\pymodules\ykman\native -Force
cd .\release
7z x ..\python-$env:PYTHON_VER-embed-amd64.zip
- name: Create .zip artifact
shell: powershell
run: |
$arr = $env:GITHUB_REF -split '/'
$branch = $arr[2]
7z a yubioath-desktop-$branch-win64.zip release
mkdir deploy
cp yubioath-desktop-$branch-win64.zip deploy
- name: Install Visual Studio C++ 2019 Redistributable MSMs
shell: cmd
run: |
choco install visualstudio2019community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Redist.MSM"
- name: Create an unsigned .msi installer package
run: |
$env:PATH += ";$env:WIX\bin"
$env:SRCDIR = ".\release\"
$env:MERGEDPATH = Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\*\MergeModules\Microsoft_VC142_CRT_x64.msm"
heat dir .\release -out fragment.wxs -gg -scom -srd -sfrag -dr INSTALLDIR -cg ApplicationFiles -var env.SRCDIR
candle .\fragment.wxs .\resources\win\yubioath-desktop.wxs -ext WixUtilExtension -arch x64
light fragment.wixobj yubioath-desktop.wixobj -ext WixUIExtension -ext WixUtilExtension -o yubioath-desktop.msi
cp yubioath-desktop.msi deploy
- name: Run installer
shell: cmd
run: |
msiexec /i yubioath-desktop.msi /quiet /l .\log.txt
cat .\log.txt
- name: Rename installer
shell: powershell
run: |
$arr = $env:GITHUB_REF -split '/'
$branch = $arr[2]
mv .\deploy\yubioath-desktop.msi .\deploy\yubioath-desktop-$branch-win64.msi
- name: Run GUI
shell: bash
run: |
./release/yubioath-desktop --version
./release/yubioath-desktop --help
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: yubioath-desktop-win64
path: deploy