Fix DecomonMaxPooling2D #516
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| linters: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: create requirements.txt so that pip cache with setup-python works | |
| run: echo "pre-commit" > requirements_precommit.txt | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.9 | |
| cache: pip | |
| cache-dependency-path: requirements_precommit.txt | |
| - name: install pre-commit | |
| run: python -m pip install pre-commit | |
| - name: get cached pre-commit hooks | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: pre-commit checks | |
| run: pre-commit run --all-files --show-diff-on-failure --color=always | |
| type-checking: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.9 | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade tox setuptools | |
| - name: Restore cached .tox | |
| id: cache-tox | |
| uses: actions/cache@v4 | |
| with: | |
| path: .tox | |
| key: | |
| tox-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | |
| tox-${{ matrix.python-version }}-${{ matrix.os }} | |
| - name: Run mypy via tox | |
| run: python -m tox -e type | |
| tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.11"] | |
| os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
| backend: ["tf", "torch", "jax"] | |
| autolirpa: [ "", "autolirpa" ] | |
| exclude: | |
| - backend: "tf" | |
| autolirpa: "autolirpa" | |
| - backend: "jax" | |
| autolirpa: "autolirpa" | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --upgrade tox setuptools | |
| - name: Restore cached .tox | |
| id: cache-tox | |
| uses: actions/cache@v4 | |
| with: | |
| path: .tox | |
| key: | |
| tox-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.backend }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | |
| tox-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.backend }} | |
| tox-${{ matrix.python-version }}-${{ matrix.os }} | |
| - name: Pick proper tox env | |
| shell: python | |
| run: | | |
| import os; import platform; import sys; from pathlib import Path | |
| platform_mapping = { | |
| "Linux": "linux", | |
| "Darwin": "macos", | |
| "Windows": "win", | |
| } | |
| pythonversion = f'py{"" if platform.python_implementation() == "CPython" else "py"}3{sys.version_info.minor}' | |
| platformversion=platform_mapping[platform.system()] | |
| toxenv = f"{pythonversion}-{platformversion}" | |
| toxenv += "-${{ matrix.backend }}" | |
| if "${{ matrix.autolirpa }}" == "autolirpa": | |
| toxenv += "-autolirpa" | |
| set_toxenv_cmd = f"TOXENV={toxenv}" | |
| print(f"Picked: {toxenv}") | |
| with Path(os.environ["GITHUB_ENV"]).open("ta") as file_handler: | |
| file_handler.write(set_toxenv_cmd) | |
| - name: Run tox target env for ${{ env.TOXENV }} | |
| run: | | |
| if [[ "${{ matrix.autolirpa }}" != "autolirpa" ]]; then | |
| python -m tox -e convert-doc-to-test # extract code blocks from doc to test them | |
| fi | |
| # set default torch device to cpu if on macos-latest to avois mps-related errors | |
| export KERAS_TORCH_DEVICE=cpu | |
| python -m tox # launch environment set by TOXENV at previous step | |
| - name: Check if coverage report exists | |
| id: check-coverage-report | |
| run: | | |
| if [ -f coverage.xml ]; then | |
| coverage_exists=true | |
| else | |
| coverage_exists=false | |
| fi | |
| echo ${coverage_exists} | |
| echo "coverage_exists=${coverage_exists}" >> $GITHUB_OUTPUT | |
| - name: Export coverage report (if existing) | |
| if: steps.check-coverage-report.outputs.coverage_exists == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: | | |
| coverage.xml | |
| coverage_html | |
| build-doc: | |
| uses: ./.github/workflows/build-doc.yml | |
| deploy-doc: | |
| # for default branch (main) | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
| needs: [build-doc, tests, linters] | |
| uses: ./.github/workflows/deploy-doc.yml | |
| with: | |
| doc-version: ${{ needs.build-doc.outputs.doc-version }} | |
| binder-env-fullref: ${{ github.repository }}/${{ github.ref_name}} |