README and minor fixes before release #50
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: CI | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
workflow_dispatch: | |
jobs: | |
# JOB to run change in the build files | |
changes: | |
runs-on: ubuntu-latest | |
# Required permissions | |
permissions: | |
pull-requests: read | |
# Set job outputs to values from filter step | |
outputs: | |
files: ${{ steps.filter.outputs.files }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Filter files | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2 | |
id: filter | |
with: | |
filters: | | |
files: | |
- 'setup.py' | |
- 'pyproject.toml' | |
- '.conda/env_build.yml' | |
- '.conda/meta.yml' | |
verify-conda-build: | |
name: Conda Build | |
runs-on: ubuntu-latest | |
needs: changes | |
# Only run if there are changes in the build files | |
if: ${{ needs.changes.outputs.files == 'true' }} | |
env: | |
BUILD_FOLDER: ${{github.workspace}}/build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set package path | |
id: set-package-path | |
run: | | |
echo "package-path=${{env.BUILD_FOLDER}}/noarch/*${{vars.PACKAGE_FORMAT}}" >> $GITHUB_OUTPUT | |
- name: Setup conda build environment | |
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4 | |
with: | |
miniconda-version: "latest" | |
python-version: ${{ vars.PY_VERSION }} | |
environment-file: .conda/env_build.yml | |
auto-activate-base: false | |
auto-update-conda: false | |
show-channel-urls: true | |
- name: Verify conda recipe | |
shell: bash -el {0} | |
run: conda-verify .conda --ignore C2105,C2122 | |
# C2105: invalid package version for ... | |
# (there is no git tag in this test so versioneer outputs a | |
# version that conda-verify recognizes as 'invalid') | |
# C2122: invalid license family | |
# Reference --> https://github.com/conda/conda-verify?tab=readme-ov-file#checks | |
- name: Build conda package | |
shell: bash -el {0} | |
run: conda build . --no-anaconda-upload --output-folder=${{env.BUILD_FOLDER}} -c accessnri -c conda-forge -c coecms --package-format ${{vars.PACKAGE_FORMAT}} | |
- name: Verify conda package | |
shell: bash -el {0} | |
run: conda-verify ${{steps.set-package-path.outputs.package-path}} --ignore C1105,C1115,C1141 | |
# C1105: invalid version number for ... | |
# (there is no git tag in this test so versioneer outputs a | |
# version that conda-verify recognizes as 'invalid') | |
# C1115: Found invalid license | |
# C1141: Found python file without a corresponding pyc file | |
# Reference --> https://github.com/conda/conda-verify?tab=readme-ov-file#checks | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup conda environment | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniconda-version: "latest" | |
python-version: ${{ matrix.python-version }} | |
environment-file: .conda/env_dev.yml | |
auto-activate-base: false | |
activate-environment: umfile-utils-dev | |
auto-update-conda: false | |
show-channel-urls: true | |
- name: Install source | |
shell: bash -l {0} | |
run: python -m pip install --no-deps --no-build-isolation -e . | |
- name: List installed packages | |
shell: bash -l {0} | |
run: conda list | |
- name: Run tests | |
shell: bash -l {0} | |
run: python -m pytest | |