From 99924b501077e583ff7cd9fcc9eb772e0b616aff Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Sat, 24 Feb 2024 09:50:21 +1000 Subject: [PATCH] Use github actions --- .circleci/config.yml | 51 ----------------------------------- .github/workflows/ci.yml | 32 ++++++++++++++++++++++ .github/workflows/release.yml | 40 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 51 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d8d7eb1..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,51 +0,0 @@ -version: 2.1 - -orbs: - python: rohanpm/python@1.3.0 - -workflows: - version: 2 - ci-cd: - jobs: - - python/tox: - name: Python 3.8 tests - toxenv: py38 - executor: python/python38 - filters: &ci_filters - branches: - ignore: gh-pages - tags: - only: /^v.*/ - - python/tox: - name: Static checks - toxenv: static - filters: - <<: *ci_filters - - python/tox: - name: API compatibility check - toxenv: pidiff - filters: - <<: *ci_filters - - python/tox: - name: Build docs - toxenv: docs - # For pushing to gh-pages - context: pidiff-secrets - post-steps: - - run: scripts/push-docs - filters: &post_merge_filters - branches: - only: - - master - tags: - only: /^v.*/ - - python/release: - name: Release to PyPI - # For twine credentials - context: pidiff-secrets - # Only release if all tests passed - requires: - - Python 3.8 tests - - Static checks - filters: - <<: *post_merge_filters diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9c93d03 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: + pull_request: + branches: [main] + workflow_call: {} + +jobs: + run-ci: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: | + 3.8 + 3.9 + 3.10 + 3.11 + 3.12 + + - name: Install dependencies + run: | + python -m pip install -U pip + pip install tox + + - name: Run tests + run: | + tox -s false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..66df9ca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release to PyPI + +on: + push: + tags: + - v** + workflow_dispatch: {} + +jobs: + run-ci: + uses: ./.github/workflows/ci.yml + + pypi-publish: + name: Upload release to PyPI + needs: [run-ci] + runs-on: ubuntu-22.04 + environment: + name: pypi + url: https://pypi.org/p/pidiff + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.12 + + - name: Install dependencies + run: | + python -m pip install -U pip + pip install build + + - name: Build distribution + run: | + python -mbuild + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1