Continuous Integration #914
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: Continuous Integration | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 3' | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/ci.yml | |
| - "atom/**" | |
| - "tests/**" | |
| - "examples/**" | |
| - setup.py | |
| - pyproject.toml | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.11'] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: 'lint_requirements.txt' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| - name: Install project | |
| run: | | |
| pip install -e . | |
| - name: Install dependencies | |
| run: | | |
| pip install -U -r lint_requirements.txt | |
| - name: Formatting | |
| if: always() | |
| run: | | |
| ruff format atom examples tests --check | |
| - name: Linting | |
| if: always() | |
| run: | | |
| ruff check atom examples tests | |
| - name: Typing | |
| if: always() | |
| run: | | |
| mypy atom examples | |
| types: | |
| name: Type checking | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| if: needs.lint.result == 'success' | |
| strategy: | |
| matrix: | |
| python-version: ['3.10'] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Get history and tags for SCM versioning to work | |
| run: | | |
| git fetch --prune --unshallow | |
| git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| - name: Install project | |
| run: | | |
| pip install . | |
| - name: Run Mypy | |
| run: | | |
| pip install mypy pytest | |
| mypy atom | |
| - name: Test with pytest | |
| run: | | |
| pip install pytest-mypy-plugins regex | |
| python -X dev -m pytest tests/type_checking -v | |
| tests: | |
| name: Unit tests | |
| runs-on: ${{ matrix.os }} | |
| needs: | |
| - lint | |
| if: needs.lint.result == 'success' | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.10', '3.11', '3.12', '3.13', '3.14-dev'] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Get history and tags for SCM versioning to work | |
| run: | | |
| git fetch --prune --unshallow | |
| git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip setuptools | |
| pip install setuptools-scm[toml] | |
| pip install git+https://github.com/nucleic/cppy@main | |
| - name: Install project | |
| env: | |
| CFLAGS: --coverage | |
| # Use legcay command to install the library to be able to measure | |
| # coverage of C++ code. | |
| run: | | |
| python setup.py develop | |
| - name: Test with pytest | |
| run: | | |
| pip install -r test_requirements.txt | |
| python -X dev -m pytest tests --ignore=tests/type_checking --cov --cov-report xml -v -W error | |
| # - name: Generate C++ coverage reports | |
| # if: (github.event_name != 'schedule' && matrix.os != 'windows-latest') | |
| # run: | | |
| # bash -c "find . -type f -name '*.gcno' -exec gcov -pb --all-blocks {} +" || true | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: true | |
| verbose: true |