2023-06-16 11:05:47 +00:00
|
|
|
name: Submit coverage
|
|
|
|
|
|
|
|
# read-write repo token
|
|
|
|
# access to secrets
|
|
|
|
on:
|
|
|
|
workflow_run:
|
2023-06-16 12:16:19 +00:00
|
|
|
workflows: [Build and test]
|
|
|
|
types: [completed]
|
2023-06-16 11:05:47 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
upload:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: >
|
|
|
|
github.event.workflow_run.event == 'pull_request' &&
|
|
|
|
github.event.workflow_run.conclusion == 'success'
|
|
|
|
steps:
|
|
|
|
- name: Download artifact
|
|
|
|
uses: dawidd6/action-download-artifact@v2
|
|
|
|
with:
|
|
|
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
|
|
|
workflow_conclusion: success
|
|
|
|
name: coveralls.json
|
|
|
|
|
|
|
|
|
|
|
|
- name: 'Prepare dependencies'
|
|
|
|
run: |
|
|
|
|
sudo apt-get update && \
|
|
|
|
sudo apt-get install -yq \
|
|
|
|
jq \
|
|
|
|
curl
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: 'Generate full report'
|
2023-06-16 12:16:19 +00:00
|
|
|
run: |
|
|
|
|
cat coveralls.json | jq --arg repo_token $COVERALLS_REPO_TOKEN '. += {repo_token: $repo_token}' > coveralls_full.json
|
2023-06-16 11:05:47 +00:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: 'Upload final report'
|
|
|
|
run: |
|
|
|
|
curl --request POST \
|
|
|
|
--url https://coveralls.io/api/v1/jobs \
|
|
|
|
--header 'Content-Type: multipart/form-data' \
|
|
|
|
--form json_file=@./coveralls_full.json
|
|
|
|
shell: bash
|