-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
ci: run the Dart test suite on pull_request #8930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+79
−28
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Flutter Test | ||
|
|
||
| # Runs the Dart unit/widget suite (test/) on PRs that touch Dart source. Until | ||
| # now nothing ran it: every other `flutter test` call in this repo targets | ||
| # integration_test/, and all of them sit behind workflow_call (build-linux.yml, | ||
| # build-windows.yml) or workflow_dispatch. So no PR-triggered workflow executed | ||
| # a single Dart test, and a regression pinned by a unit test could still merge. | ||
| # | ||
| # That gap is not hypothetical — lantern-box v0.0.101 changed the JSON shape of | ||
| # `user_failures` and broke Dart deserialization for every user with a recorded | ||
| # failure (#8929). The fix ships with tests, but on `pull_request` nothing would | ||
| # have run them. | ||
| # | ||
| # No Go toolchain, Android SDK, or Java here: `flutter test` runs on the Dart VM | ||
| # and builds no platform artifact, which keeps this gate to a couple of minutes. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - "lib/**" | ||
| - "test/**" | ||
| - "pubspec.yaml" | ||
| - "pubspec.lock" | ||
| - ".github/flutter-version.yaml" | ||
| # keep the self-trigger so edits to this workflow re-run it | ||
| - ".github/workflows/flutter-test.yml" | ||
|
|
||
| concurrency: | ||
| group: flutter-test-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| flutter-test: | ||
| permissions: | ||
| contents: "read" | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Cache Flutter dependencies | ||
| uses: actions/cache@v4 | ||
| timeout-minutes: 5 | ||
| continue-on-error: true | ||
| with: | ||
| path: | | ||
| ~/.pub-cache | ||
| key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-flutter- | ||
|
|
||
| - name: Install Flutter | ||
| uses: subosito/flutter-action@v2.22.0 | ||
| with: | ||
| channel: stable | ||
| flutter-version-file: .github/flutter-version.yaml | ||
| cache: true | ||
|
|
||
| # Generated sources are committed, but regenerating means the suite tests | ||
| # the PR's own source rather than whatever .g.dart happened to be checked | ||
| # in — a model change with a forgotten `make gen` would otherwise pass | ||
| # against stale generated code. | ||
| - name: Flutter pub get + codegen | ||
| run: | | ||
| make pubget | ||
| make gen | ||
|
|
||
| # app.env is a declared pubspec asset, normally decoded from a secret by | ||
| # the release workflow. Asset bundling runs before the tests do and fails | ||
| # outright if the file is absent, so an empty placeholder is enough — the | ||
| # suite reads nothing from it. Same treatment as android-compile-check.yml. | ||
| - name: Create placeholder app.env | ||
| run: touch app.env | ||
|
|
||
| # Reporter is left unset: the Dart test runner defaults to its `github` | ||
| # reporter under Actions, which annotates failures inline on the PR. | ||
| - name: Run Flutter tests | ||
| run: flutter test | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: getlantern/lantern
Length of output: 219
🏁 Script executed:
Repository: getlantern/lantern
Length of output: 6010
🌐 Web query:
actions/checkout v4 persist-credentials default true README💡 Result:
In actions/checkout version 4, the persist-credentials input defaults to true [1][2]. When this setting is enabled (the default), the authentication token or SSH key used by the action is persisted in the local git configuration [3][4]. This allows subsequent steps in your workflow to execute authenticated git commands [3][4]. The action automatically removes this token during the post-job cleanup phase [3][4]. If you wish to prevent the action from configuring your credentials in the local git config, you can explicitly set persist-credentials to false in your workflow file [3][4].
Citations:
Disable checkout credential persistence before running PR-controlled code.
actions/checkout@v4persistsGITHUB_TOKENcredentials by default, and thispull_requestjob later runs PR-controlledmake pubget,make gen, andflutter test. Setpersist-credentials: falseunless this workflow needs authenticated Git access.Proposed fix
- name: Checkout code uses: actions/checkout@v4 + with: + persist-credentials: false📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 39-40: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Source: Linters/SAST tools