From d2392c44c9e4426a5a98de05f056ba7227be750c Mon Sep 17 00:00:00 2001 From: Christian O'Reilly Date: Wed, 11 Dec 2024 11:38:07 -0500 Subject: [PATCH] Adding testing to the CI. --- .github/workflows/test.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7cb0cf1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +name: Run tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest # arm64 (Apple Silicon) + - macos-13 # latest Intel release + - windows-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + - name: Force numpy < 2 on MacOS Intel + if: matrix.os == 'macos-13' + run: pip install 'numpy<2' + - name: Install + run: | + pip install -e . + pip install pytest-notebook + pre-commit run --all + pre-commit install + - name: Test import + run: | + python -c "import ipyniivue" + - name: Test + run: | + coverage run -m pytest --nb-test-files + - name: Upload coverage to codecov (Only do this for the ubuntu-latest job) + if: matrix.os == 'ubuntu-latest' + uses: codecov/codecov-action@v3 + with: + token: ${{secrets.CODECOV_TOKEN}} \ No newline at end of file