Skip to content
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

Ecosystem testing #320

Merged
merged 77 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e12da94
Set up example workflow
mosuem Nov 15, 2024
958da0d
on push
mosuem Nov 15, 2024
b3cddaa
on pr
mosuem Nov 15, 2024
a4d5a1a
Merge pull request #3 from mosuem/ecosystem_testing
mosuem Nov 15, 2024
7001128
Fixes
mosuem Nov 15, 2024
69b9fd7
Changes
mosuem Nov 15, 2024
4f1cfce
fix
mosuem Nov 15, 2024
746a771
add default
mosuem Nov 15, 2024
84f165c
echos
mosuem Nov 15, 2024
6c2d27a
fixes
mosuem Nov 15, 2024
fdbdc74
shoudl work
mosuem Nov 15, 2024
1a5d865
fix path writing
mosuem Nov 15, 2024
b8a636f
mroe echos
mosuem Nov 15, 2024
7286544
fix file
mosuem Nov 15, 2024
a26d9f5
add arg
mosuem Nov 15, 2024
8587db3
add debug
mosuem Nov 15, 2024
588a511
fix input
mosuem Nov 15, 2024
d9b7ef4
Write comment
mosuem Nov 20, 2024
e6cb0b2
Fix
mosuem Nov 28, 2024
e1ed12d
relax
mosuem Nov 28, 2024
73fceb8
reqs
mosuem Nov 28, 2024
6880f4e
run pub get
mosuem Nov 28, 2024
ccbe6de
fixes
mosuem Nov 28, 2024
8d1c5be
fixes
mosuem Nov 28, 2024
d644d53
testing
mosuem Nov 28, 2024
ba9a622
pritn all labels
mosuem Nov 28, 2024
c0fa94f
in quotes
mosuem Nov 28, 2024
e0a4fd3
decode as list
mosuem Nov 28, 2024
aac6bf7
decode as list
mosuem Nov 28, 2024
35698be
print args
mosuem Nov 28, 2024
7237cd0
not use tojson
mosuem Nov 28, 2024
451c8a8
as lines
mosuem Nov 28, 2024
caff617
Use pub activate
mosuem Nov 28, 2024
26953d0
fix name
mosuem Nov 28, 2024
e25d764
Fix name
mosuem Nov 28, 2024
4c51343
Fix schema key
mosuem Nov 28, 2024
c08942c
print comment
mosuem Nov 28, 2024
173595b
name output
mosuem Nov 28, 2024
8f7f46f
Fixes
mosuem Nov 28, 2024
895ab30
add issue number
mosuem Nov 28, 2024
fa49b83
Update commenting
mosuem Nov 29, 2024
11a7029
mkdir
mosuem Nov 29, 2024
64bd0d3
Fix mkdir
mosuem Nov 29, 2024
668fa88
More info
mosuem Nov 29, 2024
9d6f6fe
Take package from github
mosuem Nov 29, 2024
9eb29a6
fix args
mosuem Nov 29, 2024
17bd7ed
fix quotes
mosuem Nov 29, 2024
3965d10
fix issue
mosuem Nov 29, 2024
7d25c72
use dart
mosuem Nov 29, 2024
8df63fc
print exec
mosuem Nov 29, 2024
6f1a7f8
use http instaed of git
mosuem Nov 29, 2024
b8c3bf7
Fix uri
mosuem Nov 29, 2024
bb40912
Fix semicolon
mosuem Nov 29, 2024
9215e29
Fixes
mosuem Nov 29, 2024
dc79cf1
print stderr
mosuem Nov 29, 2024
4e4dc37
small change
mosuem Nov 29, 2024
d770d53
sigurds fix
mosuem Dec 2, 2024
05f6311
Fix name
mosuem Dec 3, 2024
c477c59
Add readme
mosuem Dec 3, 2024
fed28e5
typo
mosuem Dec 3, 2024
ca6036d
Add link
mosuem Dec 3, 2024
acd1b19
Add licenses
mosuem Dec 3, 2024
0e4c0bc
Add testing
mosuem Dec 3, 2024
f4bcc4d
Changes as per review
mosuem Dec 4, 2024
80ac9c3
Use unicode instead of emojis
mosuem Dec 5, 2024
74b591c
Use local version for testing
mosuem Dec 5, 2024
abf8a07
Add quest testing workflow
mosuem Dec 5, 2024
5ccf56a
Remove docs
mosuem Dec 5, 2024
8431ba4
Rename wf
mosuem Dec 5, 2024
01b8751
log gh clone
mosuem Dec 5, 2024
0ad9653
set gh token
mosuem Dec 5, 2024
2d9f388
print command
mosuem Dec 5, 2024
2ed31d0
Use useFlutter
mosuem Dec 5, 2024
43e2707
print files
mosuem Dec 5, 2024
a1677a9
add log
mosuem Dec 5, 2024
f371d33
order
mosuem Dec 5, 2024
0218542
Fix quest wf
mosuem Dec 5, 2024
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
12 changes: 12 additions & 0 deletions .github/test_repos/repos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "../../pkgs/quest/schema.json",
"https://github.com/mosuem/my_app_old_web": {
"level": "analyze"
},
"https://github.com/mosuem/my_app_new_web": {
"level": "test",
"packages": {
"exclude": "intl4x"
}
}
}
56 changes: 56 additions & 0 deletions .github/workflows/ecosystem_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Ecosystem test

