askrobots / dbbasic-tsv
Public
A database in TSV text files: data you can read, fast inserts, and an optional Rust speed-up.
ci.yml · 2.3 KB · 105 lines
| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [ main ] |
| 6 | pull_request: |
| 7 | branches: [ main ] |
| 8 | |
| 9 | jobs: |
| 10 | test: |
| 11 | runs-on: ${{ matrix.os }} |
| 12 | strategy: |
| 13 | matrix: |
| 14 | os: [ubuntu-latest, macos-latest, windows-latest] |
| 15 | python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 16 | |
| 17 | steps: |
| 18 | - uses: actions/checkout@v3 |
| 19 | |
| 20 | - name: Set up Python ${{ matrix.python-version }} |
| 21 | uses: actions/setup-python@v4 |
| 22 | with: |
| 23 | python-version: ${{ matrix.python-version }} |
| 24 | |
| 25 | - name: Install dependencies |
| 26 | run: | |
| 27 | python -m pip install --upgrade pip |
| 28 | pip install -e ".[dev]" |
| 29 | |
| 30 | - name: Run tests |
| 31 | run: | |
| 32 | pytest tests/ -v --cov=dbbasic --cov-report=xml |
| 33 | |
| 34 | - name: Upload coverage |
| 35 | if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' |
| 36 | uses: codecov/codecov-action@v3 |
| 37 | with: |
| 38 | file: ./coverage.xml |
| 39 | |
| 40 | lint: |
| 41 | runs-on: ubuntu-latest |
| 42 | steps: |
| 43 | - uses: actions/checkout@v3 |
| 44 | |
| 45 | - name: Set up Python |
| 46 | uses: actions/setup-python@v4 |
| 47 | with: |
| 48 | python-version: '3.11' |
| 49 | |
| 50 | - name: Install dependencies |
| 51 | run: | |
| 52 | python -m pip install --upgrade pip |
| 53 | pip install flake8 black isort |
| 54 | |
| 55 | - name: Run linting |
| 56 | run: | |
| 57 | flake8 dbbasic/ templates/ --count --select=E9,F63,F7,F82 --show-source --statistics |
| 58 | black --check dbbasic/ |
| 59 | isort --check-only dbbasic/ |
| 60 | |
| 61 | benchmark: |
| 62 | runs-on: ubuntu-latest |
| 63 | steps: |
| 64 | - uses: actions/checkout@v3 |
| 65 | |
| 66 | - name: Set up Python |
| 67 | uses: actions/setup-python@v4 |
| 68 | with: |
| 69 | python-version: '3.11' |
| 70 | |
| 71 | - name: Install package |
| 72 | run: | |
| 73 | python -m pip install --upgrade pip |
| 74 | pip install -e . |
| 75 | |
| 76 | - name: Run benchmarks |
| 77 | run: | |
| 78 | python benchmarks/compare_sqlite.py |
| 79 | |
| 80 | publish: |
| 81 | needs: [test, lint] |
| 82 | runs-on: ubuntu-latest |
| 83 | if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 84 | |
| 85 | steps: |
| 86 | - uses: actions/checkout@v3 |
| 87 | |
| 88 | - name: Set up Python |
| 89 | uses: actions/setup-python@v4 |
| 90 | with: |
| 91 | python-version: '3.11' |
| 92 | |
| 93 | - name: Install dependencies |
| 94 | run: | |
| 95 | python -m pip install --upgrade pip |
| 96 | pip install build twine |
| 97 | |
| 98 | - name: Build package |
| 99 | run: python -m build |
| 100 | |
| 101 | - name: Publish to PyPI |
| 102 | env: |
| 103 | TWINE_USERNAME: __token__ |
| 104 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| 105 | run: twine upload dist/* |