Skip to content

Commit e5c2408

Browse files
authored
Merge pull request #96 from Tribler/fix/build-issues
Fix missing report
2 parents d195403 + 6c0ef07 commit e5c2408

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
name: build
22

33
on:
4-
pull_request_target: # Runs on PRs from forks, safely (no secrets)
4+
pull_request_target:
55
push:
6-
branches: master # Runs on direct pushes to master
6+
branches: master
77

88
jobs:
99
test:
1010
runs-on: ubuntu-latest
11-
1211
steps:
1312
- name: Checkout PR Code Securely
1413
uses: actions/checkout@v3
1514
with:
1615
ref: ${{ github.event.pull_request.head.sha }}
1716

18-
- name: Debug - Print GitHub Event
19-
run: echo "Triggered by ${{ github.event_name }}"
20-
2117
- name: Setup Java
2218
uses: actions/setup-java@v2
2319
with:
@@ -34,20 +30,47 @@ jobs:
3430
- name: Run Jacoco (No Secrets)
3531
run: ./gradlew jacocoTestReport
3632

37-
- name: Upload Test Report (No Secrets)
38-
uses: 'actions/upload-artifact@v4'
33+
- name: Debug - Verify Coverage Report Exists
34+
run: ls -la ${{ github.workspace }}/ipv8/build/reports/jacoco/test/
35+
36+
- name: Upload Test Coverage Report
37+
uses: actions/upload-artifact@v4
3938
with:
40-
name: report.xml
39+
name: coverage-report
4140
path: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/jacocoTestReport.xml
4241

43-
secure-tasks:
42+
manual-approval:
4443
needs: test
4544
runs-on: ubuntu-latest
46-
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false # Runs only if merged or trusted contributor
45+
if: github.event.pull_request.head.repo.fork == true
46+
steps:
47+
- name: Request Maintainer Approval
48+
uses: hmarr/auto-approve-action@v3
49+
with:
50+
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Pause for Maintainer Approval
53+
run: |
54+
echo "A maintainer must approve this job before secrets are used."
55+
exit 1
56+
57+
secure-tasks:
58+
needs: [test, manual-approval]
59+
runs-on: ubuntu-latest
60+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork == false
4761
steps:
4862
- name: Checkout Latest Code
4963
uses: actions/checkout@v3
5064

65+
- name: Download Test Coverage Report
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: coverage-report
69+
path: ${{ github.workspace }}/ipv8/build/reports/jacoco/test/
70+
71+
- name: Debug - Verify Coverage Report Exists After Download
72+
run: ls -la ${{ github.workspace }}/ipv8/build/reports/jacoco/test/
73+
5174
- name: Upload Coverage to Codecov (Requires Secrets)
5275
uses: codecov/codecov-action@v1
5376
with:
@@ -65,4 +88,4 @@ jobs:
6588
- name: Get Coverage Info
6689
run: |
6790
echo "Total coverage ${{ steps.jacoco.outputs.coverage-overall }}"
68-
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"
91+
echo "Changed Files coverage ${{ steps.jacoco.outputs.coverage-changed-files }}"

0 commit comments

Comments
 (0)