Simplify Eventdisplay CI #253
Workflow file for this run
This file contains hidden or 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
| --- | |
| name: v2dl3-Eventdisplay-CI | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - 'utils/**vegas**' | |
| - '.github/v2dl3-vegas.yml' | |
| - '.git*' | |
| - 'CITATION.cff' | |
| - 'environment-vegas.yml' | |
| - 'LICENSE' | |
| - 'README.md' | |
| - 'setup.py' | |
| workflow_dispatch: | |
| inputs: | |
| generate_reference: | |
| description: 'Generate reference files instead of testing' | |
| required: false | |
| default: false | |
| type: boolean | |
| env: | |
| GENERATE_REFERENCE: ${{ github.event.inputs.generate_reference || false }} | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.13"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Pip install | |
| run: | | |
| pip install .[tests] | |
| - name: pytest | |
| shell: bash -leo pipefail {0} | |
| run: | | |
| pytest . | |
| - name: Cache test data | |
| id: cache-test-data | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| 64080.anasum.root | |
| effectiveArea.root | |
| 64080.db.fits.gz | |
| 64080.allevents.anasum.root | |
| eventfilter.yml | |
| ED-*.fits.gz | |
| key: eventdisplay-test-data-v1 | |
| - name: Download test data | |
| if: steps.cache-test-data.outputs.cache-hit != 'true' | |
| env: | |
| TEST_DATA_URL: ${{ secrets.EVENTDISPLAY_TEST_DATA_URL }} | |
| run: | | |
| if [ -z "$TEST_DATA_URL" ]; then | |
| echo "Error: EVENTDISPLAY_TEST_DATA_URL secret not set" | |
| exit 1 | |
| fi | |
| wget --no-verbose "$TEST_DATA_URL" -O github-CI.tar.gz | |
| tar -xvzf github-CI.tar.gz | |
| rm github-CI.tar.gz | |
| - name: Eventdisplay-pointlike | |
| continue-on-error: ${{ env.GENERATE_REFERENCE == 'true' }} | |
| shell: bash -leo pipefail {0} | |
| run: | | |
| # point-like tests | |
| if [ "$GENERATE_REFERENCE" = "true" ]; then | |
| # Generate reference files | |
| v2dl3-eventdisplay \ | |
| -f ./64080.anasum.root \ | |
| ./effectiveArea.root \ | |
| --logfile ED-pointlike-CI.log \ | |
| ED-pointlike-CI.fits.gz | |
| else | |
| # Run tests comparing against reference | |
| v2dl3-eventdisplay \ | |
| -f ./64080.anasum.root \ | |
| ./effectiveArea.root \ | |
| --logfile test-pointlike.fits.log \ | |
| test-pointlike-CI.fits.gz | |
| v2dl3-compareFitsFiles \ | |
| -f ED-pointlike-CI.fits.gz test-pointlike-CI.fits.gz \ | |
| -d test-pointlike.log | |
| cat test-pointlike.log | |
| grep -q "No differences found" test-pointlike.log | |
| fi | |
| - name: Eventdisplay-full-enclosure | |
| continue-on-error: ${{ env.GENERATE_REFERENCE == 'true' }} | |
| shell: bash -leo pipefail {0} | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| # full-enclosure tests | |
| if [ "$GENERATE_REFERENCE" = "true" ]; then | |
| # Generate reference files | |
| v2dl3-eventdisplay --full-enclosure \ | |
| -f ./64080.anasum.root \ | |
| ./effectiveArea.root \ | |
| --logfile ED-fullenclosure-CI.log \ | |
| ED-fullenclosure-CI.fits.gz | |
| else | |
| # Run tests comparing against reference | |
| v2dl3-eventdisplay --full-enclosure \ | |
| -f ./64080.anasum.root \ | |
| ./effectiveArea.root \ | |
| --logfile test-full-enclosure.fits.log \ | |
| test-full-enclosure-CI.fits.gz | |
| v2dl3-compareFitsFiles \ | |
| -f ED-fullenclosure-CI.fits.gz test-full-enclosure-CI.fits.gz \ | |
| -d test-full-enclosure.log | |
| cat test-full-enclosure.log | |
| grep -q "No differences found" test-full-enclosure.log | |
| fi | |
| - name: Eventdisplay-pointlike-DB | |
| continue-on-error: ${{ env.GENERATE_REFERENCE == 'true' }} | |
| shell: bash -leo pipefail {0} | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| # point-like tests (with DB) | |
| if [ "$GENERATE_REFERENCE" = "true" ]; then | |
| # Generate reference files | |
| v2dl3-eventdisplay \ | |
| -f ./64080.anasum.root \ | |
| ./effectiveArea.root \ | |
| --db_fits_file ./64080.db.fits.gz \ | |
| --logfile ED-pointlike-db-CI.log \ | |
| ED-pointlike-db-CI.fits.gz | |
| else | |
| # Run tests comparing against reference | |
| v2dl3-eventdisplay \ | |
| -f ./64080.anasum.root \ | |
| ./effectiveArea.root \ | |
| --db_fits_file ./64080.db.fits.gz \ | |
| --logfile test-pointlike-db.fits.log \ | |
| test-pointlike-db-CI.fits.gz | |
| v2dl3-compareFitsFiles \ | |
| -f ED-pointlike-db-CI.fits.gz test-pointlike-db-CI.fits.gz \ | |
| -d test-pointlike-db.log | |
| cat test-pointlike-db.log | |
| grep -q "No differences found" test-pointlike-db.log | |
| fi | |
| - name: Eventdisplay-pointlike-select | |
| continue-on-error: ${{ env.GENERATE_REFERENCE == 'true' }} | |
| shell: bash -leo pipefail {0} | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| # point-like tests with event selection | |
| if [ "$GENERATE_REFERENCE" = "true" ]; then | |
| # Generate reference files | |
| v2dl3-eventdisplay \ | |
| -f ./64080.allevents.anasum.root \ | |
| ./effectiveArea.root \ | |
| --evt_filter eventfilter.yml \ | |
| --logfile ED-pointlike-all-CI.log \ | |
| ED-pointlike-all-CI.fits.gz | |
| else | |
| # Run tests comparing against reference | |
| v2dl3-eventdisplay \ | |
| -f ./64080.allevents.anasum.root \ | |
| ./effectiveArea.root \ | |
| --evt_filter eventfilter.yml \ | |
| --logfile test-pointlike-all.fits.log \ | |
| test-pointlike-all-CI.fits.gz | |
| v2dl3-compareFitsFiles \ | |
| -f ED-pointlike-all-CI.fits.gz test-pointlike-all-CI.fits.gz \ | |
| -d test-pointlike-all.log | |
| cat test-pointlike-all.log | |
| grep -q "No differences found" test-pointlike-all.log | |
| fi | |
| - name: Eventdisplay-full-enclosure-select | |
| continue-on-error: ${{ env.GENERATE_REFERENCE == 'true' }} | |
| shell: bash -leo pipefail {0} | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| # full-enclosure tests with event selection | |
| if [ "$GENERATE_REFERENCE" = "true" ]; then | |
| # Generate reference files | |
| v2dl3-eventdisplay --full-enclosure \ | |
| -f ./64080.allevents.anasum.root \ | |
| ./effectiveArea.root \ | |
| --evt_filter eventfilter.yml \ | |
| --logfile ED-full-enclosure-all-CI.log \ | |
| ED-full-enclosure-all-CI.fits.gz | |
| else | |
| # Run tests comparing against reference | |
| v2dl3-eventdisplay --full-enclosure \ | |
| -f ./64080.allevents.anasum.root \ | |
| ./effectiveArea.root \ | |
| --evt_filter eventfilter.yml \ | |
| --logfile test-full-enclosure-all.fits.log \ | |
| test-full-enclosure-all-CI.fits.gz | |
| v2dl3-compareFitsFiles \ | |
| -f ED-full-enclosure-all-CI.fits.gz test-full-enclosure-all-CI.fits.gz \ | |
| -d test-full-enclosure-all.log | |
| cat test-full-enclosure-all.log | |
| grep -q "No differences found" test-full-enclosure-all.log | |
| fi | |
| - name: Upload generated reference files | |
| if: env.GENERATE_REFERENCE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eventdisplay-reference-files-python-${{ matrix.python-version }} | |
| path: | | |
| 64080.anasum.root | |
| effectiveArea.root | |
| 64080.db.fits.gz | |
| 64080.allevents.anasum.root | |
| eventfilter.yml | |
| ED-*.fits.gz | |
| ED-*.log | |
| retention-days: 30 | |
| - name: Create reference archive | |
| if: env.GENERATE_REFERENCE == 'true' | |
| run: | | |
| echo "Creating reference archive..." | |
| # Only create archive if at least one file exists | |
| if ls *.root *.gz *.log *.yml 1> /dev/null 2>&1; then | |
| tar -cvzf github-CI-reference.tar.gz *.root *.gz *.log *.yml | |
| echo "Archive created successfully" | |
| else | |
| echo "Warning: No files found to archive" >&2 | |
| fi | |
| - name: Upload reference archive | |
| if: env.GENERATE_REFERENCE == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eventdisplay-reference-archive-python-${{ matrix.python-version }} | |
| path: github-CI-reference.tar.gz | |
| retention-days: 1 |