Skip to content

Commit

Permalink
Fixed GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Dec 7, 2024
1 parent 5286725 commit a6733bc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 39 deletions.
3 changes: 0 additions & 3 deletions .github/actions/release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ runs:
files: dist/*
tag_name: "${{ inputs.tag-name }}"
body_path: release-notes.md
token: ${{ inputs.github-token }}

- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ inputs.pypi-api-token }}
9 changes: 6 additions & 3 deletions .github/actions/setup-python-and-git/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@ inputs:
python-version:
description: 'Python version to use'
required: false
default: '3.11'
default: '3.12'
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Setup Python
with:
python-version: ${{ inputs.python-version }}
cache: 'pip' # caching pip dependencies

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Git check
run: |
git config --global user.email "action@github.actions"
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
name: Checkout the repository
with:
fetch-depth: 0
token: ${{ secrets.PAT }}

- name: Setup Python and Git
uses: ./.github/actions/setup-python-and-git
Expand All @@ -43,8 +42,6 @@ jobs:
echo "pull_request_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
echo "::notice::PR_NUMBER is ${PR_NUMBER}"
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Bump version
if: ${{ env.RELEASE_KIND != 'no-release' }}
Expand Down
44 changes: 14 additions & 30 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,66 +22,50 @@ jobs:
- ubuntu-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
name: Checkout the repository
with:
fetch-depth: 0
- uses: ./.github/actions/setup-python-and-git
with:
python-version: ${{ matrix.python-version }}
- name: Check git is working
run: |
git config --global user.email "test-git@github.actions"
git config --global user.name "Testing Git"
git --version
git config --list
- name: Install test dependencies
run: pip install '.[test]'
run: uv sync -p ${{ matrix.python-version }} --group test
- name: Test
run: coverage -m pytest && coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: test-reports/coverage.xml
flags: python-${{ matrix.python-version }}
verbose: true # optional (default = false)
env_vars: OS,PYTHON
run: uv run pytest

# Upload to Test PyPI.
release-test-pypi:
name: Publish in-dev package to test.pypi.org
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
ref: ${{ github.head_ref }}

- uses: actions/setup-python@v5
- uses: ./.github/actions/setup-python-and-git
with:
python-version: '3.11'
cache: 'pip' # caching pip dependencies
python-version: "3.12"

- name: Install requirements
shell: bash
run: |
python -m pip install --disable-pip-version-check --no-python-version-warning build
python -m pip install --disable-pip-version-check --no-python-version-warning -e .
uv pip install build
uv pip install bump-my-version
- name: Set dev version
shell: bash
run: |
export PR_NUMBER=$(gh pr view --json number -q .number || echo "")
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
echo "::notice::PR_NUMBER is: ${PR_NUMBER}"
bump-my-version bump dev bumpversion/__init__.py --no-commit --no-tag --no-configured-files -v
env:
GH_TOKEN: ${{ secrets.PAT }}
bump-my-version bump dev --no-commit --no-tag -v
- name: Package
shell: bash
Expand Down

0 comments on commit a6733bc

Please sign in to comment.