diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yaml similarity index 53% rename from .github/workflows/test.yml rename to .github/workflows/ci.yaml index bbca5a99b6..98df267eb1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yaml @@ -1,11 +1,14 @@ -name: Tests (tox) +name: CI on: - push - pull_request +env: + DEFAULT_PYTHON: '3.11' + jobs: - build: + tests: runs-on: ubuntu-latest strategy: matrix: @@ -25,11 +28,11 @@ jobs: - name: Test with tox run: tox - if: ${{ matrix.python-version != '3.11' }} + if: ${{ matrix.python-version != env.DEFAULT_PYTHON }} - name: Test with tox (and upload coverage) uses: paambaati/codeclimate-action@v5.0.0 - if: ${{ matrix.python-version == '3.11' }} + if: ${{ matrix.python-version == env.DEFAULT_PYTHON }} env: CC_TEST_REPORTER_ID: 2a411f596959fc32f5d73f3ba7cef8cc4d5733299d742dbfc97fd6c190b9010c with: @@ -41,3 +44,31 @@ jobs: - uses: codecov/codecov-action@v3 with: directory: '.tox/reports' + + publish: + needs: [tests] + runs-on: ubuntu-latest + environment: testpypi + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '${{ env.DEFAULT_PYTHON }}' + + - name: Build + run: | + # Cheat + sed '/\[tool.setuptools_scm\]/ s/$/\nlocal_scheme = "no-local-version"/' pyproject.toml + pip install build + python3 -m build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/