diff --git a/.github/actions/pana/action.yml b/.github/actions/pana/action.yml index 2fa3bee4..7de52eec 100644 --- a/.github/actions/pana/action.yml +++ b/.github/actions/pana/action.yml @@ -20,6 +20,14 @@ inputs: runs: using: "composite" steps: + # Pana resolves the package on its own, so a dependency on a sibling package would come from pub.dev and miss + # the changes in this checkout. Point it at the sibling's directory instead. + - name: Resolve Sibling Packages From The Checkout + uses: mikefarah/yq@v4 + with: + cmd: | + yq eval '(.dependencies | select(has("stream_core")) | .stream_core) = {"path": "../stream_core"}' -i packages/stream_core_flutter/pubspec.yaml + - name: Install Flutter uses: subosito/flutter-action@v2 with: @@ -37,7 +45,7 @@ runs: working-directory: ${{ inputs.working_directory }} shell: bash run: | - PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") + PANA=$(pana . --no-warning --project-root "${{ github.workspace }}"); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") echo "Score: $PANA_SCORE" IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; if (( $SCORE < ${{inputs.min_score}} )); then echo "The minimum score of ${{inputs.min_score}} was not met!"; exit 1; fi diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml index 76940ddf..f742bb11 100644 --- a/.github/workflows/legacy_version_analyze.yml +++ b/.github/workflows/legacy_version_analyze.yml @@ -10,16 +10,10 @@ on: branches: - main - develop - paths: - - "packages/**" - - ".github/workflows/legacy_version_analyze.yml" pull_request: branches: - main - develop - paths: - - "packages/**" - - ".github/workflows/legacy_version_analyze.yml" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -30,14 +24,39 @@ permissions: pull-requests: read jobs: + # Decides whether the analysis runs: on every push, and on a pull request + # that is not a draft and changes a package. A job skipped this way reports + # `success` to branch protection, while a workflow skipped by `on.paths` + # never reports and leaves a required check waiting forever. See + # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks + gate: + runs-on: ubuntu-latest + outputs: + should_run: ${{ github.event_name == 'push' || (steps.filter.outputs.packages == 'true' && github.event.pull_request.draft != true) }} + steps: + # paths-filter diffs against git history on push events, so it needs a + # checkout there. On pull requests it uses the API instead. + - name: "Git Checkout" + uses: actions/checkout@v4 + + - name: "Detect Path Changes" + uses: dorny/paths-filter@v4 + id: filter + with: + filters: | + packages: + - 'packages/**' + - '.github/workflows/legacy_version_analyze.yml' + # Does a sanity check that packages at least pass analysis on the N-1 # versions of Flutter stable if the package claims to support that version. # This is to minimize accidentally making changes that break old versions # (which we don't commit to supporting, but don't want to actively break) # without updating the constraints. analyze_legacy_version: + needs: gate + if: needs.gate.outputs.should_run == 'true' timeout-minutes: 15 - if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - name: "Git Checkout" diff --git a/.github/workflows/pana.yml b/.github/workflows/pana.yml index 11890eb4..a7aa0a2b 100644 --- a/.github/workflows/pana.yml +++ b/.github/workflows/pana.yml @@ -37,7 +37,7 @@ jobs: uses: ./.github/actions/pana with: working_directory: packages/stream_core_flutter - min_score: 120 # Missing 10 points for no license, 10 points for no example, and 20 points for static analysis issues. + min_score: 110 # Missing 10 points for no license, 10 points for no example, 20 points for static analysis issues (including the path dependency on stream_core that the pana action sets up), and 10 points for outdated dependencies (shimmer 4.0.0). stream_thumbnail: runs-on: ubuntu-latest