Skip to content

Run tests also for python 3.11-12 #192

Run tests also for python 3.11-12

Run tests also for python 3.11-12 #192

Workflow file for this run

name: res2df
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- published
env:
ERT_SHOW_BACKTRACE: 1
jobs:
res2df:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
pandas-version: ['pandas<2', 'pandas>2']
include:
# For one of the Python versions we
# install the extra dependency ert
# (in order to not double the job matrix)
- python-version: '3.8'
install-ert: true
steps:
- name: Checkout commit locally
uses: actions/checkout@v4
- name: Checkout tags
# This seems necessary for setuptools_scm to be able to infer
# the correct version.
run: git fetch --unshallow --tags
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install res2df with dependencies
run: |
pip install --upgrade pip
pip install ".[tests, docs]"
- name: Install numpy<2 if pandas<2
if: matrix.pandas-version == 'pandas<2'
run: pip install "numpy<2"
- name: Check pandas version
run: |
pip install "${{matrix.pandas-version}}"
- name: Install ert
if: matrix.install-ert
run: pip install ".[ert]"
- name: List all installed packages
run: pip freeze
- name: Run tests
run: |
python -c "import res2df"
pytest tests/
- name: Syntax check documentation
run: |
rstcheck -r docs
- name: Build documentation
run: |
python setup.py build_sphinx
- name: Update GitHub pages
if: github.repository_owner == 'equinor' && github.ref == 'refs/heads/master' && matrix.python-version == '3.8' && matrix.pandas-version == 'pandas>2'
run: |
cp -R ./build/sphinx/html ../html
git config --local user.email "res2df-github-action"
git config --local user.name "res2df-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r *
cp -R ../html/* .
git add .
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi
- name: Build python package and publish to pypi
if: github.event_name == 'release' && matrix.python-version == '3.8' && matrix.pandas-version == 'pandas>2'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.res2df_pypi_token }}
run: |
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*