delete .github
Some checks failed
Tests / test (ubuntu-latest, 3.9) (push) Failing after 15m43s
Tests / test (ubuntu-latest, 3.10) (push) Failing after 1m15s
Tests / test (ubuntu-latest, 3.8) (push) Failing after 23m0s
Tests / test (macos-latest, 3.10) (push) Has been cancelled
Tests / test (macos-latest, 3.8) (push) Has been cancelled
Tests / test (macos-latest, 3.9) (push) Has been cancelled
Tests / test (windows-latest, 3.10) (push) Has been cancelled
Tests / test (windows-latest, 3.8) (push) Has been cancelled
Tests / test (windows-latest, 3.9) (push) Has been cancelled
Some checks failed
Tests / test (ubuntu-latest, 3.9) (push) Failing after 15m43s
Tests / test (ubuntu-latest, 3.10) (push) Failing after 1m15s
Tests / test (ubuntu-latest, 3.8) (push) Failing after 23m0s
Tests / test (macos-latest, 3.10) (push) Has been cancelled
Tests / test (macos-latest, 3.8) (push) Has been cancelled
Tests / test (macos-latest, 3.9) (push) Has been cancelled
Tests / test (windows-latest, 3.10) (push) Has been cancelled
Tests / test (windows-latest, 3.8) (push) Has been cancelled
Tests / test (windows-latest, 3.9) (push) Has been cancelled
This commit is contained in:
parent
9eee991889
commit
a646fd2395
161
.github/workflows/create-release.yml
vendored
161
.github/workflows/create-release.yml
vendored
@ -1,161 +0,0 @@
|
||||
name: Create Release and Publish
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version_bump:
|
||||
description: "Type of version bump"
|
||||
required: true
|
||||
default: "patch"
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
custom_version:
|
||||
description: "Custom version (if specified, ignores version_bump)"
|
||||
required: false
|
||||
skip_publish:
|
||||
description: "Skip publishing to PyPI"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel semver
|
||||
|
||||
- name: Determine current version
|
||||
id: current_version
|
||||
run: |
|
||||
CURRENT_VERSION=$(grep -E "__version__\s*=\s*['\"]([^'\"]+)['\"]" src/jimaku_dl/cli.py | cut -d'"' -f2)
|
||||
echo "Current version: $CURRENT_VERSION"
|
||||
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Calculate new version
|
||||
id: new_version
|
||||
run: |
|
||||
if [ -n "${{ github.event.inputs.custom_version }}" ]; then
|
||||
NEW_VERSION="${{ github.event.inputs.custom_version }}"
|
||||
echo "Using custom version: $NEW_VERSION"
|
||||
else
|
||||
BUMP_TYPE="${{ github.event.inputs.version_bump }}"
|
||||
CURRENT="${{ env.CURRENT_VERSION }}"
|
||||
|
||||
if [ "$BUMP_TYPE" = "patch" ]; then
|
||||
MAJOR=$(echo $CURRENT | cut -d. -f1)
|
||||
MINOR=$(echo $CURRENT | cut -d. -f2)
|
||||
PATCH=$(echo $CURRENT | cut -d. -f3)
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
||||
elif [ "$BUMP_TYPE" = "minor" ]; then
|
||||
MAJOR=$(echo $CURRENT | cut -d. -f1)
|
||||
MINOR=$(echo $CURRENT | cut -d. -f2)
|
||||
NEW_MINOR=$((MINOR + 1))
|
||||
NEW_VERSION="$MAJOR.$NEW_MINOR.0"
|
||||
elif [ "$BUMP_TYPE" = "major" ]; then
|
||||
MAJOR=$(echo $CURRENT | cut -d. -f1)
|
||||
NEW_MAJOR=$((MAJOR + 1))
|
||||
NEW_VERSION="$NEW_MAJOR.0.0"
|
||||
else
|
||||
echo "Invalid bump type: $BUMP_TYPE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Bumping $BUMP_TYPE version: $CURRENT → $NEW_VERSION"
|
||||
fi
|
||||
|
||||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Update version in files
|
||||
run: |
|
||||
# Update version in cli.py instead of __init__.py
|
||||
sed -i "s/__version__ = \"${{ env.CURRENT_VERSION }}\"/__version__ = \"${{ env.NEW_VERSION }}\"/g" src/jimaku_dl/cli.py
|
||||
|
||||
# Still update setup.cfg if it exists
|
||||
if [ -f "setup.cfg" ]; then
|
||||
sed -i "s/version = ${{ env.CURRENT_VERSION }}/version = ${{ env.NEW_VERSION }}/g" setup.cfg
|
||||
fi
|
||||
|
||||
echo "Updated version to ${{ env.NEW_VERSION }} in code files"
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
run: |
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$PREV_TAG" ]; then
|
||||
CHANGELOG=$(git log --pretty=format:"* %s (%h)" --no-merges)
|
||||
else
|
||||
CHANGELOG=$(git log $PREV_TAG..HEAD --pretty=format:"* %s (%h)" --no-merges)
|
||||
fi
|
||||
|
||||
if [ -z "$CHANGELOG" ]; then
|
||||
CHANGELOG="* Bug fixes and improvements"
|
||||
fi
|
||||
|
||||
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Commit version changes
|
||||
run: |
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
# Update the git add command to include cli.py instead of __init__.py
|
||||
git add src/jimaku_dl/cli.py
|
||||
if [ -f "setup.cfg" ]; then
|
||||
git add setup.cfg
|
||||
fi
|
||||
git commit -m "Bump version to ${{ env.NEW_VERSION }}"
|
||||
git tag -a "v${{ env.NEW_VERSION }}" -m "Release v${{ env.NEW_VERSION }}"
|
||||
git push --follow-tags
|
||||
|
||||
- name: Create GitHub Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: "v${{ env.NEW_VERSION }}"
|
||||
name: "Release v${{ env.NEW_VERSION }}"
|
||||
body: |
|
||||
## Changes in this release
|
||||
|
||||
${{ steps.changelog.outputs.CHANGELOG }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build package
|
||||
if: ${{ !inputs.skip_publish }}
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
python -m build
|
||||
|
||||
- name: Publish package to PyPI
|
||||
if: ${{ !inputs.skip_publish }}
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
skip_existing: true
|
63
.github/workflows/publish-pypi.yml
vendored
63
.github/workflows/publish-pypi.yml
vendored
@ -1,63 +0,0 @@
|
||||
name: Publish to PyPI
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published, released]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip_release_check:
|
||||
description: "Skip release check (use current version in files)"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build twine
|
||||
pip install -e .
|
||||
|
||||
- name: Verify version matches release tag
|
||||
if: github.event_name == 'release' && !inputs.skip_release_check
|
||||
run: |
|
||||
TAG_VERSION=${GITHUB_REF#refs/tags/}
|
||||
TAG_VERSION=${TAG_VERSION#v}
|
||||
|
||||
CODE_VERSION=$(grep -E "__version__\s*=\s*['\"]([^'\"]+)['\"]" src/jimaku_dl/__init__.py | cut -d'"' -f2)
|
||||
|
||||
echo "Tag version: $TAG_VERSION"
|
||||
echo "Code version: $CODE_VERSION"
|
||||
|
||||
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
|
||||
echo "Error: Version mismatch between tag ($TAG_VERSION) and code ($CODE_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Version verified: $CODE_VERSION"
|
||||
|
||||
- name: Build package
|
||||
run: python -m build
|
||||
|
||||
- name: Publish package to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
user: __token__
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
skip_existing: true
|
72
.github/workflows/test.yml
vendored
72
.github/workflows/test.yml
vendored
@ -1,72 +0,0 @@
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
pull_request:
|
||||
branches: [master]
|
||||
paths:
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
python-version: [3.8, 3.9, "3.10"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Cache pip dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
pip install pytest pytest-cov pytest-mock flake8 black isort
|
||||
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
flake8 src/jimaku_dl --max-line-length 88
|
||||
|
||||
- name: Check formatting with black
|
||||
run: |
|
||||
black --check src/jimaku_dl
|
||||
|
||||
- name: Check imports with isort
|
||||
run: |
|
||||
isort --check src/jimaku_dl
|
||||
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest --cov-branch --cov=jimaku_dl --cov-report=xml
|
||||
pytest --cov --junitxml=junit.xml -o junit_family=legacy
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
fail_ci_if_error: false
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload test results to Codecov
|
||||
if: ${{ !cancelled() }}
|
||||
uses: codecov/test-results-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
Loading…
x
Reference in New Issue
Block a user