diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 000000000..fac556b44 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,35 @@ + +name: Codecov + +on: + pull_request: + push: + branches: [main] + +jobs: + codecov: + container: + image: swift:5.3.2-bionic + runs-on: ubuntu-latest + steps: + - run: apt-get update && apt-get install -y gtk+-3.0 libgtk+-3.0 + - name: Checkout Branch + uses: actions/checkout@v2 + - name: Build Test Target + run: swift build --enable-test-discovery -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests + - name: Run Tests + run: swift test --enable-test-discovery --enable-code-coverage --skip-build + - name: Generate Branch Coverage Report + uses: mattpolzin/swift-codecov-action@0.6.1 + id: cov + with: + MINIMUM_COVERAGE: 20 + - name: Post Positive Results + if: ${{ success() }} + run: | + echo "::warning file=Package.swift,line=1,col=1::The current code coverage percentage is passing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)." + - name: Post Negative Results + if: ${{ failure() }} + run: | + echo "::error file=Package.swift,line=1,col=1::The current code coverage percentage is failing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)." +