Skip to content

Build

Build #2609

Workflow file for this run

name: Build
on:
push:
branches:
- master
pull_request:
schedule:
# runs the CI everyday at 10AM
- cron: "0 10 * * *"
jobs:
freezed:
runs-on: ubuntu-latest
strategy:
matrix:
package:
- packages/freezed
- packages/freezed_annotation
- packages/freezed_lint
channel:
- master
- stable
dependencies:
- get
- downgrade
exclude:
- channel: master
dependencies: downgrade
- package: packages/freezed_lint
channel: stable
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: ${{ matrix.channel }}
cache: ${{ matrix.channel == 'stable' }}
# It is executed separately
- name: Removing example folder
# Retain example for lint golden test
if: matrix.package != 'packages/freezed_lint'
run: rm -rf example
working-directory: ${{ matrix.package }}
- name: Install dependencies
run: |
flutter pub ${{ matrix.dependencies }}
working-directory: ${{ matrix.package }}
- name: Check format
# Check dart format only on master
if: matrix.channel == 'master'
run: dart format --set-exit-if-changed .
working-directory: ${{ matrix.package }}
- name: Generate
run: |
if grep -q build_runner "pubspec.yaml"; then
dart pub run build_runner build --delete-conflicting-outputs
fi
working-directory: ${{ matrix.package }}
- name: Analyze
run: flutter analyze
working-directory: ${{ matrix.package }}
- name: Run tests
run: |
if grep -q "name: example" "pubspec.yaml"; then
flutter test
else
dart test
fi
working-directory: ${{ matrix.package }}
- name: Lint golden test
if: matrix.package == 'packages/freezed_lint'
run: |
dart pub get
dart analyze
dart run custom_lint
working-directory: 'packages/freezed_lint/example'