on:
workflow_call:
inputs:
repos_file:
description: 'Path to the file containing the list of repository names'
type: string
required: true

jobs:
update_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
channel: main

- run: echo "${{ toJSON(github.event.pull_request.labels.*.name) }}"

- run: dart pub global activate -s git https://github.com/dart-lang/ecosystem.git --git-ref main --git-path pkgs/quest

- name: Update package and test
run: |
dart pub global run quest ${{ inputs.repos_file }} ${{ github.repositoryUrl }} ${{ github.head_ref || github.ref_name }} "${{ toJSON(github.event.pull_request.labels.*.name) }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Output issue number
run: |
mkdir -p output
echo ${{ github.event.number }} > output/issueNumber

- name: Find Comment
uses: peter-evans/find-comment@90e9b82d6319a7ae3f32bc0b434db48d6c376e55
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: github-actions[bot]
body-includes: '## Ecosystem testing'

- name: Write comment id to file
if: ${{ steps.fc.outputs.comment-id != 0 }}
run: echo ${{ steps.fc.outputs.comment-id }} >> output/commentId

- name: Upload markdown
if: success() || failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: output
path: output/
12 changes: 12 additions & 0 deletions .github/workflows/ecosystem_test_internal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Ecosystem test:Internal

on:
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, labeled, unlabeled]

jobs:
test_ecosystem:
uses: ./.github/workflows/ecosystem_test.yaml
with:
repos_file: .github/test_repos/repos.json
7 changes: 7 additions & 0 deletions .github/workflows/post_summaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
workflows:
- Publish:Internal
- Health:Internal
- Ecosystem test:Internal
types:
- completed

Expand Down Expand Up @@ -45,6 +46,12 @@ jobs:
fs.writeFileSync('${{ github.workspace }}/comment.zip', Buffer.from(download.data));
- run: unzip comment.zip

- name: 'Print the comment'
run: |
if [ -f "./comment.md" ]; then
cat ./comment.md
fi


# Create the comment, or update the existing one, with the markdown
# generated in the Health workflow.
Expand Down
3 changes: 3 additions & 0 deletions pkgs/quest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
27 changes: 27 additions & 0 deletions pkgs/quest/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2024, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79 changes: 79 additions & 0 deletions pkgs/quest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Quest: Ecosystem Testing for Dart Packages
Embark your package on a quest of testing against a suite of applications. This helps identify potential breaking changes introduced by package updates, ensuring seamless integration across the ecosystem.

## What does it do?
It checks if your package upgrade would result in failures in the ecosystem. This is achieved by running the following pseudocode:
```dart
for (final app in applicationSuite) {
if (app.dependencies.contains(package)) {
pubGet(app);
analyze(app);
test(app);

upgradePackage(app);

pubGet(app);
analyze(app);
test(app);
}
}
```

## How do I use it?
1. Create a suite of repositories to test against at `.github/test_repos/repos.json`. Follow the schema specified [here](schema.json).
```json
{
"https://github.com/mosuem/my_app_old_web": {
"level": "analyze"
},
"https://github.com/mosuem/my_app_new_web": {
"level": "test",
"packages": {
"exclude": "intl4x"
}
}
}
```

2. Add a workflow file with the following contents:
```yaml
name: Ecosystem test

on:
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, labeled, unlabeled]

jobs:
test_ecosystem:
uses: dart-lang/ecosystem/.github/workflows/ecosystem_test.yaml@main
with:
repos_file: .github/test_repos/repos.json
```

3. To show the markdown result as a comment, also add a workflow file
```yaml
name: Comment on the pull request

on:
# Trigger this workflow after the Health workflow completes. This workflow will have permissions to
# do things like create comments on the PR, even if the original workflow couldn't.
workflow_run:
workflows:
- Health
- Publish
- Ecosystem test
types:
- completed

jobs:
upload:
uses: dart-lang/ecosystem/.github/workflows/post_summaries.yaml@main
permissions:
pull-requests: write
```

4. Profit!

# Contributing
Contributions are welcome! Please see the [contribution guidelines](../../CONTRIBUTING.md).
5 changes: 5 additions & 0 deletions pkgs/quest/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: package:dart_flutter_team_lints/analysis_options.yaml

linter:
rules:
- prefer_final_locals
Loading
Loading