Files
tmail-flutter/.github/workflows/html-display.yaml
T

140 lines
5.0 KiB
YAML

on:
pull_request:
paths-ignore:
- "docs/**"
- "Jenkinsfile"
- "**/*.md"
name: HTML email display
permissions:
contents: read
env:
FLUTTER_VERSION: 3.38.9
jobs:
# Chrome suite tagged `display`: every HTML email fixture rendered through
# the production transform and viewer document, at every email pane width.
# scripts/test.sh excludes this tag from the core job.
html-display:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Setup flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: "deps-${{ hashFiles('pubspec.lock') }}"
cache-path: ${{ runner.tool_cache }}/flutter
- name: Setup Firebase env
env:
FIREBASE_ENV: ${{ secrets.FIREBASE_ENV }}
run: ./scripts/setup-firebase.sh
- name: Run prebuild
run: ./scripts/prebuild.sh
- name: Display tests
working-directory: core
# Same discovery as scripts/test.sh (every @TestOn('chrome') file),
# filtered to the `display` tag that test.sh excludes. A whole-folder
# Chrome run would also compile VM-only tests, which web cannot load.
run: |
files=()
while IFS= read -r file; do files+=("$file"); done \
< <(grep -rlE "^@TestOn\(['\"]chrome['\"]\)$" --include='*_test.dart' test | sort)
flutter test --platform chrome -t display \
--file-reporter=json:../test-report-html-display.json "${files[@]}"
- name: Upload test report
if: success() || failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-reports-html-display
path: test-report-html-display.json
# Which HTML display paths a PR touches (decision D10): the mutation proofs
# only run when display code, rules, harness or fixtures change.
html-paths:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
html: ${{ steps.filter.outputs.html }}
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Filter HTML display paths
id: filter
uses: dorny/paths-filter@0e4a8c6effa4802afeda77dc8d303f8176d7dfad # v3.0.4
with:
filters: |
html:
- "core/lib/presentation/utils/html_transformer/**"
- "core/lib/utils/html/**"
- "core/lib/presentation/views/html_viewer/**"
- "core/test/fixtures/html_emails/**"
- "core/test/utils/html/display_rules/**"
- "core/test/utils/html/display_harness/**"
- "core/test/utils/html/composer_rules/**"
- "core/test/utils/html_pipeline_registry.dart"
- "core/test/utils/html_pipeline_rules.dart"
- "core/lib/utils/print_utils.dart"
- "core/tool/generate_html_email_corpus.dart"
- "core/dart_test.yaml"
- ".github/workflows/html-display.yaml"
# Proof that each display rule still bites: every test breaks one
# mechanism in the test and expects a new violation. Tagged `mutation`,
# skipped by default (core/dart_test.yaml), so it needs --run-skipped.
html-display-mutation:
needs: html-paths
if: ${{ needs.html-paths.outputs.html == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Setup flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"
cache: true
cache-key: "deps-${{ hashFiles('pubspec.lock') }}"
cache-path: ${{ runner.tool_cache }}/flutter
- name: Setup Firebase env
env:
FIREBASE_ENV: ${{ secrets.FIREBASE_ENV }}
run: ./scripts/setup-firebase.sh
- name: Run prebuild
run: ./scripts/prebuild.sh
- name: Mutation proofs
working-directory: core
run: |
files=()
while IFS= read -r file; do files+=("$file"); done \
< <(grep -rlE "^@TestOn\(['\"]chrome['\"]\)$" --include='*_test.dart' test | sort)
flutter test --platform chrome -t mutation --run-skipped \
--file-reporter=json:../test-report-html-display-mutation.json "${files[@]}"
- name: Upload test report
if: success() || failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-reports-html-display-mutation
path: test-report-html-display-mutation.json