check import location #91
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: pytest | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- ci-cwd | |
jobs: | |
test: | |
strategy: | |
fail-fast: false # don't cancel other matrix jobs when one fails | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.9, "3.10", "3.11", "3.12"] | |
environment-type: [conda, bare] | |
suffix: [''] # placeholder as an alternative to "-min" | |
include: | |
- os: ubuntu-latest | |
python-version: 3.9 | |
environment-type: conda | |
suffix: -min | |
exclude: | |
- os: macos-latest | |
environment-type: conda | |
- os: windows-latest | |
environment-type: bare | |
runs-on: ${{ matrix.os }} | |
steps: | |
# We check out only a limited depth and then pull tags to save time | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
- name: Get tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Install Conda environment with Micromamba | |
if: matrix.environment-type == 'conda' | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ${{ env.REQUIREMENTS }} | |
cache-downloads: true | |
create-args: >- | |
python=${{ matrix.python-version }} | |
condarc: | | |
channel-priority: flexible | |
env: | |
# build requirement filename. First replacement is for the python | |
# version, second is to add "-min" if needed | |
REQUIREMENTS: ci/requirements-py${{ matrix.python-version }}${{ matrix.suffix }}.yml | |
- name: List installed package versions (conda) | |
if: matrix.environment-type == 'conda' | |
shell: bash -l {0} # necessary for conda env to be active | |
run: micromamba list | |
- name: Install bare Python ${{ matrix.python-version }}${{ matrix.suffix }} | |
if: matrix.environment-type == 'bare' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install pvlib | |
if: matrix.environment-type == 'conda' | |
shell: bash -l {0} | |
run: python -m pip install --no-deps . | |
- name: Set up bare environment | |
if: matrix.environment-type == 'bare' | |
run: | | |
pip install .[test] | |
pip freeze | |
- name: Check import location | |
run: python -c "import pvlib; print(pvlib.__file__)" | |
- name: Run tests | |
shell: bash -l {0} # necessary for conda env to be active | |
run: | | |
# ignore iotools; those tests are run in a separate workflow | |
pytest pvlib --cov=./ --cov-report=xml --ignore=pvlib/tests/iotools | |
- name: Upload coverage to Codecov | |
if: matrix.python-version == 3.9 && matrix.suffix == '' && matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
verbose: true | |
flags: core # flags are configured in codecov.yml | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |