Download artifact #79
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: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| tests: | |
| name: 'py${{ matrix.python-version }} on ${{ matrix.os }}' | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python-version: ['3.9'] | |
| steps: | |
| - name: Clone vplot repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install vplanet | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install vplanet | |
| - name: Install vplot | |
| run: | | |
| python -m pip install -e . | |
| - name: Install test dependencies | |
| run: | | |
| python -m pip install pytest pytest-cov pytest-timeout | |
| - name: Run vplanet | |
| run: | | |
| for f in docs/notebooks/examples/*/vpl.in | |
| do | |
| pushd ${f%/*} | |
| vplanet vpl.in | |
| popd | |
| done | |
| - name: Enable subprocess coverage | |
| run: | | |
| # Install coverage subprocess support | |
| echo "import coverage; coverage.process_startup()" > $(python -c "import site; print(site.getsitepackages()[0])")/coverage_subprocess.pth | |
| # Set environment variable for coverage configuration | |
| echo "COVERAGE_PROCESS_START=${{ github.workspace }}/.coveragerc" >> $GITHUB_ENV | |
| - name: Run tests | |
| timeout-minutes: 10 | |
| run: | | |
| python -m pytest tests/ -v --timeout=300 --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml --cov --cov-report=xml --cov-report=term | |
| - name: Combine coverage data | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' | |
| run: | | |
| # Move all coverage files from subdirectories to repository root | |
| find tests/ -name ".coverage.*" -type f -exec mv {} . \; 2>/dev/null || true | |
| # Combine all coverage data files | |
| python -m coverage combine | |
| python -m coverage xml | |
| python -m coverage report | |
| - name: Upload coverage to Codecov | |
| # Only upload from one runner to avoid redundant API calls | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| flags: ${{ matrix.os }}-py${{ matrix.python-version }} | |
| name: ${{ matrix.os }}-py${{ matrix.python-version }} | |
| fail_ci_if_error: false | |
| - name: Publish unit test results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() && runner.os == 'Linux' | |
| with: | |
| files: junit/test-*.xml | |
| check_name: Test Results (py${{ matrix.python-version }} on ${{ matrix.os }}) |