mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
Add workflow to upload metrics
This commit is contained in:
41
.github/workflows/csv-coverage-metrics.yml
vendored
Normal file
41
.github/workflows/csv-coverage-metrics.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: "Publish framework coverage as metrics"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- ".github/workflows/csv-coverage-metrics.yml"
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup CodeQL
|
||||
uses: ./.github/actions/fetch-codeql
|
||||
- name: Create empty database
|
||||
run: |
|
||||
DATABASE="${{ runner.temp }}/java-database"
|
||||
PROJECT="${{ runner.temp }}/java-project"
|
||||
mkdir -p $PROJECT/src/tmp/empty
|
||||
echo "class Empty {}" >> $PROJECT/src/tmp/empty/Empty.java
|
||||
codeql database create $DATABASE --language=java --source-root=$PROJECT --command 'javac src/tmp/empty/Empty.java'
|
||||
- name: Capture coverage information
|
||||
run: |
|
||||
DATABASE="${{ runner.temp }}/java-database"
|
||||
codeql database analyze --format=sarif-latest --output=metrics.sarif -- $DATABASE ./java/ql/src/Diagnostics/CoverageDiagnostics.ql
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: metrics.sarif
|
||||
path: metrics.sarif
|
||||
retention-days: 20
|
||||
- name: Upload SARIF file
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: metrics.sarif
|
||||
Reference in New Issue
Block a user