73 lines
2.1 KiB
YAML
73 lines
2.1 KiB
YAML
name: Coveralls
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [Linux]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
finish:
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 'Download artifacts'
|
|
uses: actions/github-script@v3.1.0
|
|
with:
|
|
script: |
|
|
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{github.event.workflow_run.id}},
|
|
});
|
|
var matchArtifacts = artifacts.data.artifacts;
|
|
for (artifact of matchArtifacts) {
|
|
var download = await github.actions.downloadArtifact({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
artifact_id: artifact.id,
|
|
archive_format: 'zip',
|
|
});
|
|
var fs = require('fs');
|
|
fs.writeFileSync('${{github.workspace}}/' + artifact.name + '.zip', Buffer.from(download.data));
|
|
}
|
|
|
|
- name: Unpack artifacts
|
|
run: |
|
|
unzip *.zip
|
|
|
|
- name: Generate Coverage
|
|
run: |
|
|
lcov --directory . --capture --output-file coverage.info
|
|
lcov --remove coverage.info \
|
|
'*/install/include/*' \
|
|
'*/msys64/mingw32/*' \
|
|
'*/msys64/mingw64/*' \
|
|
'*/src/*_unittest.cc' \
|
|
'*/src/googletest.h' \
|
|
'*/src/mock-log.h' \
|
|
'/usr/*' \
|
|
--output-file coverage.info
|
|
|
|
readarray -t build_dirs < <(ls -d build*/)
|
|
|
|
for file in src/glog/*.h.in; do
|
|
name=$(basename ${file})
|
|
name_we=${name%.h.in}
|
|
|
|
for build_dir in ${build_dirs[@]}; do
|
|
sed -i "s|${build_dir%/}/glog/${name_we}.h\$|${file}|g" coverage.info
|
|
done
|
|
done
|
|
|
|
lcov --list coverage.info
|
|
|
|
- name: Upload Coverage to Coveralls
|
|
uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
path-to-lcov: ./coverage.info
|