Run Tests #6132
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: Run Tests | |
| on: | |
| push: | |
| branches: [master, develop, v3.10.x] | |
| pull_request: | |
| branches: [master, develop, v3.10.x] | |
| schedule: | |
| - cron: "0 7 * * 1" | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| name: Linting (prek/pre-commit and mypy) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| # Get history and tags for SCM versioning to work | |
| fetch-depth: 0 | |
| - name: Install the latest version of uv with cache enabled | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "" | |
| - name: Run linters with tox | |
| run: uvx --python 3.9 --with tox-uv tox -e linters | |
| tests: | |
| name: Test it! | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| python-version: [3.9, "3.14"] | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| # Get history and tags for SCM versioning to work | |
| fetch-depth: 0 | |
| - name: Install the latest version of uv with cache enabled | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "" | |
| - name: Test with tox | |
| run: uvx --python ${{ matrix.python-version }} --with tox-uv --with tox-gh-actions tox | |
| - name: Upload Unit Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-test-results-python${{ matrix.python-version }}-${{ matrix.os }} | |
| path: | | |
| test-reports/junit-report.xml | |
| test-reports/coverage.xml | |
| publish-test-results: | |
| name: "Publish Unit Tests Results" | |
| needs: tests | |
| runs-on: ubuntu-latest | |
| if: always() | |
| permissions: | |
| # Needed by insightsengineering/coverage-action to push badge/report | |
| # SVGs to the diff-storage branch and to comment on pull requests. | |
| contents: write | |
| pull-requests: write | |
| checks: write | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Publish Unit Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| continue-on-error: true | |
| with: | |
| files: artifacts/*/junit-report.xml | |
| - name: Produce the coverage report for Ubuntu | |
| # Skipped on PRs from forks: GITHUB_TOKEN is read-only there. | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| uses: insightsengineering/coverage-action@v2 | |
| continue-on-error: true | |
| with: | |
| # Path to the Cobertura XML report. | |
| path: artifacts/unit-test-results-python3.14-ubuntu-latest/coverage.xml | |
| # Minimum total coverage, if you want to the | |
| # workflow to enforce it as a standard. | |
| # This has no effect if the `fail` arg is set to `false`. | |
| threshold: 70 | |
| # Fail the workflow if the minimum code coverage | |
| # reuqirements are not satisfied. | |
| fail: false | |
| # Publish the rendered output as a PR comment | |
| publish: true | |
| # Create a coverage diff report. | |
| diff: true | |
| # Branch to diff against. | |
| # Compare the current coverage to the coverage | |
| # determined on this branch. | |
| diff-branch: develop | |
| # This is where the coverage reports for the | |
| # `diff-branch` are stored. | |
| # Branch is created if it doesn't already exist'. | |
| diff-storage: _xml_coverage_reports | |
| # A custom title that can be added to the code | |
| # coverage summary in the PR comment. | |
| coverage-summary-title: "Code Coverage (Ubuntu)" | |
| # Make the code coverage report togglable | |
| togglable-report: true | |
| # Github token to use to publish the check | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Produce the coverage report for Windows | |
| # Skipped on PRs from forks: GITHUB_TOKEN is read-only there. | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| uses: insightsengineering/coverage-action@v2 | |
| continue-on-error: true | |
| with: | |
| # Path to the Cobertura XML report. | |
| path: artifacts/unit-test-results-python3.14-windows-latest/coverage.xml | |
| # Minimum total coverage, if you want to the | |
| # workflow to enforce it as a standard. | |
| # This has no effect if the `fail` arg is set to `false`. | |
| threshold: 70 | |
| # Fail the workflow if the minimum code coverage | |
| # reuqirements are not satisfied. | |
| fail: false | |
| # Publish the rendered output as a PR comment | |
| publish: true | |
| # Create a coverage diff report. | |
| diff: true | |
| # Branch to diff against. | |
| # Compare the current coverage to the coverage | |
| # determined on this branch. | |
| diff-branch: develop | |
| # This is where the coverage reports for the | |
| # `diff-branch` are stored. | |
| # Branch is created if it doesn't already exist'. | |
| diff-storage: _xml_coverage_reports_win | |
| # A custom title that can be added to the code | |
| # coverage summary in the PR comment. | |
| coverage-summary-title: "Code Coverage (Windows)" | |
| # Make the code coverage report togglable | |
| togglable-report: true | |
| # Github token to use to publish the check | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| sonarqube: | |
| name: SonarQube scan | |
| needs: tests | |
| runs-on: ubuntu-latest | |
| # SONAR_TOKEN is not available to PRs from forks, so skip the scan there. | |
| if: ${{ !github.event.pull_request.head.repo.fork }} | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| # Shallow clones should be disabled for a better relevancy of analysis | |
| fetch-depth: 0 | |
| - name: Download Ubuntu coverage artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: unit-test-results-python3.14-ubuntu-latest | |
| path: test-reports | |
| - name: SonarQube Scan | |
| uses: SonarSource/sonarqube-scan-action@v7.1.0 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| with: | |
| args: > | |
| -Dsonar.projectKey=cs-si_eodag | |
| -Dsonar.organization=cs-si | |
| -Dsonar.python.version=3.9,3.10,3.11,3.12,3.13,3.14 | |
| -Dsonar.python.coverage.reportPaths=test-reports/coverage.xml | |
| -Dsonar.sources=eodag/ | |
| -Dsonar.tests=tests/ | |
| -Dsonar.verbose=true | |
| build-docs: | |
| name: Build the docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| # Get history and tags for SCM versioning to work | |
| fetch-depth: 0 | |
| - name: Install the latest version of uv with cache enabled | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "" | |
| - name: Install pandoc | |
| run: | | |
| curl -s https://api.github.com/repos/jgm/pandoc/releases/latest | grep -o "https.*amd64.deb" | wget -O pandoc.deb -qi - | |
| sudo dpkg -i pandoc.deb && rm pandoc.deb | |
| - name: Testing with tox | |
| run: uvx --with tox-uv tox -e docs | |
| check-pypi: | |
| name: Long description check for PyPI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| # Get history and tags for SCM versioning to work | |
| fetch-depth: 0 | |
| - name: Install the latest version of uv with cache enabled | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: "latest" | |
| enable-cache: true | |
| cache-dependency-glob: "" | |
| - name: Testing with tox and sphinx (to have rst2html.py utility available) | |
| run: uvx --with tox-uv --with sphinx tox -e pypi |