-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9eb777b
commit 093c66a
Showing
5 changed files
with
76 additions
and
105 deletions.
There are no files selected for viewing
This file contains 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,38 @@ | ||
name: Code Quality | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
code-quality: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/[email protected] | ||
- uses: subosito/flutter-action@v2 | ||
- name: Setup flutter | ||
run: flutter pub get | ||
- name: Format code | ||
run: dart format . -l 120 | ||
- name: Apply linter auto-fixes | ||
run: dart fix --apply | ||
- name: Check for un-fixable issues | ||
run: flutter analyze | ||
- name: Run tests | ||
run: cd example && flutter test | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV | ||
- name: Update changes in GitHub repository | ||
if: env.modified == 'true' | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
git add -A | ||
git commit -m '[automated commit] lint format and import sort' | ||
git push |
This file contains 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 |
---|---|---|
|
@@ -12,39 +12,11 @@ jobs: | |
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v4 | ||
- uses: googleapis/release-please-action@v4 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
code-quality: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/[email protected] | ||
- uses: subosito/flutter-action@v2 | ||
- name: Setup flutter | ||
run: flutter pub get | ||
- name: Lint and format | ||
run: | | ||
dart format . -l 120 | ||
dart fix --apply | ||
flutter analyze | ||
cd example && flutter test | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV | ||
- name: Update changes in GitHub repository | ||
if: env.modified == 'true' | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
git add -A | ||
git commit -m '[automated commit] lint format and import sort' | ||
git push -f | ||
uses: ./.github/workflows/code-quality.yml | ||
deploy-qa-demo: | ||
name: Deploy preview version of the storybook on firebase | ||
needs: code-quality | ||
|
This file contains 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 |
---|---|---|
@@ -1,86 +1,15 @@ | ||
name: CI - Pull Request | ||
on: | ||
pull_request: | ||
pull_request_target: | ||
|
||
jobs: | ||
up-to-date: | ||
name: "Check branch is up to date" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
- name: Check branch is up to date | ||
run: | | ||
if git merge-base --is-ancestor ${{ github.event.pull_request.base.sha}} ${{ github.event.pull_request.head.sha}} | ||
then | ||
echo "Your branch is up to date." | ||
exit 0 | ||
else | ||
echo "You need to merge / rebase." | ||
exit 1 | ||
fi | ||
changes: | ||
name: "Check for changes in code" | ||
needs: up-to-date | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
outputs: | ||
files: ${{steps.changed-files.outputs.any_changed}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: main | ||
persist-credentials: false | ||
- name: Get all changed *.dart, files in custom-docs or pubspec.yaml | ||
id: changed-files | ||
uses: tj-actions/changed-files@v41 | ||
with: | ||
base_sha: ${{ github.event.pull_request.base.sha }} | ||
sha: ${{ github.event.pull_request.head.sha }} | ||
files: | | ||
**/*.dart | ||
custom-docs | ||
pubspec.yaml | ||
uses: ./.github/workflows/up-to-date.yml | ||
code-quality: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
needs: changes | ||
if: needs.changes.outputs.files == 'true' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/[email protected] | ||
- uses: subosito/flutter-action@v2 | ||
- name: Setup flutter | ||
run: flutter pub get | ||
- name: Lint and format | ||
run: | | ||
dart format . -l 120 | ||
dart fix --apply | ||
flutter analyze | ||
cd example && flutter test | ||
- name: Check for modified files | ||
id: git-check | ||
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV | ||
- name: Update changes in GitHub repository | ||
if: env.modified == 'true' | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
git add -A | ||
git commit -m '[automated commit] lint format and import sort' | ||
git push | ||
uses: ./.github/workflows/code-quality.yml | ||
deploy-preview: | ||
name: Deploy preview version of the storybook on firebase | ||
needs: code-quality | ||
needs: [up-to-date, code-quality] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
This file contains 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,32 @@ | ||
name: Up to date | ||
on: | ||
workflow_call: | ||
outputs: | ||
is_up_to_date: | ||
description: "If the branch is up to date" | ||
value: ${{ jobs.up_to_date.outputs.output1 }} | ||
|
||
jobs: | ||
up_to_date: | ||
name: "Check branch is up to date" | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
outputs: | ||
is_up_to_date: ${{ steps.check.outputs.is_up_to_date }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
- name: Check branch is up to date | ||
id: check | ||
run: | | ||
behind=$(gh api /repos/${{github.event.pull_request.head.repo.full_name}}/compare/${{github.event.pull_request.base.sha}}...${{github.event.pull_request.head.sha}} | jq .behind_by) | ||
if (( $behind == 0 )); then | ||
echo "is_up_to_date=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "is_up_to_date=false" >> $GITHUB_OUTPUT | ||
fi | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- run: echo ${{ steps.check.outputs.is_up_to_date }} |