Skip to content

Merge pull request #96 from Tribler/fix/build-issues #206

Merge pull request #96 from Tribler/fix/build-issues

Merge pull request #96 from Tribler/fix/build-issues #206

Workflow file for this run

name: build
on:
pull_request_target:
push:
branches: 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: 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: Debug - Verify Coverage Report Exists
run: ls -la ${{ github.workspace }}/ipv8/build/reports/jacoco/test/
- name: Upload Test Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/jacocoTestReport.xml
manual-approval:
needs: test
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.fork == true
steps:
- name: Request Maintainer Approval
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Pause for Maintainer Approval
run: |
echo "A maintainer must approve this job before secrets are used."
exit 1
secure-tasks:
needs: [test, manual-approval]
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false
steps:
- name: Checkout Latest Code
uses: actions/checkout@v3
- name: Download Test Coverage Report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/
- name: Debug - Verify Coverage Report Exists After Download
run: ls -la ${{ github.workspace }}/ipv8/build/reports/jacoco/test/
- 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 }}"