Merge pull request #135 from threefoldtech/development_upgrade #455
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
name: Upload Coverage | |
on: | |
pull_request: | |
branches: | |
- development | |
push: | |
branches: | |
- development | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Repository | |
uses: actions/checkout@v4 | |
- name: List Files | |
run: ls -R | |
- name: Setup Dart SDK | |
uses: dart-lang/[email protected] | |
with: | |
sdk: "3.6.1" | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.27.2" | |
- name: Install Melos | |
run: dart pub global activate melos | |
- name: Install dependencies | |
run: melos bootstrap | |
- name: Start TFChain Docker Container | |
run: | | |
sudo docker run -d --network host ghcr.io/threefoldtech/tfchain --dev --rpc-cors all --rpc-external --rpc-methods=safe | |
- name: Wait for TFChain to be ready | |
run: | | |
while ! nc -z localhost 9944; do | |
echo "Waiting for TFChain to be ready..." | |
sleep 5 | |
done | |
- name: Run unit tests and generate coverage | |
run: | | |
melos exec rm -rf coverage | |
melos run unit_test | |
- name: Create coverage directory | |
run: mkdir -p coverage | |
- name: Calculate and merge coverage | |
if: success() | |
run: | | |
melos exec --dir-exists="coverage" -- bash -c 'dart pub global run coverde filter --input coverage/lcov.info --output coverage/filtered.lcov.info --filters .g.dart' | |
melos exec --dir-exists="coverage" -- bash -c 'dart pub global run coverde value -i coverage/filtered.lcov.info > coverage/result.txt' | |
- name: Upload coverage to Codecov | |
if: success() | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage/filtered.lcov.info |