Files
BadNote/.gitea/workflows/ci.yml
Akiba So 25ba717c97
Some checks failed
CI / Flutter (analyze, test, Windows build) (push) Failing after 1m50s
CI / Server tests (optional) (push) Failing after 41s
CI: make builds work on China-based self-hosted Gitea runner
The self-hosted Windows runner can't reach github.com (GFW), so the previous
workflow failed cloning actions/checkout and would also fail downloading the
Flutter SDK and the sqlite3 native binary.

- Vendor the official, SHA-256-verified sqlite3 binaries under vendor/sqlite3/
  and select them via pubspec hooks.user_defines (source: test-sqlite3). Builds
  and tests now run fully offline — no GitHub download, no proxy, no
  LD_LIBRARY_PATH hack (removed .local-sqlite/).
- Consolidate CI into one Windows workflow: fetch actions from the gitea.com
  mirror, use the runner's pre-installed Flutter (no SDK download), and use the
  flutter-io.cn pub/Flutter mirrors. Server tests use the Tsinghua PyPI mirror.
- Document the offline build + China mirrors in README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 03:34:11 +08:00

84 lines
2.7 KiB
YAML

name: CI
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch:
# This pipeline targets a self-hosted Windows runner inside mainland China.
# Notes on the design (so it works behind the GFW):
# * Actions are fetched from the gitea.com mirror, NOT github.com, which is
# unreachable here. (Alternatively set DEFAULT_ACTIONS_URL=https://gitea.com
# in the runner's config and drop the full URL prefix.)
# * Flutter is expected to be pre-installed on the runner (the same machine
# used for local development) — we do NOT download the SDK from Google.
# * pub / Flutter artifacts use the flutter-io.cn mirrors.
# * The sqlite3 native binary is vendored in the repo (vendor/sqlite3/), so no
# GitHub-releases download happens during the build.
env:
PUB_HOSTED_URL: https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL: https://storage.flutter-io.cn
jobs:
flutter:
name: Flutter (analyze, test, Windows build)
runs-on: windows-latest
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@v4
- name: Flutter version (must be pre-installed on the runner)
run: flutter --version
- name: Install dependencies
run: flutter pub get
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed lib test
- name: Static analysis
run: flutter analyze
- name: Run tests
run: flutter test --reporter expanded
- name: Enable Windows desktop
run: flutter config --enable-windows-desktop
- name: Build Windows release
run: flutter build windows --release
- name: Package artifact
run: Compress-Archive -Path "build/windows/x64/runner/Release/*" -DestinationPath "badnote-windows-x64.zip" -Force
- name: Upload artifact
uses: https://gitea.com/actions/upload-artifact@v3
with:
name: badnote-windows-x64
path: badnote-windows-x64.zip
if-no-files-found: error
server:
name: Server tests (optional)
runs-on: windows-latest
# The Python backend is optional/experimental; never block the pipeline.
continue-on-error: true
steps:
- name: Checkout
uses: https://gitea.com/actions/checkout@v4
- name: Install dependencies (Tsinghua PyPI mirror)
working-directory: server
run: |
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
- name: Run tests
working-directory: server
env:
BADNOTE_JWT_SECRET: ci-test-secret
run: pytest -q