only upload src dist not test file we arn't gonna read anyway #177
This file contains 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: 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: | | |
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: | | |
python3 -m pip install meson 'numpy<2' sphinx breathe sphinx_rtd_theme pytest pytest-tap | |
meson setup build . -D b_coverage=true --prefix=${HOME}/inst/ | |
meson test -C build | |
- name: Rename TestLog | |
if: always() && matrix.build == 'meson' | |
run: | | |
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 }} | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: [Tests] | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
contents: read | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: . | |
pattern: test-results-* | |
merge-multiple: true | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "*.xml" | |
deduplicate_classes_by_file_name: true |