Skip to content

Run Integration Tests #18

Run Integration Tests

Run Integration Tests #18

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@sha256:8161077a3ff38de5d70edc766248d86bf030f8ff3e94a25b6631bd7e924174d4
#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: |
echo "TEST_DIR=${GITHUB_WORKSPACE}/integtest" >> $GITHUB_ENV
cd $GITHUB_WORKSPACE/integtest
echo "Am in $(pwd)"
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 $TEST_DIR
echo "Modified files: $(cat modified_files.txt)"
DET=fd
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 }}" $TEST_DIR/modified_files.txt \
|| grep -q "run_all_tests" $TEST_DIR/modified_files.txt; then
echo "Running tests for ${{ matrix.test_name }}"
pytest -v -s --junit-xml=${{ matrix.test_name }}_test_results.xml \
$TEST_DIR/${{ matrix.test_name }}_test.py
else
echo "Skipping tests for ${{ matrix.test_name }} as no relevant files were modified."
exit 1
fi
- name: parse results
if: always()
#uses: pmeier/pytest-results-action@8104ed7b3d3ba4bb0d550e406fc26aa756630fcc
uses: andrewmogan/pytest-results-action@1158583ebac3346e36d76969902bc1fa7b925270
with:
path: ${{ env.TEST_DIR }}/${{ matrix.test_name }}_test_results.xml
summary: true
display-options: fEX
fail-on-empty: true