Keras Tests #62
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: Keras Tests | |
| # TODO: Consider enabling all tests (pytest, applications, etc.) with NNX in the future | |
| # Currently only basic flow tests run with NNX enabled | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request_review: | |
| types: [submitted] | |
| release: | |
| types: [created] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-in-container: | |
| name: Run tests on TPU | |
| runs-on: linux-x86-ct6e-44-1tpu | |
| # Only run on approved PRs, pushes to master, or releases | |
| if: | | |
| github.event_name == 'push' || | |
| github.event_name == 'release' || | |
| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| backend: [jax] | |
| container: | |
| image: python:3.10-slim | |
| options: --privileged --network host | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: | | |
| pip install --no-cache-dir -r requirements-${{ matrix.backend }}-tpu.txt \ | |
| - name: Set Keras Backend | |
| run: echo "KERAS_BACKEND=jax" >> $GITHUB_ENV | |
| - name: Run Verification and Tests | |
| run: | | |
| echo "Successfully running inside the public python container!" | |
| echo "Verifying JAX installation..." | |
| python3 -c "import jax; print(f'JAX backend: {jax.default_backend()}'); print(f'JAX devices : {jax.devices()}')" | |
| pytest keras --ignore keras/src/applications \ | |
| --cov=keras \ | |
| --cov-config=pyproject.toml |