Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing report #96

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 35 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
name: build

on:
pull_request_target: # Runs on PRs from forks, safely (no secrets)
pull_request_target:
push:
branches: master # Runs on direct pushes to master
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: Debug - Print GitHub Event
run: echo "Triggered by ${{ github.event_name }}"

- name: Setup Java
uses: actions/setup-java@v2
with:
Expand All @@ -34,20 +30,47 @@ jobs:
- name: Run Jacoco (No Secrets)
run: ./gradlew jacocoTestReport

- name: Upload Test Report (No Secrets)
uses: 'actions/upload-artifact@v4'
- 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: report.xml
name: coverage-report
path: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/jacocoTestReport.xml

secure-tasks:
manual-approval:
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
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:
Expand All @@ -65,4 +88,4 @@ jobs:
- name: Get Coverage Info
run: |
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"
Loading