Skip to content

Commit

Permalink
ci: add code coverage with codecov (#1419)
Browse files Browse the repository at this point in the history
* ci: add code coverage with codecov

* ci: use correct command to invoke codecov

* ci: move codecov to push so that we always have the latest codecov when forking

See https://docs.codecov.com/docs/error-reference#section-missing-base-commit

* ci: use codecov action instead of cli
  • Loading branch information
VaiTon authored Mar 31, 2022
1 parent 8693f0b commit fd58afc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,45 @@ jobs:
distribution: 'zulu'
java-version: 11

# Setup flutter
- uses: actions/checkout@v3
# Setup flutter
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: flutter2.10 #change this to force refresh cache

- run: flutter --version

# Get dependencies.
- name: "Get dependencies"
- name: Get dependencies
run: ci/pub_upgrade.sh

# Check for formatting issues
- name: Check for formatting issues (run "flutter format . ")
run: flutter format --set-exit-if-changed .

# analyze Dart for errors
- name: "Analyze code"
- name: Analyze code
run: flutter analyze --fatal-infos --fatal-warnings .

# Run tests
- name: "Run Tests"
- name: Run Tests with coverage
run: ci/testing.sh

- name: Upload coverage to codecov
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
verbose: true

# Build apk.
- name: "Build apk"
- name: Build APK
run: flutter build apk --debug
working-directory: ./packages/smooth_app

# Upload generated apk to the artifacts.
- name: "Upload APK"
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: release-apk
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: SmoothApp Presubmit Tests
name: SmoothApp Pre-Submit Tests

on: pull_request

Expand All @@ -8,32 +8,33 @@ jobs:
defaults:
run:
shell: bash

steps:
- name: "Checkout code"
- name: Checkout code
uses: actions/checkout@v3

# Setup flutter
- uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: flutter2.10 #change this to force refresh cache

- run: flutter --version

# Get dependencies.
- name: "Get dependencies"
- name: Get dependencies
run: ci/pub_upgrade.sh

# Check for formatting issues
- name: Check for formatting issues (run "flutter format . ")
run: flutter format --set-exit-if-changed .

# analyze Dart for errors
- name: "Analyze code"
- name: Analyze code
run: flutter analyze --fatal-infos --fatal-warnings .

# Run tests
- name: "Run Tests"
- name: Run Tests with coverage
run: ci/testing.sh

2 changes: 1 addition & 1 deletion ci/testing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [[ "$SHARD" == "test" ]]; then
echo "Running tests."
for file in "$REPO_DIR/packages/"*; do
if [[ -d $file ]]; then
(cd "$file" && flutter test)
(cd "$file" && flutter test --coverage)
fi
done
fi

0 comments on commit fd58afc

Please sign in to comment.