Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds CI to run unit tests against Pandas 3.0 #220

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/test-for-pandas-3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Run unit tests with Pandas 3.0

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop, releases/** ]

jobs:
run_pandas_3_unit_tests:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: node

- name: Install Pandas 3.0 (i.e., Nightly)
run: |
python3 -m pip install --upgrade pip pytest
python3 -m pip install --upgrade --force-reinstall --pre --extra-index \
https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pandas[pyarrow]

- name: Install Python 3 dependencies
run: |
python3 -m pip install git+https://github.com/LLNL/hatchet.git@develop
python3 -m pip install -r requirements.txt
python3 -m pip install .
python3 -m pip list

# From here on, I'm making use of the trick from the following
# GitHub repo to not fail the full CI/CD pipeline if this fails:
# https://github.com/burningmantech/ranger-ims-server/pull/1347/files
- name: Basic test with PyTest
id: test
run: |
set +e # Prevent immediate exit if pytest reports errors
PYTHONPATH=. $(which pytest)
status=$?
if [ ${status} -ne 0 ]; then
echo "=================================="
echo "Unit tests with Pandas 3.0 FAILED!"
echo "=================================="
echo "::warning::Optional CI test with Pandas 3 failed"
echo "optional_fail=true" >> "${GITHUB_OUTPUT}"
echo "optional_fail_status=${status}" >> "${GITHUB_OUTPUT}"
else
echo "=================================="
echo "Unit tests with Pandas 3.0 PASSED!"
echo "=================================="
fi
exit 0

- name: Find issue comment
if: github.event_name == 'push'
uses: peter-evans/find-comment@v3
id: find_comment
with:
issue-number: 221
comment-author: 'github-actions[bot]'
body-includes: Pandas 3.0 Unit Tests

- name: Add comment to PR if test failed
if: github.event_name == 'push' && steps.test.outputs.optional_fail == 'true'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: 221
body: |
### Pandas 3.0 Unit Tests Failed!
Due to breaking changes in Pandas 3.0 (namely, copy-on-write), we are performing optional
tests of Thicket against the nightly release of Pandas 3.0.

This is not a full testing failure, and it will not prevent your PR from being merged
at this time. However, as we prepare for the release of Pandas 3.0, we encourage
all developers to design their code to work with Pandas 3.0, if possible.

Pytest status code: ${{ steps.test.outputs.optional_fail_status }}
Action log: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
edit-mode: 'replace'

- name: Add comment to PR if test passed
if: github.event_name == 'push' && steps.test.outputs.optional_fail == 'false'
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: 221
body: |
### Pandas 3.0 Unit Tests Passed!
Due to breaking changes in Pandas 3.0 (namely, copy-on-write), we are performing optional
tests of Thicket against the nightly release of Pandas 3.0.

This PR passed unit tests when run with Pandas 3.0!
edit-mode: 'replace'
Loading