Skip to content

Commit

Permalink
Adds code coverage reporting (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgosalvez authored Dec 24, 2020
1 parent 52cf3c4 commit 35aa223
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
steps:
- name: Clone the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@e70e07ef05f0a3bf1483fde3c50eeab9c1805041 # v1.0.1
# - name: Ensure SHA pinned actions
# uses: zgosalvez/github-actions-ensure-sha-pinned-actions@e70e07ef05f0a3bf1483fde3c50eeab9c1805041 # v1.0.1

testing:
name: Run ${{ matrix.category }} testing
Expand Down Expand Up @@ -91,17 +91,15 @@ jobs:
steps:
- name: Clone the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Install lcov
run: sudo apt-get install lcov
- name: Download code coverage from GitHub
uses: actions/download-artifact@f144d3c3916a86f4d6b11ff379d17a49d8f85dbc # v2.0.7
with:
name: code-coverage
path: coverage
- name: Create HTML output for coverage data
run: genhtml coverage/lcov.unit.info coverage/lcov.widget.info --output-directory coverage/html
- name: Upload code coverage report to GitHub
uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1
- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@6c1bcd0451bee80a1ddedf6fbdd62a5d4e740e1b # v1.0.0
with:
name: code-coverage-report
path: coverage/html
coverage-files: coverage/lcov.*.info
minimum-coverage: 90
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
26 changes: 15 additions & 11 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
release:
types: [ published ]

env:
FLUTTER_DEBUG_INFO_PATH: build/app/outputs/symbols

jobs:
security_hardening:
name: Check security hardening
Expand Down Expand Up @@ -101,17 +98,16 @@ jobs:
include:
- os: ubuntu-latest
file: apk
build-file-path: code/build/app/outputs/flutter-apk/app-release.apk
asset-content-type: application/java-archive
- os: ubuntu-latest
file: aab
build-file-path: code/build/app/outputs/bundle/release/app-release.aab
asset-content-type: application/zip
- os: macos-latest
file: ipa
build-file-path: code/build/ios/iphoneos/Runner.app
asset-content-type: inode/directory
asset-content-type: application/octet-stream
fail-fast: false
env:
FLUTTER_DEBUG_INFO_PATH: build/app/outputs/symbols
steps:
- name: Check matrix
if: ${{ !(matrix.file == 'apk' && github.event.release.prerelease) || ((matrix.file == 'aab' || matrix.file == 'ipa') && !github.event.release.prerelease) }}
Expand Down Expand Up @@ -174,13 +170,19 @@ jobs:
# apk
- name: Build an Android APK file
if: matrix.file == 'apk'
run: flutter build apk --obfuscate --split-debug-info=$FLUTTER_DEBUG_INFO_PATH
run: |
flutter build apk --obfuscate --split-debug-info=$FLUTTER_DEBUG_INFO_PATH
mv build/app/outputs/flutter-apk/app-release.apk app.apk
mv code/build/app/outputs/mapping/release/mapping.txt apk-mapping.txt
working-directory: code

# aab
- name: Build an Android App Bundle file
if: matrix.file == 'aab'
run: flutter build appbundle --obfuscate --split-debug-info=$FLUTTER_DEBUG_INFO_PATH
run: |
flutter build appbundle --obfuscate --split-debug-info=$FLUTTER_DEBUG_INFO_PATH
mv code/build/app/outputs/bundle/release/app-release.aab app.aab
mv code/build/app/outputs/mapping/release/mapping.txt aab-mapping.txt
working-directory: code

# apk/aab
Expand All @@ -189,13 +191,13 @@ jobs:
uses: actions/upload-artifact@726a6dcd0199f578459862705eed35cda05af50b # v2.2.1
with:
name: ${{ matrix.file }}-mapping.txt
path: code/build/app/outputs/mapping/release/mapping.txt
path: ${{ matrix.file }}-mapping.txt
- name: Upload the release assets — ${{ matrix.file }}-mapping.txt file
if: matrix.file == 'apk' || matrix.file == 'aab'
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: code/build/app/outputs/mapping/release/mapping.txt
asset_path: ${{ matrix.file }}-mapping.txt
asset_name: ${{ matrix.file }}-mapping.txt
asset_content_type: text/plain
env:
Expand All @@ -207,6 +209,7 @@ jobs:
run: |
flutter build ios --no-codesign --obfuscate --split-debug-info=$FLUTTER_DEBUG_INFO_PATH
echo "::warning::TODO: fastlane export_ipa"
echo "TODO: mv code/build/app/outputs/ipa/app.ipa app.ipa"
working-directory: code

# all
Expand All @@ -232,6 +235,7 @@ jobs:
with:
name: app.${{ matrix.file }}
path: ${{ matrix.build-file-path }}
if-no-files-found: error
- name: Upload the release assets — ${{ matrix.file }} file
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
with:
Expand Down

0 comments on commit 35aa223

Please sign in to comment.