Merge pull request #94 from Tribler/fix/build-issues #203
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: build | |
on: | |
pull_request_target: # Runs on PRs from forks, safely (no secrets) | |
push: | |
branches: master # Runs on direct pushes to master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PR Code Securely | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Debug - Print GitHub Event | |
run: echo "Triggered by ${{ github.event_name }}" | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
java-package: jdk | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Run Check (No Secrets) | |
run: ./gradlew check | |
- name: Run Jacoco (No Secrets) | |
run: ./gradlew jacocoTestReport | |
- name: Upload Test Report (No Secrets) | |
uses: 'actions/upload-artifact@v4' | |
with: | |
name: report.xml | |
path: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/jacocoTestReport.xml | |
secure-tasks: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false # Runs only if merged or trusted contributor | |
steps: | |
- name: Checkout Latest Code | |
uses: actions/checkout@v3 | |
- name: Upload Coverage to Codecov (Requires Secrets) | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Add Coverage to PR (Requires Secrets) | |
id: jacoco | |
uses: madrapps/jacoco-report@v1.7.1 | |
with: | |
paths: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/jacocoTestReport.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
min-coverage-overall: 60 | |
min-coverage-changed-files: 80 | |
- name: Get Coverage Info | |
run: | | |
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}" | |
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}" |