Skip to content

Run Integration Tests #9

Run Integration Tests

Run Integration Tests #9

name: Run Integration Tests
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
#push:
# branches:
# - develop
# paths-ignore:
# - 'docs/**'
# - '.github/**'
#pull_request:
# branches:
# - develop
workflow_dispatch:
inputs:
branch-name:
description: 'branch to use when running tests.'
default: develop
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"
run_integration_tests:
name: run_tests
runs-on: ubuntu-latest
needs: [make_nightly_tag]
timeout-minutes: 30
container:
image: ghcr.io/dune-daq/nightly-release-alma9:development_v5
strategy:
fail-fast: false
matrix:
test_name: [
"minimal_system_quick",
"3ru_1df_multirun",
"example_system",
"long_window_readout",
"small_footprint_quick",
"tpstream_writing",
]
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch-name }}
- name: Troubleshoot paths
run: |
echo "Github workspace: $GITHUB_WORKSPACE"
echo "ls Github workspace: $(ls $GITHUB_WORKSPACE)"
echo "Where is daqsystemtest?
$(find $GITHUB_WORKSPACE -name daqsystemtest -type d) > daqsystemtest_dirs.txt"
for dir in $(cat daqsystemtest_dirs.txt); do
echo "I'm in $dir and there's $(ls $dir)"
done
- name: Get modified files list
id: get_modified_files
# Determine modified files depending on whether the triggering event was a PR or push
run: |
cd $GITHUB_WORKSPACE/daqsystemtest
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} > modified_files.txt
elif [[ "${{ github.event_name }}" == "push" ]]; then
git diff --name-only ${{ github.event.before }} ${{ github.sha }} > modified_files.txt
else
echo "run_all_tests" > modified_files.txt
fi
- name: setup release and run tests
env:
NIGHTLY_TAG: ${{needs.make_nightly_tag.outputs.tag}}
run: |
cd $GITHUB_WORKSPACE/daqsystemtest
#echo "Modified files: $(cat modified_files.txt)"
echo "daqsystemtest path? $(ls $GITHUB_WORKSPACE/daqsystemtest)"
DET=fd
mkdir -p $GITHUB_WORKSPACE/daqsystemtest_integration_tests_$NIGHTLY_TAG
cd $GITHUB_WORKSPACE/daqsystemtest_integration_tests_$NIGHTLY_TAG
source /cvmfs/dunedaq.opensciencegrid.org/setup_dunedaq.sh
setup_dbt latest_v5
#[[ -e /cvmfs/dunedaq-development.opensciencegrid.org/nightly/$NIGHTLY_TAG/daq_app_rte.sh ]]
dbt-setup-release -n $NIGHTLY_TAG
if grep -q "${{ matrix.test_name }}" $GITHUB_WORKSPACE/daqsystemtest/modified_files.txt \
|| grep -q "run_all_tests" $GITHUB_WORKSPACE/daqsystemtest/modified_files.txt; then
echo "Running tests for ${{ matrix.test_name }}"
pytest -v -s --junit-xml=${{ matrix.test_name }}_test_results.xml \
$GITHUB_WORKSPACE/daqsystemtest/integtest/${{ matrix.test_name }}_test.py
else
echo "Skipping tests for ${{ matrix.test_name }} as no relevant files were modified."
fi