Repository navigation
Build and test #83
This file contains hidden or 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: Build and test | |
| on: | |
| push: | |
| branches-ignore: | |
| - gh-pages | |
| tags: | |
| - '*' | |
| schedule: | |
| - cron: 0 10 * * 1 # 3AM PST | |
| env: | |
| PYTHONVERSION_STD: "3.12" | |
| jobs: | |
| tests: | |
| name: All tests, on current Python | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # No OpenAlea LPy for 3.14 yet | |
| python-version: ["3.10", 3.11, 3.12] # , 3.13, 3.14] | |
| os: [ubuntu-latest] | |
| with-lpy: [true] | |
| include: | |
| - python-version: 3.12 | |
| os: macos-latest | |
| with-lpy: true | |
| - python-version: 3.12 | |
| os: windows-latest | |
| with-lpy: true | |
| # - python-version: 3.12 | |
| # os: ubuntu-latest | |
| # with-lpy: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Install conda dependencies | |
| uses: conda-incubator/setup-miniconda@v4 | |
| if: matrix.with-lpy == true | |
| with: | |
| activate-environment: canopy | |
| auto-update-conda: true | |
| python-version: ${{ matrix.python-version }} | |
| channels: msys,conda-forge,openalea3 | |
| channel-priority: strict | |
| environment-file: environment.yml | |
| - name: Install Python w/o conda | |
| uses: actions/setup-python@v6 | |
| if: matrix.with-lpy == false | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Build & install dependencies | |
| # - name: Install yggdrasil-python-rapidjson via pip until conda-forge feedstock available in order to install ePhotosynthesis from source | |
| # run: | | |
| # pip install yggdrasil-python-rapidjson | |
| # - name: Install embree & hothouse build dependencies | |
| # run: | | |
| # conda env update -n canopy --file environment_raytrace.yml | |
| # - name: Install yggdrasil | |
| # run: | | |
| # cd .. | |
| # ./canopy_factory/build_yggdrasil.sh | |
| # - name: Install ePhotosynthesis_C | |
| # run: | | |
| # cd .. | |
| # ./canopy_factory/build_ePhotosynthesis_C.sh | |
| # - name: Install lpy | |
| # run: | | |
| # cd .. | |
| # ./canopy_factory/build_lpy.sh | |
| # - name: Install embree | |
| # run: | | |
| # cd .. | |
| # ./canopy_factory/build_embree.sh | |
| # - name: Install pyembree | |
| # run: | | |
| # cd .. | |
| # ./canopy_factory/build_pyembree.sh | |
| # - name: Install hothouse | |
| # run: | | |
| # cd .. | |
| # ./canopy_factory/build_hothouse.sh | |
| - name: Install canopy_factory | |
| run: | | |
| pip install -v '.[dev]' | |
| - name: Show packages installed via conda | |
| if: matrix.with-lpy == true | |
| run: | | |
| conda list | |
| - name: Show packages installed via pip | |
| run: | | |
| pip list | |
| - name: Check syntax | |
| run: | | |
| flake8 canopy_factory | |
| - name: Test CLI | |
| run: | | |
| python -m canopy_factory -h | |
| - name: Tests | |
| run: | | |
| pytest -sv tests | |
| - name: Doctests | |
| run: | | |
| make -C docs doctest -e PYTHON=$(which python3) | |
| # Disable this once it is verified to work on all jobs | |
| - name: Install pypa/build | |
| run: python -m pip install build | |
| - name: Build a binary wheel and a source tarball | |
| run: python -m build | |
| docs: | |
| name: Build the Docs | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| # - name: Get tags required by setuptools_scm to generate version | |
| # run: | | |
| # git fetch --prune --unshallow | |
| # git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| - name: Set up miniconda environment w/ dependencies | |
| uses: conda-incubator/setup-miniconda@v4 | |
| with: | |
| activate-environment: canopy | |
| auto-update-conda: true | |
| python-version: ${{ env.PYTHONVERSION_STD }} | |
| channels: msys,conda-forge,fredboudon | |
| channel-priority: strict | |
| environment-file: environment.yml | |
| - name: Install canopy_factory | |
| run: | | |
| pip install -v -e '.[dev]' | |
| - name: Build the docs | |
| run: | | |
| cd docs | |
| make autodoc | |
| cd ../ | |
| # - name: Publish docs to Github pages | |
| # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
| # uses: JamesIves/github-pages-deploy-action@3.7.1 | |
| # with: | |
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # BRANCH: gh-pages | |
| # FOLDER: docs/build/html/ | |
| build: | |
| name: Build sdist & wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| - name: Install Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHONVERSION_STD }} | |
| - name: Install pypa/build | |
| run: python -m pip install build | |
| - name: Build a binary wheel and a source tarball | |
| run: python -m build | |
| all_tests_passed: | |
| runs-on: ubuntu-latest | |
| name: All tests passed | |
| needs: [tests, docs, build] | |
| if: always() | |
| steps: | |
| - name: All tests ok | |
| if: ${{ !(contains(needs.*.result, 'failure')) }} | |
| run: exit 0 | |
| - name: Some tests failed | |
| if: ${{ contains(needs.*.result, 'failure') }} | |
| run: exit 1 |