ci: ensure libzstd-dev is installed #199
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: Test python package | |
| on: | |
| push: | |
| paths: | |
| - tests/** | |
| - src/** | |
| - pyproject.toml | |
| - .github/workflows/test.yml | |
| pull_request: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 2 * * 1" | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] # failing on github-ci with memory error | |
| backend: ['torch','jax'] # 'tensorflow' is excluded since on github-ci tests get stuck for a yet unknown reason | |
| # macos-latest: | |
| # - misses support for ratarmount > index_zstd | |
| # - for >=3.13 indexed_zstd/libzstd-seek/zstd-seek.h:20:10: fatal error: zstd.h: No such file or directory | |
| python-version: ['3.10','3.11','3.12','3.13','3.14'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Remove unnecessary tools (Linux) | |
| if: runner.os == 'Linux' | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # when set to "true" but frees about 6 GB | |
| tool-cache: true | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies ${{ matrix.os }} | |
| if: runner.os == 'Linux' | |
| run: | | |
| # ensure zstd.h is available | |
| sudo apt update && sudo apt install -y libzstd-dev | |
| - name: Install pip | |
| run: python -m pip install -U pip | |
| - name: Install package | |
| run: | | |
| python -m pip install -e .[dev,test] | |
| python -m pip install ${{ matrix.backend }} | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context | |
| - name: Set Env (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| echo "KERAS_BACKEND=${{ matrix.backend }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| shell: pwsh | |
| - name: Set Env (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| echo "KERAS_BACKEND=${{ matrix.backend }}" >> $GITHUB_ENV | |
| - name: Set Env (Mac) | |
| if: runner.os == 'macOS' | |
| run: | | |
| echo "KERAS_BACKEND=${{ matrix.backend }}" >> $GITHUB_ENV | |
| echo "PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0" >> $GITHUB_ENV | |
| if [ -d "/opt/homebrew/bin" ]; then | |
| echo "/opt/homebrew/bin" >> $GITHUB_PATH | |
| elif [ -d "/usr/local/bin" ]; then | |
| echo "/usr/local/bin" >> $GITHUB_PATH | |
| fi | |
| brew install zstd | |
| # Run keras backend specific tests (for keras>=3) | |
| # Due to space issues avoid creating too many venvs (via tox) | |
| # see https://github.com/actions/runner-images/issues/709 | |
| - name: Run tests - ${{ matrix.backend }} backend | |
| run: | | |
| pytest -v --timeout=120 --cov=damast --cov-report=term --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.backend }}.xml tests | |
| - name: Upload pytest results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.backend }} | |
| path: junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.backend }}.xml | |
| # Publish also in case of test failures | |
| if: always() |