Skip to content

Commit

Permalink
perf(release): use cli instead
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <[email protected]>
  • Loading branch information
msclock committed Mar 21, 2024
1 parent 172d8d8 commit 23febb6
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 130 deletions.
225 changes: 104 additions & 121 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- master
- beta

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -15,140 +16,122 @@ env:
FORCE_COLOR: 3

jobs:
lint:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
with:
extra_args: --hook-stage manual --all-files
- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
checks:
name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
needs: [lint]
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.12"]
runs-on: [ubuntu-latest]

include:
- python-version: pypy-3.10
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install package
run: python -m pip install .[test]

- name: Test package
run: >-
python -m pytest -ra --cov --cov-report=xml --cov-report=term
--durations=20
- name: Upload coverage report
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}

docs:
name: Check building docs
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}

- uses: wntrblm/[email protected]
with:
python-versions: "3.11"

- name: Linkcheck
run: nox -s docs -- -b linkcheck

- name: Build docs with warnings as errors
run: nox -s docs -- -W

- name: Verify no changes required to API docs
run: |
nox -s build_api_docs
git diff --exit-code
pass:
if: always()
needs: [lint, checks, docs]
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
# lint:
# name: Format
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - uses: actions/setup-python@v4
# with:
# python-version: "3.x"
# - uses: pre-commit/[email protected]
# with:
# extra_args: --hook-stage manual --all-files
# - name: Run PyLint
# run: |
# echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
# pipx run nox -s pylint

# checks:
# name: Check Python ${{ matrix.python-version }} on ${{ matrix.runs-on }}
# runs-on: ${{ matrix.runs-on }}
# needs: [lint]
# strategy:
# fail-fast: false
# matrix:
# python-version: ["3.7", "3.8", "3.12"]
# runs-on: [ubuntu-latest]

# include:
# - python-version: pypy-3.10
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0

# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# allow-prereleases: true

# - name: Install package
# run: python -m pip install .[test]

# - name: Test package
# run: >-
# python -m pytest -ra --cov --cov-report=xml --cov-report=term
# --durations=20

# - name: Upload coverage report
# uses: codecov/[email protected]
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

# docs:
# name: Check building docs
# runs-on: ubuntu-latest
# timeout-minutes: 15

# steps:
# - uses: actions/checkout@v4
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# ref: ${{ github.head_ref }}

# - uses: wntrblm/[email protected]
# with:
# python-versions: "3.11"

# - name: Linkcheck
# run: nox -s docs -- -b linkcheck

# - name: Build docs with warnings as errors
# run: nox -s docs -- -W

# - name: Verify no changes required to API docs
# run: |
# nox -s build_api_docs
# git diff --exit-code

# pass:
# if: always()
# needs: [lint, checks, docs]
# runs-on: ubuntu-latest
# timeout-minutes: 2
# steps:
# - name: Decide whether the needed jobs succeeded or failed
# uses: re-actors/alls-green@release/v1
# with:
# jobs: ${{ toJSON(needs) }}

release:
name: release
runs-on: ubuntu-latest
permissions:
contents: write
needs: [pass]
contents: write # to be able to publish a GitHub release
id-token: write # to enable use of OIDC for npm provenance
# needs: [pass]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ github.token }}

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: lts/*

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
semantic_version: 22.0.5
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'main',
'next',
'next-major',
{
name: 'beta',
prerelease: true
},
{
name: 'alpha',
prerelease: true
}
]
extra_plugins: |
@semantic-release/exec
@semantic-release/github
conventional-changelog-conventionalcommits
- name: Install dependencies
run: |
npm install -g semantic-release@^22.0.5 @semantic-release/exec @semantic-release/github conventional-changelog-conventionalcommits
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ github.token }}
33 changes: 24 additions & 9 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
module.exports = {
branches: [
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'master',
'next',
'next-major',
{
name: 'beta',
prerelease: true
},
{
name: 'alpha',
prerelease: true
}
],
dryRun: false,
plugins: [
[
Expand Down Expand Up @@ -49,15 +64,15 @@ module.exports = {
},
},
],
[
"@semantic-release/exec",
{
publishCmd: [
"git tag -a -f v${nextRelease.version} --cleanup=whitespace -m '${nextRelease.notes}'",
"git push --force origin v${nextRelease.version}",
].join(" && "),
},
],
// [
// "@semantic-release/exec",
// {
// publishCmd: [
// "git tag -a -f v${nextRelease.version} --cleanup=whitespace -m '${nextRelease.notes}'",
// "git push --force origin v${nextRelease.version}",
// ].join(" && "),
// },
// ],
"@semantic-release/github",
],
};

0 comments on commit 23febb6

Please sign in to comment.