Files
Dat Dang eab476da45 ci: cancel superseded workflow runs on the same PR (#5151)
* ci: cancel superseded workflow runs on the same PR

* ci: skip test reports for cancelled upstream runs

Addresses: 4583936850, 6931471819
https://github.com/linagora/tmail-flutter/pull/5151#discussion_r4583936850
https://github.com/linagora/tmail-flutter/pull/5151#issuecomment-6931471819

* ci: rely on called workflow concurrency for memory-check label runs

Addresses: 4583936853, 6931471819
https://github.com/linagora/tmail-flutter/pull/5151#discussion_r4583936853
https://github.com/linagora/tmail-flutter/pull/5151#issuecomment-6931471819
2026-11-17 13:53:45 +07:00

98 lines
2.8 KiB
YAML

on:
pull_request:
paths-ignore:
- ".github/**"
- "docs"
- "Jenkinsfile"
- "**/*.md"
name: Analyze and test
env:
FLUTTER_VERSION: 3.47.9
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
discover-tests:
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.modules.outputs.modules }}
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Discover packages with tests
id: modules
run: |
modules=$(git ls-files 'test/*_test.dart' '*/test/*_test.dart' \
| awk -F/ '$1 == "test" || $1 == "tmail-mcp" { print "default"; next } { print $1 }' \
| sort -u | jq -R . | jq -sc .)
if [[ "$modules" == "[]" ]]; then
echo "ERROR: no test found" >&2
exit 1
fi
echo "modules=$modules" >> "$GITHUB_OUTPUT"
analyze-test:
needs: discover-tests
runs-on: ubuntu-latest
strategy:
matrix:
modules: ${{ fromJSON(needs.discover-tests.outputs.modules) }}
fail-fast: false
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 # optional, change this to specify the cache path
- name: Setup Firebase env
env:
FIREBASE_ENV: ${{ secrets.FIREBASE_ENV }}
run: ./scripts/setup-firebase.sh
- name: Run prebuild
id: prebuild
run: ./scripts/prebuild.sh
- name: Analyze
uses: zgosalvez/github-actions-analyze-dart@d9d6a56518f87b85b5f6ea3664c360e3c361a54f # v1.8.2
- name: Test
if: ${{ !cancelled() && steps.prebuild.outcome == 'success' }}
env:
MODULES: ${{ matrix.modules }}
run: ./scripts/test.sh
- name: Upload test reports
if: success() || failure() # Always upload report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-reports-${{ matrix.modules }}
path: test-report*.json
javascript-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- name: Test JavaScript
run: node --test