diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 5c93eaf..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: CI - -on: - push: - branches: - - master - tags: - - 'v*' - pull_request: - branches: - - master - -jobs: - build: - name: Python ${{ matrix.python-version }} - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - pip install -r dev-requirements.txt - - - name: Build and run tests - run: | - pip install . - make test - make coverage - - publish: - needs: build - if: | - github.event_name == 'push' - && startsWith(github.ref, 'refs/tags/v') - && github.repository == 'waterfountain1996/sqlalchemy-window' - name: Publish release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel build twine - - - name: Build and publish to PyPI - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | - python -m build - twine upload dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..eac2261 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,71 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/cache@v3 + id: cache + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('dev-requirements.txt', 'pyproject.toml') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make install + + - name: Run linter + run: | + make lint + make typecheck + + test: + runs-on: ubuntu-latest + needs: lint + strategy: + matrix: + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/cache@v3 + id: cache + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('dev-requirements.txt', 'pyproject.toml') }} + + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: make install + + - name: Run tests + run: make test + + - name: Display test coverage + run: make coverage diff --git a/Makefile b/Makefile index e55e557..3640c95 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ sources := src tests +install: + pip install --upgrade pip + pip install -r dev-requirements.txt + pip install -e . + test: coverage run