diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..d96bd64 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,42 @@ +name: Pull Request Events + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + test-unit: + name: Unit tests + runs-on: ubuntu-latest + + steps: + - name: โฌ‡๏ธ Set up code + uses: actions/checkout@v4 + with: + show-progress: false + + - name: ๐Ÿ Set up Python + uses: actions/setup-python@v5 + with: + cache: pip + cache-dependency-path: setup.py + + - name: ๐Ÿ— Install module + run: pip install .[tests] + + - name: ๐Ÿงถ Lint + run: ruff check --output-format=github . + + - name: ๐Ÿงช Run tests + run: pytest + + - name: โฌ†๏ธ Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./cov.xml \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cd65d28..f8eb43f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - dev concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -17,8 +16,6 @@ jobs: permissions: contents: write pull-requests: write - outputs: - release_created: ${{ steps.release-please.outputs.release_created }} steps: - name: ๐Ÿš€ Create Release @@ -26,40 +23,8 @@ jobs: uses: agrc/release-composite-action@v1 with: release-type: python - prerelease: ${{ github.ref_name == 'dev' }} repo-token: ${{ secrets.GITHUB_TOKEN }} github-app-id: ${{ secrets.UGRC_RELEASE_BOT_APP_ID }} github-app-key: ${{ secrets.UGRC_RELEASE_BOT_APP_KEY }} github-app-name: ${{ secrets.UGRC_RELEASE_BOT_NAME }} github-app-email: ${{ secrets.UGRC_RELEASE_BOT_EMAIL }} - - deploy-prod: - runs-on: ubuntu-latest - needs: release-please - if: github.ref == 'refs/heads/main' && needs.release-please.outputs.release_created - environment: - name: prod - url: https://pypi.org/project/ugrc-swapper/ - permissions: - id-token: write - - steps: - - name: โฌ‡๏ธ Set up code - uses: actions/checkout@v4 - with: - show-progress: false - - - name: ๐Ÿ Set up Python - uses: actions/setup-python@v5 - with: - cache: pip - cache-dependency-path: setup.py - - - name: ๐Ÿ›ž Install wheel - run: pip install wheel - - - name: ๐Ÿ“ฆ Build package - run: python setup.py sdist bdist_wheel - - - name: ๐Ÿš€ Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..18c4139 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +name: Release Events +on: + release: + types: [published] + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: โฌ‡๏ธ Set up code + uses: actions/checkout@v4 + with: + show-progress: false + + - name: ๐Ÿ Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: .python-version + cache: pip + cache-dependency-path: setup.py + + - name: ๐Ÿ“ฆ Build package + run: pipx run build + + - name: โฌ†๏ธ Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: dist + retention-days: 1 + + publish: + name: Publish + runs-on: ubuntu-latest + needs: build + environment: + name: prod + url: https://pypi.org/project/ugrc-swapper + permissions: + id-token: write + + steps: + - name: โฌ‡๏ธ Download artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: dist + + - name: ๐Ÿš€ Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + notify: + name: Notifications + runs-on: ubuntu-latest + needs: publish + permissions: + contents: read + pull-requests: write + issues: write + steps: + - name: Release Notifier + uses: agrc/release-issue-notifications-action@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index bf3e305..913bb5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +[build-system] +requires = ["setuptools >= 70.2"] + [tool.ruff] line-length = 120 ignore = ["E501"]