Skip to content

Commit

Permalink
split release CI
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetWolf committed Aug 6, 2024
1 parent b6a3d70 commit 161d728
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--- Thank you for submitting a Pull Request! In order to make our work smoother, please make sure your Pull Request meets the following requirements: 1. Provide a general summary of your changes in the Title above; 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `deps:`, `doc:`, `docs:`, `feat:`, `fix:`, `perf:`, `ref:`, `refactor:`, `revert:`, `style:`, `test:`, `tests:`. -->
<!--- Thank you for submitting a Pull Request! In order to make our work smoother, please make sure your Pull Request meets the following requirements: 1. Provide a general summary of your changes in the Title above; 2. Add appropriate prefixes to titles, such as `build:`, `chore:`, `ci:`, `docs:`, `feat:`, `fix:`, `perf:`, `refactor:`, `revert:`, `style:`, `test:`(Ref: https://www.conventionalcommits.org/). -->

## Description
<!--- Describe your changes in detail -->
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
ci:
if: ${{ !cancelled() && ! failure() }}
needs: dependabot
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
cache: pip
python-version: ${{ matrix.python-version }}
- run: env | sort
- run: make dev
- name: lint test docs and build
run: make lint docs-gen # test docs build
strategy:
matrix:
python-version:
- '3.10'
- '3.11'
dependabot:
if: ${{ github.actor == 'dependabot[bot]' && startsWith(github.head_ref, 'dependabot/pip/') }}
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Set up Git
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
- name: Set up Python with multiple versions.
uses: actions/setup-python@v5
with:
cache: pip
python-version: |
3.10
3.11
- name: Install pipenv using pipx
run: pipx install pipenv
- name: Generate constraints for all supported Python versions
run: |
CI= PYTHON_VERSION=3.10 make constraints
CI= PYTHON_VERSION=3.11 make constraints
- name: Push changes if applicable
run: |
if [[ -n `git status --porcelain` ]]; then
git commit -a -m "build: Update constraints for dependabot."
git push
fi
name: CI
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- name: Check PR Title for Conventional Commit Format
run: |
if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|deps|doc|docs|feat|fix|perf|ref|refactor|revert|style|test|tests|Bump version)(\(\w+\))?!?:\s.*'; then
if ! echo "${{ github.event.pull_request.title }}" | grep -Pq '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*'; then
echo 'The title does not conform to the Conventional Commit.'
echo 'Please refer to "https://www.conventionalcommits.org/"'
exit 1
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,7 @@ jobs:
- name: Release please
uses: googleapis/release-please-action@v4
with:
# The current PAT (personal access token) was created on 2024-08-05,
# since the maximum validity of PAT is 1 year, you need to change the PAT before 2025-08-05.
token: ${{ secrets.PAT }}
release-type: simple
# package:
# needs: release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# cache: pip
# python-version: '3.10'
# - run: env | sort
# - run: make dev
# - run: make build
# - env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: |
# make upload
27 changes: 27 additions & 0 deletions .github/workflows/upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Package and upload to pypi
on:
pull_request:
types:
- closed
jobs:
# package:
# if: |
# github.event.pull_request.merged == true &&
# startsWith(github.event.pull_request.title, 'chore(main): release')
# needs: release
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# cache: pip
# python-version: '3.10'
# - run: env | sort
# - run: make dev
# - run: make build
# - env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
# run: |
# make upload
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ build-backend = "setuptools.build_meta"
requires = [
"setuptools",
"setuptools-scm",
"wheel",
]

[project]
Expand Down Expand Up @@ -108,6 +109,8 @@ package = {file = ["requirements/package.txt"]}
test = {file = ["requirements/test.txt"]}

[tool.setuptools_scm]
version_scheme = "post-release"
local_scheme = "no-local-version"

[tool.tomlsort]
all = true
Expand Down
1 change: 1 addition & 0 deletions requirements/package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
build
setuptools-scm
twine
wheel

0 comments on commit 161d728

Please sign in to comment.