generated from EVerest/everest-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Heinrich <[email protected]>
- Loading branch information
Showing
3 changed files
with
123 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,11 @@ on: | |
required: false | ||
default: 'build/gcovr-coverage' | ||
type: string | ||
coverage_xml_path: | ||
description: 'The path to the coverage xml, relative to the github workspace' | ||
required: false | ||
default: 'build/coverage.xml' | ||
type: string | ||
coverage_deploy_target_repo: | ||
description: 'The repository to deploy the coverage report to' | ||
required: true | ||
|
@@ -148,6 +153,11 @@ on: | |
required: false | ||
default: 'true' | ||
type: string | ||
run_coverage_badge_creation: | ||
description: 'Run coverage badge creation' | ||
required: false | ||
default: '${{ inputs.run_coverage == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}' | ||
type: string | ||
run_install: | ||
description: 'Run install' | ||
required: false | ||
|
@@ -298,16 +308,23 @@ jobs: | |
if-no-files-found: error | ||
name: coverage-report | ||
path: ${{ inputs.coverage_report_path }} | ||
- name: Archive coverage xml | ||
if: ${{ steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
if-no-files-found: error | ||
name: coverage-xml | ||
path: ${{ inputs.coverage_xml_path}} | ||
- name: Deploy html coverage report | ||
id: deploy_coverage_report | ||
if: ${{ steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' }} | ||
# LTODO update tag | ||
uses: everest/everest-ci/github-actions/deploy-ci-logs@feature/add-reusable-ci-workflow | ||
uses: everest/everest-ci/github-actions/deploy-ci-artifact@feature/add-reusable-ci-workflow | ||
with: | ||
target_repo: ${{ inputs.coverage_deploy_target_repo }} | ||
target_logs_name: coverage-report | ||
logs_dir: ${{ inputs.coverage_report_path }} | ||
github_token: ${{ secrets.coverage_deploy_token }} | ||
artifact_name: coverage-report | ||
artifact_directory: ${{ inputs.coverage_report_path }} | ||
- name: Write summary coverage | ||
if: ${{ steps.run_coverage.outcome == 'success' || steps.run_coverage.outcome == 'failure' }} | ||
run: | | ||
|
@@ -413,3 +430,30 @@ jobs: | |
display-options: fEX | ||
fail-on-empty: True | ||
title: Test results | ||
create_coverage_badge: | ||
name: Create Coverage Badge | ||
needs: | ||
- build | ||
runs-on: ${{ inputs.runner }} | ||
if: ${{ inputs.run_coverage_badge_creation == 'true' }} | ||
steps: | ||
- name: Download coverage report | ||
uses: actions/[email protected] | ||
with: | ||
if-no-files-found: error | ||
name: coverage-xml | ||
path: coverage-xml | ||
- name: Generate coverage badge | ||
run: | | ||
# LTODO install in docker image | ||
pip install genbadge[all] | ||
mkdir -p ${{ github.workspace }}/coverage-badge/ | ||
genbadge -i ${{ github.workspace }}/coverage-xml/gcovr-coverage-xml.xml -o ${{ github.workspace }}/coverage-badge/coverage-badge.svg -n "Coverage" --local -v | ||
- name: Deploy coverage badge | ||
# LTODO update version | ||
uses: everest/everest-ci/github-actions/deploy-ci-artifact@feature/add-reusable-ci-workflow | ||
with: | ||
target_repo: ${{ github.repository }} | ||
github_token: ${{ secrets.SA_GITHUB_PAT }} | ||
artifact_name: coverage-badge | ||
artifact_directory: ${{ github.workspace }}/coverage-badge/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: 'Deploy CI Artifact' | ||
description: 'Deploy CI artifact to a github pages repository' | ||
inputs: | ||
target_repo: | ||
description: 'Repository to deploy artifact to' | ||
required: true | ||
github_token: | ||
description: 'Github token, with write access to the target repository' | ||
required: true | ||
source_repo: | ||
description: 'Repository to deploy artifact from' | ||
required: true | ||
default: ${{ github.repository }} | ||
workflow_run_id: | ||
description: 'Workflow run id to deploy logs from' | ||
required: true | ||
default: ${{ github.run_id }} | ||
deploy_global_artifact: | ||
description: 'Deploy global artifact, without workflow_run_id' | ||
required: false | ||
default: false | ||
artifact_name: | ||
description: 'Name of the artifact to deploy' | ||
required: true | ||
artifact_directory: | ||
description: 'Directory or containing the artifact to deploy' | ||
required: true | ||
outputs: | ||
deployed_path: | ||
description: 'Path to the deployed logs' | ||
value: ${{ steps.determine_target_path.outputs.target_path }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Configure git | ||
shell: bash | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Github Service Account" | ||
- name: Checkout target repository | ||
uses: actions/[email protected] | ||
with: | ||
repository: ${{ inputs.target_repo }} | ||
path: gh-pages-repo | ||
token: ${{ inputs.github_token }} | ||
ref: main | ||
- name: Determine target path | ||
id: determine_target_path | ||
shell: bash | ||
run: | | ||
if [ "${{ inputs.deploy_global_artifact }}" = "true" ]; then | ||
target_path="ci-artifacts/${{ inputs.source_repo }}/${{ inputs.artifact_name }}" | ||
else | ||
target_path="ci-artifacts/${{ inputs.source_repo }}/${{ inputs.workflow_run_id }}/${{ inputs.artifact_name }}" | ||
fi | ||
echo "target_path=$target_path" >> $GITHUB_OUTPUT | ||
- name: Copy Artifact | ||
shell: bash | ||
run: | | ||
mkdir -p gh-pages-repo/${{ steps.determine_target_path.outputs.target_path }} | ||
if [ "${{ inputs.deploy_global_artifact }}" = "true" ]; then | ||
rm -rf gh-pages-repo/${{ steps.determine_target_path.outputs.target_path }}/* | ||
fi | ||
cp -r ${{ inputs.artifact_directory }}/* gh-pages-repo/${{ steps.determine_target_path.outputs.target_path }} | ||
- name: Commit and push logs | ||
shell: bash | ||
run: | | ||
git add ${{ steps.determine_target_path.outputs.target_path }} | ||
if [ "${{ inputs.deploy_global_artifact }}" = "true" ]; then | ||
commit_message="Deploy global artifact and remove old one: ${{ inputs.source_repo }}/${{ inputs.artifact_name }}" | ||
else | ||
git commit -m "Deploy new artifact: ${{ inputs.source_repo }}/${{ inputs.workflow_run_id }}/${{ inputs.artifact_name }}" | ||
fi | ||
git commit -m "$commit_message" | ||
git push | ||
working-directory: gh-pages-repo |
This file was deleted.
Oops, something went wrong.