diff --git a/.editorconfig b/.editorconfig index 310b66a..b06ce13 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,5 +6,5 @@ indent_style = space trim_trailing_whitespace = true indent_size = 4 -[*.json] +[*.json,*.yaml,*.yml] indent_size = 2 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..069f190 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,51 @@ +name: Release + +on: + workflow_dispatch: + +jobs: + run-tests: + uses: ./.github/workflows/tests.yaml + + release: + runs-on: ubuntu-latest + environment: release + permissions: + contents: write + id-token: write + + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Install poetry + run: pipx install poetry + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: poetry + + - name: Install dependencies + run: poetry install --no-dev + + - name: Get release version + id: release-version + run: echo "RELEASE_VERSION=v$(poetry version --short)" >> "$GITHUB_OUTPUT" + + - name: Build package + run: poetry build + + - name: Upload the files to the release + uses: ncipollo/release-action@v1 + with: + artifacts: ${{ github.workspace }}/dist/* + tag: ${{ steps.release-version.outputs.RELEASE_VERSION }} + commit: ${{ github.sha }} + omitBody: true + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1d250ab..bce930e 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -2,50 +2,42 @@ name: Tests on: push: - branches: [main] - tags: ["v*"] + branches: + - main + - develop pull_request: - branches: [main] + branches: + - main + - develop + workflow_call: jobs: tests: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - - uses: actions/checkout@v4 + - name: Checkout the repository + uses: actions/checkout@v4 + - name: Install poetry run: pipx install poetry + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - cache: "poetry" + cache: poetry + - name: Install dependencies run: poetry install -E test - - name: Run tests with coverage - run: poetry run pytest --ignore=tests/test_pycql2_hypothesis.py --cov=pycql2 --cov-report=xml tests/ - publish: - needs: [tests] - runs-on: ubuntu-latest - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - steps: - - uses: actions/checkout@v4 - - name: Install poetry - run: pipx install poetry - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: 3.12 - cache: "poetry" - - name: Install dependencies - run: poetry install --no-dev - - name: Build package - run: poetry build - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} + - name: Run tests with coverage + run: poetry run pytest --ignore=tests/test_pycql2_hypothesis.py --cov=pycql2 --cov-report=term-missing tests/ diff --git a/.vscode/settings.json b/.vscode/settings.json index aeea1f5..2d69f4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,8 +14,7 @@ "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, "markdownlint.config": { - "default": true, - "MD007": { + "ul-indent": { "indent": 4 } }