|
| 1 | +--- |
| 2 | +name: Python Tests |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: ~ |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + |
| 9 | + # Allow job to be triggered manually. |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | + # Run job each night after CrateDB nightly has been published. |
| 13 | + schedule: |
| 14 | + - cron: '0 3 * * *' |
| 15 | + |
| 16 | +# Cancel in-progress jobs when pushing to the same branch. |
| 17 | +concurrency: |
| 18 | + cancel-in-progress: true |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + |
| 21 | +# Select Python grammar. |
| 22 | +defaults: |
| 23 | + run: |
| 24 | + working-directory: cratedb_sqlparse_py |
| 25 | + |
| 26 | +jobs: |
| 27 | + |
| 28 | + tests: |
| 29 | + |
| 30 | + runs-on: ${{ matrix.os }} |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + os: ["ubuntu-latest"] |
| 35 | + python-version: ["3.8", "3.12"] |
| 36 | + |
| 37 | + env: |
| 38 | + OS: ${{ matrix.os }} |
| 39 | + PYTHON: ${{ matrix.python-version }} |
| 40 | + |
| 41 | + # https://docs.github.com/en/actions/using-containerized-services/about-service-containers |
| 42 | + services: |
| 43 | + cratedb: |
| 44 | + image: crate/crate:nightly |
| 45 | + ports: |
| 46 | + - 4200:4200 |
| 47 | + - 5432:5432 |
| 48 | + env: |
| 49 | + CRATE_HEAP_SIZE: 4g |
| 50 | + |
| 51 | + name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }} |
| 52 | + steps: |
| 53 | + |
| 54 | + - name: Acquire sources |
| 55 | + uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Set up Python |
| 58 | + uses: actions/setup-python@v5 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + architecture: x64 |
| 62 | + cache: 'pip' |
| 63 | + cache-dependency-path: 'pyproject.toml' |
| 64 | + |
| 65 | + - name: Setup project |
| 66 | + run: | |
| 67 | +
|
| 68 | + # `setuptools 0.64.0` adds support for editable install hooks (PEP 660). |
| 69 | + # https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v6400 |
| 70 | + pip install "setuptools>=64" --upgrade |
| 71 | +
|
| 72 | + # Install package in editable mode. |
| 73 | + pip install --use-pep517 --prefer-binary --editable='.[develop,generate,test]' |
| 74 | +
|
| 75 | + - name: Run linter and software tests |
| 76 | + run: | |
| 77 | + poe check |
| 78 | +
|
| 79 | + - name: Upload coverage to Codecov |
| 80 | + uses: codecov/codecov-action@v4 |
| 81 | + env: |
| 82 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 83 | + with: |
| 84 | + files: ./coverage.xml |
| 85 | + flags: unittests |
| 86 | + env_vars: OS,PYTHON |
| 87 | + name: codecov-umbrella |
| 88 | + fail_ci_if_error: true |
0 commit comments