Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/build/build-wheel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-core
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-core@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Create wheel
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/build/verify-structure/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-core
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-core@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Download wheel artifact
uses: actions/download-artifact@v7
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/bandit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Security check
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/mypy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Check with mypy
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/pip-audit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Audit dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/pytest/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Test with pytest
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/ruff/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Check with ruff
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/validate-pyproject/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Validate pyproject.toml
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/ci/version-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/install-python-dev
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/install-python-dev@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Check version consistency
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup/install-python-core/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/setup-uv-python
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Install dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/setup/install-python-dev/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ runs:
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/setup-uv-python
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/setup/setup-uv-python@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

- name: Install dependencies
run: |
Expand Down
11 changes: 11 additions & 0 deletions .github/actions/setup/set-package-name/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Set Package Name
description: Sets the PACKAGE_NAME environment variable by replacing hyphens with underscores in the repository name.

runs:
using: composite
steps:
- name: Set package name
run: |
REPO_NAME="${{ github.event.repository.name }}"
echo "PACKAGE_NAME=${REPO_NAME//-/_}" >> $GITHUB_ENV
shell: bash
19 changes: 12 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,30 @@ on:
branches:
- main

env:
PACKAGE_NAME: template_python

jobs:
build-wheel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/set-package-name
if: ${{ github.event.repository.name == 'template-python' }}
# - uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
# if: ${{ github.event.repository.name != 'template-python' }}
- uses: ./.github/actions/build/build-wheel
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

verify-structure:
runs-on: ubuntu-latest
needs: build-wheel
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/set-package-name
if: ${{ github.event.repository.name == 'template-python' }}
# - uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
# if: ${{ github.event.repository.name != 'template-python' }}
- uses: ./.github/actions/build/verify-structure
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}
35 changes: 18 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,70 @@ on:
branches:
- main

env:
PACKAGE_NAME: template_python

jobs:
validate-pyproject:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ci/validate-pyproject
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/validate-pyproject@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ci/ruff
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/ruff@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ci/mypy
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/mypy@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ci/pytest
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/pytest@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup/set-package-name
if: ${{ github.event.repository.name == 'template-python' }}
# - uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
# if: ${{ github.event.repository.name != 'template-python' }}
- uses: ./.github/actions/ci/bandit
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/bandit@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

pip-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ci/pip-audit
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/pip-audit@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}

version-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ci/version-check
if: ${{ github.repository == 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/version-check@main
if: ${{ github.repository != 'javidahmed64592/template-python' }}
if: ${{ github.event.repository.name != 'template-python' }}
24 changes: 18 additions & 6 deletions docs/WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ steps:

---

**set-package-name:**
- Description: Sets the `PACKAGE_NAME` environment variable by replacing hyphens with underscores in the repository name.
- Location: `set-package-name/action.yml`
- Steps:
- Derives `PACKAGE_NAME` from `github.event.repository.name` using bash parameter expansion (`${REPO_NAME//-/_}`)
- Writes the result to `$GITHUB_ENV` so it is available to all subsequent steps

Usage:
```yaml
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
```

---

### CI Actions (`/ci/**/action.yml`)

**validate-pyproject:**
Expand Down Expand Up @@ -139,9 +154,8 @@ steps:

Usage:
```yaml
env:
PACKAGE_NAME: your_package_name
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
- uses: javidahmed64592/template-python/.github/actions/ci/bandit@main
```

Expand Down Expand Up @@ -201,9 +215,8 @@ steps:

Usage:
```yaml
env:
PACKAGE_NAME: your_package_name
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
- uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main
```

Expand All @@ -221,9 +234,8 @@ steps:

Usage:
```yaml
env:
PACKAGE_NAME: your_package_name
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
- uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main
```

Expand Down