Merge pull request #143 from koito19960406/fix/mly-perf-py311 #274
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: Tests | |
| on: [push, pull_request] | |
| jobs: | |
| test: | |
| strategy: | |
| # Limit concurrent jobs to 2 | |
| max-parallel: 2 | |
| matrix: | |
| os: [ubuntu-latest] # macOS and windows are not supported | |
| python-version: ['3.9', '3.10', '3.11', '3.12'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Clear disk space (Linux only) | |
| - name: Free disk space | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| sudo apt-get clean | |
| df -h | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install Poetry | |
| run: | | |
| pip install poetry | |
| poetry config virtualenvs.in-project true | |
| - name: Install dependencies | |
| run: poetry install --no-interaction --with dev | |
| - name: Install VGGT dependencies | |
| run: poetry run pip install -r src/zensvi/transform/vggt/requirements.txt | |
| - name: Run tests with coverage | |
| run: poetry run pytest --cov=src/zensvi --cov-report=xml:coverage-service.xml | |
| env: | |
| MLY_API_KEY: ${{ secrets.MLY_API_KEY }} | |
| GSV_API_KEY: ${{ secrets.GSV_API_KEY }} | |
| - name: Cache Codecov uploader | |
| uses: actions/cache@v3 | |
| id: cache-codecov | |
| with: | |
| path: ./codecov | |
| key: codecov-uploader-${{ runner.os }} | |
| - name: Download Codecov uploader | |
| if: steps.cache-codecov.outputs.cache-hit != 'true' | |
| shell: bash | |
| run: | | |
| curl -Os https://cli.codecov.io/latest/linux/codecov | |
| chmod +x codecov | |
| - name: Check coverage file | |
| run: cat coverage-service.xml | |
| - name: Upload coverage reports to Codecov | |
| shell: bash | |
| env: | |
| CODECOV_NAME: ${{ matrix.os }}-py${{ matrix.python-version }} | |
| run: | | |
| ./codecov upload-process --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} -F service -f coverage-service.xml | |
| # Cleanup after tests | |
| - name: Cleanup test artifacts | |
| if: always() | |
| run: | | |
| rm -rf .pytest_cache | |
| rm -rf .coverage | |
| rm -rf coverage-service.xml | |
| rm -rf codecov |