Skip to content

Merge pull request #1042 from DUNE-DAQ/johnfreeman/merge_in_rc2 #1417

Merge pull request #1042 from DUNE-DAQ/johnfreeman/merge_in_rc2

Merge pull request #1042 from DUNE-DAQ/johnfreeman/merge_in_rc2 #1417

Workflow file for this run

name: Run pytest
on:
# Run on any pushes to the main branch which releases are generated from
push:
branches:
- develop
- 'prep-release/**'
pull_request:
branches:
- develop
- 'prep-release/**'
# If taking a PR out of draft mode, run the workflow on the PR event as well
types: [opened, synchronize, reopened, ready_for_review]
# Cancel any running jobs for this same branch if a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
install_and_test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: ghcr.io/dune-daq/nightly-release-alma9:development_v5
steps:
- name: Check URLs
run: |
echo https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/druncschema.git
echo https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/drunc.git
- name: Install SSH and run the daemon
run: |
dnf install -y openssh-server
dnf install -y openssh-clients
ssh-keygen -A
mkdir -p /root/.ssh
ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
chmod 600 /root/.ssh/id_rsa
# Create SSH config file in the correct location
cat > /root/.ssh/config << 'EOF'
Host localhost
HostName 127.0.0.1
User root
IdentityFile /root/.ssh/id_rsa
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF
# Start SSH daemon
/usr/sbin/sshd
# Test SSH connection
ssh localhost echo "SSH is working"
- name: Set up dev nightly
if: ${{ !cancelled() }}
run: |
mkdir nightly
cd nightly
source /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh
setup_dbt latest_v5
dbt-create -n last_fddaq
cd NFD_DEV*
source env.sh
dbt-build
dbt-workarea-env
- name: Install druncschema and drunc
if: success()
run: |
cd nightly/NFD_DEV* || true
source env.sh
python -m pip install --upgrade pip
cd sourcecode
git clone https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/druncschema.git -b ${{ github.head_ref }} || git clone https://github.com/DUNE-DAQ/druncschema.git
git clone https://github.com/${{ github.event.pull_request.head.repo.owner.login }}/drunc.git -b ${{ github.head_ref }} || git clone https://github.com/DUNE-DAQ/drunc.git
cd druncschema
pip install .[test]
cd -
cd drunc
pip install .[test]
echo "DRUNC_DIR=$(pwd)" >> $GITHUB_ENV
- name: Test with pytest/pytest-cov
if: success()
run: |
cd nightly/NFD_DEV* || true
source env.sh
cd sourcecode/drunc || true
pip install pytest pytest-cov
pytest --junitxml=junit/test-results.xml --cov=drunc --cov-report=html
- name: Publish JUnit test report
uses: mikepenz/action-junit-report@v5
if: ${{ !cancelled() }}
with:
report_paths: '${{ env.DRUNC_DIR }}/junit/test-results.xml'
# - name: Deploy HTML coverage to GitHub Pages
# if: ${{ !cancelled() }}
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ${{ env.DRUNC_DIR }}/htmlcov/
# destination_dir: coverage/${{ github.ref_name }} # This adds the branch name to the URL
# publish_branch: gh-pages
# - name: Comment on PR
# if: ${{ !cancelled() }}
# uses: actions/github-script@v7
# with:
# script: |
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Coverage report: https://dune-daq.github.io/drunc/coverage/${{ github.ref_name }}/index.html'
# })
# - name: Upload JUnit test report
# if: ${{ !cancelled() }}
# uses: actions/upload-artifact@v4
# with:
# name: junit-report
# path: ${{ env.DRUNC_DIR }}/junit/test-results.xml
# if-no-files-found: error
# retention-days: 7
- name: Upload coverage report (HTML)
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: html-coverage-report
path: ${{ env.DRUNC_DIR }}/htmlcov/
if-no-files-found: error
retention-days: 7