From 835faceba145eed559d002448e090142cbd0264a Mon Sep 17 00:00:00 2001 From: James Socol Date: Sun, 4 Dec 2022 11:42:42 -0500 Subject: Refactor test action for reusability Pulls the test details into a discrete action that can be reused for the release workflow. --- .github/actions/test/action.yml | 23 +++++++++++++++++++++++ .github/workflows/ci.yml | 28 +++++++++++++++------------- 2 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 .github/actions/test/action.yml (limited to '.github') diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml new file mode 100644 index 0000000..790017e --- /dev/null +++ b/.github/actions/test/action.yml @@ -0,0 +1,23 @@ +name: test +description: 'runs a test matrix' +inputs: + python-version: + required: true + +runs: + using: "composite" + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + + - run: pip install --upgrade pip + shell: sh + + - run: pip install tox + shell: sh + + - run: tox -e py + shell: sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d0da75..ea1e4fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,19 +16,21 @@ jobs: python: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.9'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - run: pip install --upgrade pip - - run: pip install tox - - run: tox -e py + - uses: actions/checkout@v3 + + - uses: ./.github/actions/test + with: + python-version: ${{ matrix.python }} + lint: runs-on: [ubuntu-latest] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - run: pip install flake8 - - run: flake8 statsd + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - run: pip install flake8 + + - run: flake8 statsd -- cgit v1.2.1 From 47d6cf824c6f37294a34563c94c26010c5ccee8d Mon Sep 17 00:00:00 2001 From: James Socol Date: Sun, 4 Dec 2022 11:47:45 -0500 Subject: Add a release workflow Borrowing from the work I did yesterday for django-ratelimit, this should provide automated PyPI build and publish. Fixes #180 --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/release.yml (limited to '.github') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ab82ace --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: release + +on: + push: + tags: + - v* + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + + steps: + - uses: actions/checkout@v3 + + - uses: ./.github/actions/test + with: + python-version: ${{ matrix.python-version }} + + release: + runs-on: ubuntu-latest + needs: [test] + steps: + + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: build + run: ./run.sh build + + - name: check + run: ./run.sh check + + - name: release + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_DEPLOY_TOKEN }} -- cgit v1.2.1