Skip to content

Commit 591c5e5

Browse files
authored
Merge pull request #1 from zeriyoshi/pages
chore: add GitHub Pages permissions to workflow
2 parents 869a31e + c5dccbf commit 591c5e5

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

.github/workflows/coverage.yaml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Coverage
22
permissions:
33
contents: write
44
pull-requests: write
5+
pages: write
6+
id-token: write
57
on:
68
push:
79
branches:
@@ -11,6 +13,9 @@ on:
1113
- opened
1214
- synchronize
1315
- reopened
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
1419
jobs:
1520
Linux:
1621
strategy:
@@ -53,30 +58,48 @@ jobs:
5358
- name: Merge coverages
5459
run: |
5560
LCOV_FILES=$(find coverage-artifacts -name "lcov.info" -type f)
56-
61+
5762
if [ -z "$LCOV_FILES" ]; then
5863
echo "No lcov.info files found in the artifacts!"
5964
exit 1
6065
fi
61-
66+
6267
CMD="lcov"
6368
for LCOV_FILE in $LCOV_FILES; do
6469
echo "Adding coverage file: $LCOV_FILE"
6570
CMD+=" -a $LCOV_FILE"
6671
done
6772
CMD+=" -o lcov.info"
68-
73+
6974
echo "Executing: $CMD"
7075
eval $CMD
71-
76+
7277
if [ ! -f "lcov.info" ]; then
7378
echo "Failed to generate merged lcov.info file!"
7479
exit 1
7580
fi
76-
81+
7782
echo "Successfully merged $(echo $LCOV_FILES | wc -w) coverage files."
83+
- name: Generate HTML report
84+
run: |
85+
genhtml lcov.info -o coverage
7886
- name: Report coverage
7987
uses: k1LoW/octocov-action@v1
8088
with:
8189
github-token: ${{ secrets.GITHUB_TOKEN }}
8290
config: .github/octocov.yml
91+
- name: Upload pages artifact
92+
uses: actions/upload-pages-artifact@v3
93+
with:
94+
path: coverage
95+
Deploy:
96+
needs: Coverage
97+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
98+
environment:
99+
name: github-pages
100+
url: ${{ steps.deployment.outputs.page_url }}
101+
runs-on: ubuntu-latest
102+
steps:
103+
- name: Deploy to GitHub Pages
104+
id: deployment
105+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)