2021-11-19 11:22:27 +03:00
|
|
|
name: Windows
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
|
|
|
runs-on: windows-latest
|
|
|
|
|
|
|
|
steps:
|
2023-11-23 16:33:04 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-11-19 11:22:27 +03:00
|
|
|
|
2023-08-25 11:23:59 +03:00
|
|
|
- name: Read variables from repo
|
|
|
|
shell: bash
|
|
|
|
run: cat .github/workflows/env >> $GITHUB_ENV
|
|
|
|
|
2022-05-13 11:46:36 +03:00
|
|
|
- name: Check app versions
|
|
|
|
run: |
|
|
|
|
python set-version.py
|
|
|
|
git diff --exit-code
|
|
|
|
|
2023-11-29 12:41:45 +03:00
|
|
|
- name: Set up Python
|
2023-12-12 13:06:27 +03:00
|
|
|
uses: actions/setup-python@v5
|
2023-11-29 12:41:45 +03:00
|
|
|
with:
|
|
|
|
python-version: ${{ env.PYVER }}
|
|
|
|
|
|
|
|
- name: Update pip
|
|
|
|
run: python -m pip install --upgrade pip
|
|
|
|
|
2022-11-24 18:33:37 +03:00
|
|
|
- name: Cache helper
|
|
|
|
id: cache-helper
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
build/windows/helper
|
|
|
|
assets/licenses/helper.json
|
|
|
|
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
|
|
|
|
|
2023-11-29 12:41:45 +03:00
|
|
|
- name: Build the Helper
|
2022-11-24 18:33:37 +03:00
|
|
|
if: steps.cache-helper.outputs.cache-hit != 'true'
|
2021-11-19 11:22:27 +03:00
|
|
|
run: |
|
|
|
|
pip install poetry
|
2023-11-29 12:41:45 +03:00
|
|
|
.\build-helper.bat
|
2022-11-18 12:12:14 +03:00
|
|
|
|
2022-04-27 15:42:05 +03:00
|
|
|
- uses: subosito/flutter-action@v2
|
2021-11-19 11:22:27 +03:00
|
|
|
with:
|
2022-05-12 09:36:47 +03:00
|
|
|
channel: 'stable'
|
2023-08-25 11:23:59 +03:00
|
|
|
flutter-version: ${{ env.FLUTTER }}
|
2021-11-19 11:22:27 +03:00
|
|
|
- run: flutter config --enable-windows-desktop
|
|
|
|
- run: flutter --version
|
|
|
|
|
2023-11-29 12:41:45 +03:00
|
|
|
- name: Run lints/tests
|
2023-11-30 19:48:04 +03:00
|
|
|
env:
|
|
|
|
SKIP: ${{ steps.cache-helper.outputs.cache-hit == 'true' && 'mypy,flake8,black,bandit' || ''}}
|
2023-11-29 12:41:45 +03:00
|
|
|
run: |
|
|
|
|
pip install pre-commit
|
|
|
|
pre-commit run --all-files
|
|
|
|
flutter test
|
|
|
|
|
2023-11-30 13:25:20 +03:00
|
|
|
- name: Build the app
|
|
|
|
run: |
|
|
|
|
$version = python set-version.py | select-object -first 1
|
|
|
|
flutter build windows --build-name=$version
|
|
|
|
|
2022-04-04 16:43:04 +03:00
|
|
|
- name: Check generated files
|
2022-04-22 17:44:48 +03:00
|
|
|
run: git diff -I '.*android.*flutter_plugins.*qrscanner_zxing' --exit-code
|
2022-04-04 16:43:04 +03:00
|
|
|
|
2022-03-04 13:00:41 +03:00
|
|
|
- name: Move .dll files
|
|
|
|
run: |
|
2023-11-24 13:36:36 +03:00
|
|
|
$dest = "build\windows\x64\runner\Release"
|
2023-10-05 20:13:58 +03:00
|
|
|
cp $dest\helper\_internal/MSVCP140.dll $dest\
|
|
|
|
cp $dest\helper\_internal/VCRUNTIME140.dll $dest\
|
|
|
|
cp $dest\helper\_internal/VCRUNTIME140_1.dll $dest\
|
2022-03-04 13:00:41 +03:00
|
|
|
|
|
|
|
- name: Create an unsigned .msi installer package
|
|
|
|
run: |
|
|
|
|
$env:PATH += ";$env:WIX\bin"
|
2023-11-24 13:36:36 +03:00
|
|
|
$env:SRCDIR = "build\windows\x64\runner\Release\"
|
|
|
|
heat dir .\build\windows\x64\runner\Release\ -out fragment.wxs -gg -scom -srd -sfrag -dr INSTALLDIR -cg ApplicationFiles -var env.SRCDIR
|
2022-03-04 13:00:41 +03:00
|
|
|
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
|
|
|
|
|
2021-11-19 11:22:27 +03:00
|
|
|
- name: Rename and archive app bundle
|
|
|
|
run: |
|
|
|
|
$arr = $env:GITHUB_REF -split '/'
|
|
|
|
$branch = $arr[2]
|
|
|
|
$dest = "deploy\yubioath-desktop-$branch-windows"
|
|
|
|
mkdir $dest
|
2023-11-24 13:36:36 +03:00
|
|
|
mv build\windows\x64\runner\Release\* $dest\
|
2022-03-04 13:00:41 +03:00
|
|
|
mv yubioath-desktop.msi deploy
|
2022-11-11 13:22:34 +03:00
|
|
|
mv resources\win\release-win.ps1 deploy
|
2022-11-11 14:55:00 +03:00
|
|
|
mv resources deploy
|
2021-11-19 11:22:27 +03:00
|
|
|
|
|
|
|
- name: Upload artifact
|
2023-12-18 15:15:56 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-11-19 11:22:27 +03:00
|
|
|
with:
|
|
|
|
name: yubioath-desktop-windows
|
|
|
|
path: deploy
|