Skip to content

Testing updates

Testing updates #148

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
actions: read
checks: write
jobs:
Tests:
name: ${{matrix.os}} ${{matrix.build}} tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-14]
build: [meson, pyproject]
include:
- os: ubuntu-20.04
python-version: "3.8"
- os: ubuntu-22.04
python-version: "3.10"
- os: macos-12
python-version: "3.12"
- os: macos-14
python-version: "3.12"
steps:
- name: Checkout nuflux
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Apt-Get Install Dependencies
if: startsWith( matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install ninja-build gcovr libcfitsio-dev libboost-python-dev doxygen
curl -L https://github.com/icecube/photospline/archive/refs/tags/v2.2.1.tar.gz | tar xz
cmake -S photospline-2.2.1 -B photospline -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
sudo make install -C photospline
- name: HomeBrew Install Dependencies
if: startsWith( matrix.os, 'macos')
run: |
brew tap icecube/icecube
brew install boost-python3 ninja doxygen cfitsio gcovr icecube/icecube/photospline
echo BOOST_ROOT=$(brew --prefix) >> "$GITHUB_ENV"
- name: Build nuflux with pyproject
if: matrix.build == 'pyproject'
run: |
echo "BOOST_ROOT: ${BOOST_ROOT}"
python3 -m pip install .[test]
python3 -m pytest --junit-xml=test-results-${{matrix.build}}-${{matrix.os}}.junit.xml
- name: Build nuflux with Meson
if: matrix.build == 'meson'
run: |
echo "BOOST_ROOT: ${BOOST_ROOT}"
python3 -m pip install meson numpy sphinx breathe sphinx_rtd_theme pytest pytest-tap
meson setup build . -D b_coverage=true --prefix=${HOME}/inst/
meson test -C build
mv -v build/meson-logs/testlog.junit.xml test-results-${{matrix.build}}-${{matrix.os}}.junit.xml
- uses: actions/upload-artifact@v4
if: always()
with:
if-no-files-found: error
name: test-results-${{matrix.build}}-${{matrix.os}}
path: test-results-${{matrix.build}}-${{matrix.os}}.junit.xml
- name: Install and test linking
if: matrix.build == 'meson' && startsWith( matrix.os, 'macos')
env:
PKG_CONFIG_PATH: /Users/runner/inst/lib/pkgconfig
run: |
meson install -C build
c++ -std=c++17 $(pkg-config nuflux --cflags --libs) -I$(brew --prefix)/include tests/test_basic.cxx -o test_basic
./test_basic
- name: Generate Coverage Report and Docs
if: matrix.build == 'meson' && startsWith( matrix.os, 'ubuntu')
run: |
ninja -C build coverage
ninja -C build docs/html
- name: Upload Coverage to Codecov
if: matrix.build == 'meson' && startsWith( matrix.os, 'ubuntu')
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
verbose: true
- name: Upload Documentation
if: matrix.build == 'meson' && startsWith( matrix.os, 'ubuntu') && github.ref == 'refs/heads/main'
run: docs/docs-upload.sh
env:
ICECUBE_PASSWORD: ${{ secrets.ICECUBE_PASSWORD }}
cvmfs_meson_tests:
name: cvmfs meson tests ${{matrix.cvmfs}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cvmfs: [py3-v4.1.1, py3-v4.2.1, py3-v4.3.0]
steps:
- uses: cvmfs-contrib/github-action-cvmfs@v3
- name: Checkout nuflux
uses: actions/checkout@v4
- name: Build and Run Tests in Docker
uses: addnab/docker-run-action@v3
with:
options: -v /cvmfs/icecube.opensciencegrid.org/:/cvmfs/icecube.opensciencegrid.org/ -v /home/runner/work/nuflux/nuflux:/nuflux
image: centos:centos7.9.2009
run: |
yum -y install glibc-headers glibc-devel unzip
eval $(/cvmfs/icecube.opensciencegrid.org/${{matrix.cvmfs}}/setup.sh)
export PATH=${HOME}/.local/bin:${PATH}
pip install --upgrade --user meson ninja pytest pytest-tap
CMAKE_PREFIX_PATH=${SROOT} BOOST_ROOT=${SROOT} meson setup build /nuflux
meson test -Cbuild
cvmfs_pyproject_tests:
name: cvmfs pyproject tests ${{matrix.cvmfs}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cvmfs: [py3-v4.1.1, py3-v4.3.0]
steps:
- uses: cvmfs-contrib/github-action-cvmfs@v3
- name: Checkout nuflux
uses: actions/checkout@v4
- name: Build and Run Tests in Docker
uses: addnab/docker-run-action@v3
with:
options: -v /cvmfs/icecube.opensciencegrid.org/:/cvmfs/icecube.opensciencegrid.org/ -v /home/runner/work/nuflux/nuflux:/nf
image: centos:centos7.9.2009
run: |
yum -y install glibc-headers glibc-devel
eval $(/cvmfs/icecube.opensciencegrid.org/${{matrix.cvmfs}}/setup.sh)
python3 -m pip install --upgrade --user pip pytest
BOOST_ROOT=${SROOT} python3 -m pip install --user --verbose /nf
python3 -m pytest /nf
test_report:
needs: [Tests]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout nuflux
uses: actions/checkout@v4
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: test-results
pattern: test-results-*
merge-multiple: true
- name: Test Report
uses: dorny/test-reporter@v1
with:
name: Test Results
path: test-results/test-results-meson-*.xml
reporter: jest-junit