Skip to content

Weekly code coverage workflow #2

Weekly code coverage workflow

Weekly code coverage workflow #2

name: Weekly code coverage workflow
on:
workflow_dispatch:
inputs:
send-slack-message:
description: 'whether to send a message to #daq-release-notifications on completion'
default: 'no'
#schedule:
# - cron: "0 18 * * 0"
jobs:
make_nightly_tag:
name: create nightly tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.create_nightly_tag.outputs.nightly_tag }}
defaults:
run:
shell: bash
steps:
- id: create_nightly_tag
run: |
date_tag=$(date +%y%m%d)
echo "nightly_tag=NFD_DEV_${date_tag}_A9" >> "$GITHUB_OUTPUT"
cat "$GITHUB_OUTPUT"
generate_code_coverage_report:
name: Generate code coverage report
runs-on: daq
needs: make_nightly_tag
outputs:
coverage_results_dir: ${{ steps.run_lcov.outputs.results_dir }}
defaults:
run:
shell: bash
steps:
- name: Checkout daq-release
uses: actions/checkout@v4
with:
path: daq-release-lcov
- name: Create build area
id: create_build_area
run: |
source /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh
setup_dbt latest_v5
dbt-create -n ${{ needs.make_nightly_tag.outputs.tag }}
cd ${{ needs.make_nightly_tag.outputs.tag }}
source env.sh
cd ../daq-release-lcov/scripts
#./checkout-daq-package.py -i ../configs/coredaq/coredaq-develop/release.yaml -a -o ${DBT_AREA_ROOT}/sourcecode
#./checkout-daq-package.py -i ../configs/fddaq/fddaq-develop/release.yaml -a -o ${DBT_AREA_ROOT}/sourcecode
./checkout-daq-package.py -p hdf5libs -b develop -i ../configs/coredaq/coredaq-develop/release.yaml -o ${DBT_AREA_ROOT}/sourcecode
./checkout-daq-package.py -p flxlibs -b develop -i ../configs/fddaq/fddaq-develop/release.yaml -o ${DBT_AREA_ROOT}/sourcecode
echo "DBT_AREA_ROOT=${DBT_AREA_ROOT}" >> "$GITHUB_ENV"
- name: Run dbt-lcov.sh
id: run_lcov
run: |
cd $DBT_AREA_ROOT/
source env.sh
dbt-workarea-env
# spack load dbe
dbt-lcov.sh
echo "coverage_results_dir=${DBT_AREA_ROOT}/code_coverage_results" >> "$GITHUB_OUTPUT"
deploy_to_github_pages:
name: Deploy to GitHub Pages
runs-on: daq
needs: generate_code_coverage_report
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ needs.generate_code_coverage_report.outputs.coverage_results_dir }}
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
send_slack_message:
if: (github.event_name != 'workflow_dispatch' && failure()) || (github.event_name == 'workflow_dispatch' && github.event.inputs.send-slack-message == 'yes')
needs: deploy_to_github_pages
uses: ./.github/workflows/slack-notification.yml
secrets:
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
cleanup_test_area:
runs-on: daq
if: always()
needs: [make_nightly_tag, deploy_to_github_pages]
steps:
- name: Remove test directory
run: |
rm -rf daq-release-lcov
rm -rf ${{ needs.make_nightly_tag.outputs.tag }}