Files
cutdex/.gitea/workflows/ci.yml
T

92 lines
3.8 KiB
YAML

name: Gitea CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
defaults:
run:
shell: pwsh
concurrency:
group: app-${{ gitea.ref }}
cancel-in-progress: true
env:
PYTHONUTF8: '1'
GIT_CONFIG_COUNT: '2'
GIT_CONFIG_KEY_0: core.autocrlf
GIT_CONFIG_VALUE_0: 'false'
GIT_CONFIG_KEY_1: core.eol
GIT_CONFIG_VALUE_1: lf
jobs:
build:
name: Windows x64 and Android
runs-on: cutdex-windows-x64
env:
GITEA_ACTOR: lingjhf
CUTDEX_GITEA_TOKEN: ${{ secrets.CUTDEX_GITEA_TOKEN }}
steps:
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
- name: Verify toolchains
run: |
$version = flutter --version --machine | ConvertFrom-Json
if ($version.frameworkVersion -ne '3.47.5') { throw 'Flutter 3.47.5 required.' }
flutter config --jdk-dir=$env:JAVA_HOME
if ($LASTEXITCODE -ne 0) { throw 'Flutter JDK setup failed.' }
- run: flutter pub get --enforce-lockfile
- run: dart analyze --fatal-infos
- run: flutter test --reporter expanded test packages/cutdex_ui/test packages/cutdex_native/test
- name: Validate update and release tooling
run: |
python -m unittest discover -s tool/gitea -p 'test_*.py'
if ($LASTEXITCODE -ne 0) { throw 'Release tooling tests failed.' }
python -m unittest discover -s tool/windows -p '*_unit.py'
if ($LASTEXITCODE -ne 0) { throw 'Update tooling tests failed.' }
- name: Bound Android build memory on the shared runner
run: |
$file = 'android/gradle.properties'
$properties = [IO.File]::ReadAllText($file).Replace('-Xmx8G', '-Xmx3G').Replace('MaxMetaspaceSize=4G', 'MaxMetaspaceSize=768m')
[IO.File]::WriteAllText($file, $properties + "`norg.gradle.workers.max=4`n")
- run: flutter build apk --release --flavor production --target-platform android-arm64,android-x64
- name: Build Windows from the pinned Gitea native release
run: |
Remove-Item Env:CUTDEX_WINDOWS_PATH, Env:CUTDEX_WINDOWS_PACKAGE_PATH -ErrorAction SilentlyContinue
flutter build windows --release --flavor production
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed.' }
- name: Prepare isolated packaging tools
run: |
python -m venv .build/package-tools
if ($LASTEXITCODE -ne 0) { throw 'Packaging environment setup failed.' }
& ./.build/package-tools/Scripts/python.exe -m pip install pefile==2024.8.26
if ($LASTEXITCODE -ne 0) { throw 'Packaging dependency installation failed.' }
- uses: https://github.com/actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1
with:
dotnet-version: '10.0.x'
- name: Install pinned Velopack release tool
run: |
dotnet tool install vpk --version 1.2.161 --tool-path .build/vpk
if ($LASTEXITCODE -ne 0) { throw 'Velopack tool installation failed.' }
- name: Package application
run: |
& ./.build/package-tools/Scripts/python.exe tool/gitea/package-app.py --vpk .build/vpk/vpk.exe
if ($LASTEXITCODE -ne 0) { throw 'Application packaging failed.' }
- name: Upload Android and Windows packages
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: cutdex-release-packages
path: dist/*
if-no-files-found: error
retention-days: 30
checks:
name: Gitea CI passed
if: always()
needs: build
runs-on: cutdex-windows-x64
steps:
- env:
RESULT: ${{ needs.build.result }}
run: |
if ($env:RESULT -ne 'success') { throw "App build: $env:RESULT" }