[Enhencement] - Unused code being eliminated #3457
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: CI | |
| on: | |
| workflow_run: | |
| workflows: [Lint] | |
| types: [completed] | |
| pull_request: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-unit: | |
| env: | |
| COVERAGE_PROCESS_START: .coveragerc | |
| # needs: lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # See: https://github.com/actions/setup-python#caching-packages-dependencies | |
| cache: 'pip' # caching pip dependencies | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y curl graphviz rsync | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip packaging setuptools twine | |
| pip install --upgrade -e .[all] | |
| - name: Unit tests | |
| run: | | |
| pytest \ | |
| --cov=autosubmit --cov-config=.coveragerc \ | |
| --cov-report=xml:test/coverage.xml --cov-append \ | |
| --dist load \ | |
| test/unit -m "not postgres" | |
| - name: Coverage report | |
| run: | | |
| coverage report | |
| coverage xml | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage_unit_py-${{ matrix.python-version }} | |
| path: coverage.xml | |
| retention-days: 7 | |
| test-integration: | |
| env: | |
| COVERAGE_PROCESS_START: .coveragerc | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| pytest-markers: ["not postgres and not slurm"] | |
| # Here we include an extra build with the lowest version of Python and Postgres. | |
| # We do it this way to avoid wasting CICD resources since we already tested the | |
| # code with SQLite. So we run just one build with Postgres (normally newer versions | |
| # of Python may succeed while older fail -- e.g. using newer features in a code that | |
| # must support older versions). | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#example-adding-configurations | |
| include: | |
| - python-version: '3.9' | |
| pytest-markers: 'postgres and not slurm' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # See: https://github.com/actions/setup-python#caching-packages-dependencies | |
| cache: 'pip' # caching pip dependencies | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y curl git graphviz rsync xvfb | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip packaging setuptools twine | |
| pip install --upgrade -e .[all] | |
| - name: Set up Git | |
| run: | | |
| # From: https://stackoverflow.com/questions/62960533/how-to-use-git-commands-during-a-github-action | |
| # Set up dummy configuration for integration tests. | |
| git --version | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Actions" | |
| # In GitHub Actions we run all the integration tests, including those that require | |
| # dependencies such as Docker (see `-m ''`, which means all markers). Read the | |
| # CONTRIBUTING.md file for details how to set up your environment to run these. | |
| - name: Integration tests | |
| run: | | |
| Xvfb :99 -screen 0 1024x768x24 -ac & | |
| export DISPLAY=:99 | |
| pytest \ | |
| --cov=autosubmit --cov-config=.coveragerc \ | |
| --cov-report=xml:test/coverage.xml --cov-append \ | |
| --dist load \ | |
| test/integration \ | |
| -m "${{ matrix.pytest-markers }}" | |
| - name: Coverage report | |
| run: | | |
| coverage report | |
| coverage xml | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage_integration_py-${{ matrix.python-version }}-${{ matrix.pytest-markers }} | |
| path: coverage.xml | |
| retention-days: 7 | |
| test-regression: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y curl graphviz rsync | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip packaging setuptools twine | |
| pip install --upgrade -e .[all] | |
| # Run regression tests | |
| - name: Regression tests | |
| run: | | |
| pytest \ | |
| --cov=autosubmit --cov-config=.coveragerc \ | |
| --cov-report=xml:test/coverage.xml --cov-append \ | |
| test/regression \ | |
| -m '' | |
| - name: Coverage report | |
| run: | | |
| coverage report | |
| coverage xml | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage_regression_py-${{ matrix.python-version }} | |
| path: coverage.xml | |
| retention-days: 7 | |
| test-slurm: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.9"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y curl git graphviz rsync | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip packaging | |
| pip install --upgrade -e .[all] | |
| - name: Set up Git | |
| run: | | |
| # From: https://stackoverflow.com/questions/62960533/how-to-use-git-commands-during-a-github-action | |
| # Set up dummy configuration for integration tests. | |
| git --version | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Actions" | |
| - name: Integration tests | |
| run: | | |
| pytest \ | |
| --cov=autosubmit --cov-config=.coveragerc \ | |
| --cov-report=xml:test/coverage.xml --cov-append \ | |
| test/integration \ | |
| --capture=no \ | |
| -m 'slurm' | |
| - name: Coverage report | |
| run: | | |
| coverage report | |
| coverage xml | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage_slurm_py-${{ matrix.python-version }} | |
| path: coverage.xml | |
| retention-days: 7 | |
| # NOTE: The docs are already built on ReadTheDocs. We perform another quick build,Add commentMore actions | |
| # without checking or deploying the produced HTML, just to i) verify that | |
| # we can build it and ii) collect the coverage of the examples executed. | |
| test-docs: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| python-version: [ "3.9" ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y curl graphviz rsync | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip packaging setuptools twine | |
| pip install --upgrade -e .[all] | |
| # Run regression tests | |
| - name: Build docs | |
| run: | | |
| cd docs && make xml_coverage | |
| - name: Coverage report | |
| run: | | |
| cd docs | |
| coverage xml | |
| coverage report | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage_docs-${{ matrix.python-version }} | |
| path: docs/coverage.xml | |
| retention-days: 7 | |
| test-misc: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| strategy: | |
| matrix: | |
| python-version: [ "3.10" ] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip packaging setuptools twine | |
| # To validate CFF citation files. | |
| python -m pip install cffconvert | |
| - name: Validate citation file | |
| run: | | |
| cffconvert --validate -i CITATION.cff | |
| coverage: | |
| needs: [test-unit, test-integration, test-regression, test-slurm, test-docs] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Download coverage artifacts | |
| uses: actions/download-artifact@v6 | |
| - name: Codecov upload | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| name: ${{ github.workflow }} | |
| flags: fast-tests | |
| fail_ci_if_error: true | |
| verbose: true | |
| # Token not required for public repos, but avoids upload failure due | |
| # to rate-limiting (but not for PRs opened from forks) | |
| token: ${{ secrets.CODECOV_TOKEN }} |