feat(ci): Validate code generation #2625
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dart CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: dart-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
dart-ci: | |
name: Dart CI | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Login to GHCR | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 | |
- name: Build test Docker image | |
run: ./tool/build-dev-container.sh | |
- name: Install dart | |
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # v1 | |
- name: Setup | |
run: ./tool/setup.sh | |
- name: Check formatting | |
run: melos run format:check | |
- name: Lint code | |
run: melos run analyze | |
- name: Run tests | |
run: | | |
mapfile -t packages < <(melos list --parsable --diff=${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }}..${{ github.event.pull_request.head.sha }} --include-dependents | xargs -r -n1 basename) | |
if [ -z "$packages" ]; then exit 0; fi | |
packages_glob="$(printf ",%s" "${packages[@]}")" | |
packages_glob="${packages_glob:1}" | |
melos exec --scope="$packages_glob" --concurrency=1 --fail-fast --dir-exists=test -- "flutter test --concurrency=$(nproc --all)" |