-
Notifications
You must be signed in to change notification settings - Fork 58
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
778da81
commit 8ff5d8c
Showing
7 changed files
with
148 additions
and
112 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,82 @@ | ||
name: Unit test coverage | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
sdk: | ||
required: true | ||
type: string | ||
previous_commit_sha: | ||
required: true | ||
type: string | ||
use_cached_coverage: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
test-ddc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dart-lang/setup-dart@v1 | ||
with: | ||
sdk: ${{ inputs.sdk }} | ||
|
||
- name: Run Tests (DDC + coverage) | ||
if: ${{ !inputs.use_cached_coverage }} | ||
run: dart run dart_dev test --test-args="--coverage=reports/coverage" -P dartdevc | ||
|
||
- name: Upload New Coverage Data | ||
if: ${{ !inputs.use_cached_coverage }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage | ||
path: reports/coverage | ||
|
||
generate-coverage: | ||
runs-on: ubuntu-latest | ||
needs: [ test-ddc ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dart-lang/setup-dart@v1 | ||
with: | ||
sdk: ${{ inputs.sdk }} | ||
- name: Download Package Config | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: package_config@${{ inputs.sdk }} | ||
path: .dart_tool | ||
|
||
- name: Download New Coverage Data | ||
if: ${{ !inputs.use_cached_coverage }} | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage | ||
path: reports/coverage | ||
|
||
- name: Download Cached Coverage Data | ||
if: ${{ inputs.use_cached_coverage }} | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
reports/coverage | ||
key: coverage@${{ inputs.previous_commit_sha }} | ||
|
||
- name: Activate Coverage Package | ||
run: dart pub global activate coverage | ||
|
||
- name: Format Coverage | ||
run: dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o reports/coverage/lcov.info -i reports/coverage | ||
|
||
- name: Cache Coverage Data | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: | | ||
reports/coverage | ||
key: coverage@${{ github.sha }} | ||
|
||
- name: Report Coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: reports/coverage/lcov.info |
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
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
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
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
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
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