Skip to content

Commit c1bb1f5

Browse files
renefloorxsahil03x
andauthored
chore(repo): initial package and workflow setup (#1)
* chore: initial package and workflow setup * remove analysis options in package * update flutter and dart dependency * decrease pana for now * Update .github/pull_request_template.md Co-authored-by: Sahil Kumar <xdsahil@gmail.com> --------- Co-authored-by: Sahil Kumar <xdsahil@gmail.com>
1 parent 299cb6d commit c1bb1f5

23 files changed

+1650
-0
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Default owner for everything in the repo
2+
* @GetStream/flutter-developers
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Package Analysis
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: "Install Tools"
7+
shell: bash
8+
run: flutter pub global activate melos
9+
10+
- name: "Bootstrap Workspace"
11+
shell: bash
12+
run: melos bootstrap --verbose
13+
env:
14+
MELOS_PACKAGES: stream_**,example
15+
16+
# Only analyze lib/; non-client code doesn't need to work on
17+
# all supported legacy version.
18+
- name: "Stream Feeds Analyze"
19+
shell: bash
20+
run: cd packages/stream_feeds/lib && dart analyze --fatal-warnings . && cd .. && flutter test --exclude-tags golden

.github/actions/pana/action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Pana Workflow
2+
3+
inputs:
4+
min_score:
5+
required: false
6+
type: number
7+
default: 120
8+
pana_version:
9+
required: false
10+
type: string
11+
runs_on:
12+
required: false
13+
type: string
14+
default: "ubuntu-latest"
15+
working_directory:
16+
required: false
17+
type: string
18+
default: "."
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Install Flutter
24+
uses: subosito/flutter-action@v2
25+
with:
26+
cache: true
27+
channel: stable
28+
flutter-version: "3.x"
29+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
30+
31+
- name: Install Pana
32+
working-directory: ${{ inputs.working_directory }}
33+
shell: bash
34+
run: flutter pub global activate pana ${{inputs.pana_version}}
35+
36+
- name: Verify Pana Score
37+
working-directory: ${{ inputs.working_directory }}
38+
shell: bash
39+
run: |
40+
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p")
41+
echo "Score: $PANA_SCORE"
42+
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0];
43+
if (( $SCORE < ${{inputs.min_score}} )); then echo "The minimum score of ${{inputs.min_score}} was not met!"; exit 1; fi

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Submit a pull request
2+
<!--Internal tickets have to be added by Stream devs-->
3+
Closes FLU-
4+
<!--Optional to add github issue which is solved by this PR-->
5+
Closes #
6+
7+
## CLA
8+
9+
- [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required).
10+
- [ ] The code changes follow best practices
11+
- [ ] Code changes are tested (add some information if not applicable)
12+
13+
## Description of the pull request
14+
<!--
15+
Describe how these code changes fix the issue or how the feature works.
16+
Also try to give instructions how this can be tested.
17+
-->
18+
19+
## Screenshots / Videos
20+
21+
<!-- Consider to add screenshots and/or videos to show the effect of the change -->
22+
23+
| Before | After |
24+
| --- | --- |
25+
| img | img |
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: beta_version_analyze
2+
3+
on:
4+
schedule:
5+
# Runs "At 03:00 every monday"
6+
- cron: '0 3 * * 1'
7+
workflow_dispatch:
8+
9+
jobs:
10+
# Does a sanity check on packages for the next beta version so we are not surprised by any breaking changes.
11+
analyze_beta_versions:
12+
timeout-minutes: 15
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: "Git Checkout"
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: "Install Flutter"
21+
uses: subosito/flutter-action@v2
22+
with:
23+
channel: beta
24+
cache: true
25+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
26+
27+
- name: 📊 Analyze and test packages
28+
uses: ./.github/actions/package_analysis
29+
30+
slack:
31+
name: Slack Report
32+
runs-on: ubuntu-latest
33+
needs: [analyze_beta_versions]
34+
if: failure() && github.event_name == 'schedule'
35+
steps:
36+
- uses: 8398a7/action-slack@v3
37+
with:
38+
status: failure
39+
text: "<@U08BMRSM8G5>: The beta build for Flutter Feeds failed. Please check the logs."
40+
job_name: "${{ github.workflow }}: ${{ github.job }}"
41+
fields: repo,commit,author,workflow
42+
env:
43+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NIGHTLY_CHECKS }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: legacy_version_analyze
2+
3+
env:
4+
# Note: The versions below should be manually updated after a new stable
5+
# version comes out.
6+
flutter_version: "3.27.4"
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- develop
13+
paths:
14+
- "packages/**"
15+
- ".github/workflows/legacy_version_analyze.yml"
16+
pull_request:
17+
branches:
18+
- main
19+
- develop
20+
paths:
21+
- "packages/**"
22+
- ".github/workflows/legacy_version_analyze.yml"
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
# Does a sanity check that packages at least pass analysis on the N-1
30+
# versions of Flutter stable if the package claims to support that version.
31+
# This is to minimize accidentally making changes that break old versions
32+
# (which we don't commit to supporting, but don't want to actively break)
33+
# without updating the constraints.
34+
analyze_legacy_version:
35+
timeout-minutes: 15
36+
if: github.event.pull_request.draft == false
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: "Git Checkout"
40+
uses: actions/checkout@v3
41+
with:
42+
fetch-depth: 0
43+
44+
- name: "Install Flutter"
45+
uses: subosito/flutter-action@v2
46+
with:
47+
cache: true
48+
flutter-version: ${{ env.flutter_version }}
49+
50+
- name: 📊 Analyze and test packages
51+
uses: ./.github/actions/package_analysis

