From 9c7c8ca1760215b77f898d0e60d1c963b8b93a2b Mon Sep 17 00:00:00 2001 From: Quoc Huynh Date: Thu, 2 Nov 2023 17:04:53 +0100 Subject: [PATCH] Optimize workflow --- .github/workflows/main.yaml | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index bc3b394..25bde99 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -3,38 +3,28 @@ name: ruler_scale_picker on: [ push ] jobs: - lint: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2.11.0 - - name: Install Dependencies + - name: Cache dependencies + uses: actions/cache@v3 + id: cache + with: + path: | + .dart_tool/ + key: ${{ runner.os }}-dependencies-${{ hashFiles('**/pubspec.lock') }} + - name: Install dependencies run: flutter pub get - - name: Analyze - run: flutter analyze - - name: Code metrics - run: dart run dart_code_metrics:metrics analyze . --set-exit-on-violation-level=warning --disable-sunset-warning - - style_check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2.11.0 - - name: Install Dependencies - run: flutter pub get - - name: Format + - name: Format code run: dart format --set-exit-if-changed . - - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2.11.0 - - - name: Install Dependencies - run: flutter pub get + - name: Analyze code + run: flutter analyze + - name: Run Code metrics + run: dart run dart_code_metrics:metrics analyze . --set-exit-on-violation-level=warning --disable-sunset-warning - name: Run tests run: flutter test - name: Upload test artifacts @@ -55,9 +45,17 @@ jobs: run: | sudo apt update sudo apt install webp + - name: Cache dependencies + uses: actions/cache@v3 + id: cache + with: + path: | + .dart_tool/ + key: ${{ runner.os }}-dependencies-${{ hashFiles('**/pubspec.lock') }} - name: Install Dependencies run: | flutter pub get flutter pub global activate pana + - name: Verify Pub Score run: ./tool/verify_pub_score.sh