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

patch-refactoring #12

Merged
merged 13 commits into from
Mar 17, 2024
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
6 changes: 5 additions & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"flutter": "3.10.2"
"flutter": "3.10.2",
"flavors": {
"prod": "3.10.2",
"dev": "3.13.9"
}
}
75 changes: 0 additions & 75 deletions .github/workflows/cd-web.yml

This file was deleted.

90 changes: 0 additions & 90 deletions .github/workflows/ci-cd-test-and-preview.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/ci-codecov.yml

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Test

on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
- "**/*.yaml"
- policies/*
- repo-assets/*
- configs/*

pull_request:
types: [review_requested]
paths-ignore:
- "**/*.md"
- "**/*.yaml"
- policies/*
- repo-assets/*
- configs/*

jobs:
test:
strategy:
fail-fast: false
matrix:
dir:
- packages/screen_pal_core
- .

runs-on: ubuntu-latest

defaults:
run:
working-directory: ${{ matrix.dir }}

steps:
- name: 📚 Git Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: 🐦 Setup Flutter SDK v3.10.x
uses: subosito/flutter-action@v2
with:
flutter-version: 3.10.x
channel: stable
cache: true
cache-key: |
flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}

- name: 📦 Get dependencies
run: flutter pub get

- name: ⚙️ Setup environment
run: |
echo "${{secrets.DEV_ENV_FILE}}" > .env
dart run build_runner build -d

- name: ✨ Check Formatting
run: dart format lib --line-length 80 --set-exit-if-changed

- name: 🕵️ Analyze code
id: first-analyze
continue-on-error: true
run: flutter analyze lib test

- name: ♻️🕵️ Re-analyze code
if: steps.first-analyze.outcome == 'failure'
run: |
flutter clean
flutter pub get
flutter analyze lib test

- name: 🕵️ Run custom_lint
run: |
if grep -q custom_lint "pubspec.yaml"; then
dart run custom_lint
fi

- name: 🧪 Run tests
id: test
run: |
if test -d "test"; then
flutter test --coverage
echo "RESULT=tested" >> "${GITHUB_OUTPUT}"
fi

# - name: 📊 Filter and Check Code Coverage
# if: ${{steps.test.outputs.RESULT == 'tested'}}
# run: |
# dart pub global activate clean_coverage
# clean_coverage clean coverage/lcov.info --exclusions "**.g.dart","**.freezed.dart","**/interfaces/**"
# dart pub global activate dlcov
# dlcov -c 80

- name: 📝 Upload coverage to codecov
if: ${{steps.test.outputs.RESULT == 'tested'}}
run: curl -s https://codecov.io/bash | bash
80 changes: 80 additions & 0 deletions .github/workflows/web-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Web Preview

on:
pull_request:
branches: [main]
types: [review_requested]
paths-ignore:
- "**/*.md"
- policies/*
- repo-assets/*
- configs/*

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 📚 Git Checkout
uses: actions/checkout@v3

- name: 🐦 Setup Flutter SDK v3.10.x
uses: subosito/flutter-action@v2
with:
flutter-version: 3.10.x
channel: stable
cache: true
cache-key: |
flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}

- name: 📦 Get dependencies
run: flutter pub get

- name: ⚙️ Setup environment
run: |
echo "${{secrets.DEV_ENV_FILE}}" > .env
dart run build_runner build -d

- name: ⚙️ Setup web build
working-directory: web
run: |
cp ../configs/netlify/404.html 404.html

- name: 🏗️ Build web
run: flutter build web --profile --web-renderer canvaskit

- name: 📝 Upload build-web-preview
uses: actions/upload-artifact@v2
with:
name: build-web-preview
path: ./build/web

deploy-preview:
needs: build
permissions:
pull-requests: read
contents: write

runs-on: ubuntu-latest

steps:
- name: 📚 Git Checkout "preview" branch
uses: actions/checkout@v3
with:
ref: preview

- name: 📝 Download build-web-preview
uses: actions/download-artifact@v2
with:
name: build-web-preview
path: ./

- name: 📚 Push build to preview branch
env:
PR_REF: https://github.com/KeidsID/screen_pal/pull/${{github.event.pull_request.number}}
run: |
git config --global user.email "keidscode@gmail.com"
git config --global user.name "KeidsID"
git add .
git commit -m "web-preview build from PR ${{env.PR_REF}}"
git push origin preview
Loading
Loading