.github/workflows/pana.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: pana
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
stream_feeds:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 📚 Git Checkout
20+
uses: actions/checkout@v4
21+
- name: 📊 Verify Pana Score
22+
uses: ./.github/actions/pana
23+
with:
24+
working_directory: packages/stream_feeds
25+
min_score: 130 # Missing 10 points for no example and 10 points for license

.github/workflows/pr_title.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: 'PR is Conventional and Semantic'
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
conventional_pr_title:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: amannn/action-semantic-pull-request@v5.5.3
20+
with:
21+
scopes: |
22+
llc
23+
repo
24+
requireScope: true
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
semantic_changelog_update:
29+
needs: conventional_pr_title # Trigger after the [conventional_pr_title] completes
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: GetStream/verify-semantic-changelog-update@main
33+
with:
34+
scopes: |
35+
{
36+
"llc": "packages/stream_feeds"
37+
}
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Fast fail the script on failures.
4+
set -e
5+
6+
flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$' -r '\.freezed\.dart$'
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: stream_feeds_flutter_workflow
2+
3+
env:
4+
FLUTTER_CHANNEL: stable
5+
ENV_PROPERTIES: ${{ secrets.ENV_PROPERTIES }}
6+
7+
on:
8+
pull_request:
9+
types:
10+
- opened
11+
- reopened
12+
- synchronize
13+
- ready_for_review
14+
push:
15+
branches:
16+
- main
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
analyze:
24+
timeout-minutes: 15
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Git Checkout
28+
uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Install Flutter
33+
uses: subosito/flutter-action@v2
34+
with:
35+
cache: true
36+
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
37+
channel: ${{ env.FLUTTER_CHANNEL }}
38+
39+
- name: Install Tools
40+
run: |
41+
flutter pub global activate melos
42+
flutter pub global activate remove_from_coverage
43+
44+
- name: Bootstrap Workspace
45+
run: melos bootstrap --verbose
46+
47+
- name: Dart Analyze
48+
run: |
49+
melos run analyze
50+
51+
- name: Check formatting
52+
run: |
53+
melos run format:verify
54+
55+
## Test and coverage reporting
56+
- name: "Flutter Test"
57+
run: melos run test:all
58+
- name: "Collect Coverage"
59+
run: melos run coverage:ignore-file --no-select
60+
- name: "Upload Coverage"
61+
uses: codecov/codecov-action@v5
62+
with:
63+
token: ${{secrets.CODECOV_TOKEN}}
64+
files: packages/*/coverage/lcov.info

0 commit comments

Comments
 (0)