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

test with install from wheel, instead of from source #90

Closed
wants to merge 16 commits into from
Closed
Changes from 2 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
75 changes: 65 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,54 @@ on:
branches: [ master ]

jobs:
test:
build-wheel:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

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

- name: build wheel
run: |
python -m pip install build
python -m build

- name: upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl

check-docs-build:
runs-on: ubuntu-latest
needs: build-wheel

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies for building docs
run: |
python -m pip install -e .[dev]
python -m pip install numpy scipy matplotlib sphinx

- name: check that the docs build
run: |
make -j 4 -C doc/sphinx SPHINXOPTS="-W --keep-going" html

# Test the wheel on different platforms
test:
runs-on: ${{ matrix.cfg.os }}
needs: build-wheel

strategy:
matrix:
cfg:
Expand All @@ -19,6 +64,7 @@ jobs:
- { os: ubuntu-latest, py: 3.11, doc: 1 }
- { os: windows-latest, py: 3.11 }
- { os: macos-latest, py: 3.11 }
fail-fast: false

steps:
- uses: actions/checkout@v4
Expand All @@ -28,18 +74,27 @@ jobs:
with:
python-version: ${{ matrix.cfg.py }}

- name: Download the wheel
uses: actions/download-artifact@v4
with:
name: wheel
path: dist

- name: Install the wheel for Windows configuration
if: ${{ runner.os == 'Windows' }}
run: |
$wheel = Get-ChildItem -Path dist -Filter "periodictable*.whl" | Select-Object -First 1
python -m pip install $wheel.FullName
shell: pwsh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not liking the duplication.

Presumably the following fails in Windows?

name: Install the wheel
      run: python -m pip install dist/periodictable*.whl

How about:

name: Install the wheel
      run: |
        cd dist
        python -m pip install periodictable*.whl

Does windows restore the working directory after powershell exits, or does the cd leak into the next command?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think cd does not leak. Duplication is not needed if we use bash as the shell on all platforms, which is straightforward. I just have to look it up.


- name: Install the wheel for configurations other than Windows
if: ${{ runner.os != 'Windows' }}
run: python -m pip install dist/periodictable*.whl

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel setuptools
python -m pip install numpy scipy matplotlib pytest pytest-cov
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scipy and matplotlib are required for tests and numpy is listed as a dependency. Since testing against installed wheel we should only need pytest and pytest-cov


- name: Test with pytest
run: |
pytest -v

- name: check that the docs build (linux only)
if: matrix.cfg.doc == 1
run: |
python -m pip install sphinx
make -j 4 -C doc/sphinx SPHINXOPTS="-W --keep-going" html
pytest -v
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests in package (e.g., periodictable/fasta.py) and others in test directory. There are doc tests in the guide and the api docs extracted from the package directory. Need to verify that these tests are run against the installed wheel rather than the source tree.