Browse Source

feat(tool,ci): Only run tests of changed packages and their dependents

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/918/head
jld3103 1 year ago
parent
commit
5bc9cfcb93
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 9
      .github/workflows/dart.yml

9
.github/workflows/dart.yml

@ -18,6 +18,8 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
fetch-depth: 0
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with: with:
@ -44,4 +46,9 @@ jobs:
- name: Lint code - name: Lint code
run: melos run analyze run: melos run analyze
- name: Run tests - name: Run tests
run: melos run test 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)"

Loading…
Cancel
Save