logo #160
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
| # Workflow performing basic tests on PR and Push to `main` | |
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Python package | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10"] | |
| steps: | |
| - name: Maximize Build Space | |
| uses: easimon/maximize-build-space@master | |
| with: | |
| remove-dotnet: true | |
| remove-android: true | |
| remove-haskell: true | |
| remove-codeql: true | |
| remove-docker-images: true | |
| temp-reserve-mb: 10000 | |
| root-reserve-mb: 10000 | |
| swap-size-mb: 1024 | |
| - uses: actions/checkout@v4 | |
| with: | |
| clean: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install compiler | |
| run: | | |
| sudo apt update && sudo apt install -y build-essential | |
| - name: Install Python dependencies | |
| run: | | |
| python -m venv ${{github.workspace}}/.venv | |
| source ${{github.workspace}}/.venv/bin/activate | |
| python -m pip install --upgrade pip | |
| python -m pip install pytest | |
| python -m pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu | |
| if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi | |
| python -m pip install . | |
| echo "Free space:" | |
| df -h | |
| - name: Test with pytest | |
| run: | | |
| source ${{github.workspace}}/.venv/bin/activate | |
| pytest |