Skip to content

Dummy change in data module to demo selective CI #10

Dummy change in data module to demo selective CI

Dummy change in data module to demo selective CI #10

Workflow file for this run

name: CI Checks
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
env:
FLUTTER_VERSION: "3.19.5"
jobs:
full_CI:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_MIN_VERSION}}
cache: true
- name: Set up Melos
uses: bluefireteam/melos-action@v3
- name: Run analyzer
run: melos run analyze
- name: Check formatting of Dart files
run: melos run format_check
- name: Run unit tests
run: melos run test_unit
- name: Run golden tests
run: melos run test_golden
selective_CI:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_MIN_VERSION}}
cache: true
- name: Set up Melos
uses: bluefireteam/melos-action@v3
- name: Set MELOS_PACKAGES filter with packages names that are affected by the Git Diff
run: |
changeAffectedPackages=$(melos list --diff=origin/main...HEAD --include-dependents)
if [[ $changeAffectedPackages == *"No package"* ]]; then
echo "MELOS_PACKAGES=dummy_value_to_filter_out_all_packages" >> $GITHUB_ENV
else
echo "MELOS_PACKAGES=$(echo "$changeAffectedPackages" | paste -sd ',' -)" >> $GITHUB_ENV
fi
- name: Print MELOS_PACKAGES global scope
run: |
echo "The Melos global scope is: $MELOS_PACKAGES"
echo "It'll be used as a global filter for the remaining Melos scripts in the pipeline!"
- name: Run analyzer with Git Diff using MELOS_PACKAGES
run: melos run analyze
- name: Check formatting of Dart files with Git Diff using MELOS_PACKAGES
run: melos run format_check
- name: Run unit tests with Git Diff using MELOS_PACKAGES
run: melos run test_unit
- name: Run golden tests with Git Diff using MELOS_PACKAGES
run: melos run test_golden
# This Melos filtering approach will not work as intended until the following
# feature is implemented https://github.com/invertase/melos/pull/702.
selective_CI_alternative:
if: false
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Git Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{env.FLUTTER_MIN_VERSION}}
cache: true
- name: Set up Melos
uses: bluefireteam/melos-action@v3
- name: Run analyzer with Git Diff
run: melos run analyze_diff
- name: Check formatting of Dart files with Git Diff
run: melos run format_check_diff
- name: Run unit tests with Git Diff
run: melos run test_unit_diff
- name: Run golden tests with Git Diff
run: melos run test_golden_diff