Skip to content

Commit

Permalink
Improve CI
Browse files Browse the repository at this point in the history
* Create package only once
* Split deploy in two steps
* Uploaded packages also to GitHub releases
  • Loading branch information
nicoddemus committed Jun 15, 2023
1 parent 5818160 commit c9a4d13
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ on:

jobs:

deploy:
package:
runs-on: ubuntu-latest
environment: deploy
permissions:
id-token: write # For PyPI trusted publishers.
contents: write # For tag and release notes.
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}

Expand All @@ -25,6 +21,17 @@ jobs:
- name: Build and Check Package
uses: hynek/[email protected]

deploy:
needs: package
runs-on: ubuntu-latest
environment: deploy
permissions:
id-token: write # For PyPI trusted publishers.
contents: write # For tag and release notes.

steps:
- uses: actions/checkout@v3

- name: Download Package
uses: actions/download-artifact@v3
with:
Expand All @@ -36,7 +43,9 @@ jobs:

- name: Push tag
run: |
git tag v${{ github.event.inputs.version }} ${{ github.sha }}
git config user.name "pytest bot"
git config user.email "[email protected]"
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
git push origin v${{ github.event.inputs.version }}
- name: Set up Python
Expand All @@ -54,3 +63,4 @@ jobs:
uses: softprops/action-gh-release@v1
with:
body_path: scripts/latest-release-notes.md
files: dist/*
37 changes: 28 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
name: test

on: [push, pull_request]
on:
push:
branches:
- main
- "test-me-*"

pull_request:


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and Check Package
uses: hynek/[email protected]

test:

needs: [package]

runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -31,21 +47,24 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Download Package
uses: actions/download-artifact@v3
with:
name: Packages
path: dist

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
shell: bash
run: |
tox -e ${{ matrix.tox_env }}
check-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and Check Package
uses: hynek/[email protected]
tox run -e ${{ matrix.tox_env }} --installpkg `find dist/*.tar.gz`

0 comments on commit c9a4d13

Please sign in to comment.