todos-contra-el-fuego-mobile/.forgejo/workflows/ci.yml
vjrj 726ba7bffa
All checks were successful
ci / analyze (push) Successful in 1m37s
ci / test (push) Successful in 1m15s
CI en verde: assets de secretos en analyze y test de bundle sin binding
Los dos jobs de ci.yml fallaban desde julio, y no era por los secretos:

- `flutter analyze` exige que existan los assets declarados en pubspec, y
  private-settings*.json están en .gitignore. El workflow los crea vacíos: para
  analizar basta con que existan.
- test/file_test.dart usaba package:test y llamaba a getFileNameOfLang, que lee
  del rootBundle; sin binding moría, y con binding se quedaba colgado esperando
  al canal de assets. getFileNameOfLang acepta ahora un AssetBundle inyectable y
  el test usa uno de mentira, lo que además permite cubrir el idioma de respaldo
  y el fichero base.
- SDK de Dart a >=3.8.0, que es lo que piden los generadores actuales.

Reproducido antes y después en la misma imagen del runner
(ghcr.io/cirruslabs/flutter:3.41.9): ANALYZE_EXIT=1/TEST_EXIT=1 -> ambos en verde.
2026-08-01 19:11:10 +02:00

65 lines
2.3 KiB
YAML

# Per-push gate for git.comunes.org (Forgejo Actions): analyze + tests.
# Flutter pinned to the developer toolchain (3.41.9).
#
# NOTE: `runs-on` must match a label your Forgejo runner registered with.
# We check out with plain git (a `run:` step) instead of actions/checkout@v4:
# the cirruslabs/flutter image has no Node.js, and JS-based actions need it
# ("exec: node: not found"). Manual checkout keeps the workflow Node-free.
name: ci
on:
push:
branches: ['**']
pull_request:
jobs:
analyze:
runs-on: docker
container:
image: ghcr.io/cirruslabs/flutter:3.41.9
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory '*'
git init -q .
git remote add origin "http://x-access-token:${TOKEN}@forgejo:3000/${GITHUB_REPOSITORY}.git"
git fetch -q --depth 1 origin "${GITHUB_SHA}"
git checkout -q FETCH_HEAD
# private-settings*.json están en .gitignore (llevan DSN y claves), pero
# pubspec.yaml los declara como assets y `flutter analyze` los exige.
# Aquí basta con que existan: analyze no mira el contenido.
- name: Placeholders de private-settings
run: |
echo '{}' > assets/private-settings.json
echo '{}' > assets/private-settings-dev.json
- run: flutter pub get
- name: Generate code (json_serializable)
run: dart run build_runner build --delete-conflicting-outputs
- run: flutter analyze
test:
runs-on: docker
container:
image: ghcr.io/cirruslabs/flutter:3.41.9
steps:
- name: Checkout
env:
TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory '*'
git init -q .
git remote add origin "http://x-access-token:${TOKEN}@forgejo:3000/${GITHUB_REPOSITORY}.git"
git fetch -q --depth 1 origin "${GITHUB_SHA}"
git checkout -q FETCH_HEAD
- name: Placeholders de private-settings
run: |
echo '{}' > assets/private-settings.json
echo '{}' > assets/private-settings-dev.json
- run: flutter pub get
- name: Generate code + test
run: |
dart run build_runner build --delete-conflicting-outputs
flutter test