Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/actions/pana/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
33 changes: 26 additions & 7 deletions .github/workflows/legacy_version_analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading