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
44 changes: 44 additions & 0 deletions .github/actions/build/verify-structure/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Run Build job - Verify Structure
description: Download and verify the structure of the built wheel package.

inputs:
expected-directories:
description: 'Newline-separated list of directories expected to exist relative to site-packages'
required: false
default: ''
expected-files:
description: 'Newline-separated list of files expected to exist relative to site-packages'
required: false
default: ''

runs:
using: composite
steps:
Expand Down Expand Up @@ -36,14 +46,48 @@ runs:

# Check for required directories in site-packages
echo "Checking required directories in site-packages..."

REQUIRED_DIRS=(
"${SITE_PACKAGES}"
"${SITE_PACKAGES}/${{ env.PACKAGE_NAME }}"
)
REQUIRED_FILES=()

# Build array of required directories
if [ -n "${{ inputs.expected-directories }}" ]; then
while IFS= read -r dir; do
if [ -n "$dir" ]; then
REQUIRED_DIRS+=("${SITE_PACKAGES}/${dir}")
fi
done <<< "${{ inputs.expected-directories }}"
fi

# Build array of required files
if [ -n "${{ inputs.expected-files }}" ]; then
while IFS= read -r file; do
if [ -n "$file" ]; then
REQUIRED_FILES+=("${SITE_PACKAGES}/${file}")
fi
done <<< "${{ inputs.expected-files }}"
fi

# Check for required directories in site-packages
echo "Checking required directories in site-packages..."
for dir in "${REQUIRED_DIRS[@]}"; do
if [ ! -d "$dir" ]; then
echo "Required directory not found: $dir"
exit 1
fi
done

# Check for required files in site-packages
if [ ${#REQUIRED_FILES[@]} -gt 0 ]; then
echo "Checking required files in site-packages..."
for file in "${REQUIRED_FILES[@]}"; do
if [ ! -f "$file" ]; then
echo "Required file not found: $file"
exit 1
fi
done
fi
shell: bash
11 changes: 0 additions & 11 deletions .github/actions/setup/set-package-name/action.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/actions/setup/setup-uv-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ runs:
uses: actions/setup-python@v6
with:
python-version-file: ".python-version"
- name: Set package name
run: |
REPO_NAME="${{ github.event.repository.name }}"
echo "PACKAGE_NAME=${REPO_NAME//-/_}" >> $GITHUB_ENV
shell: bash
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jobs:
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.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main
Expand All @@ -27,10 +23,6 @@ jobs:
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.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ jobs:
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.event.repository.name == 'template-python' }}
- uses: javidahmed64592/template-python/.github/actions/ci/bandit@main
Expand Down
Empty file added .here
Empty file.
34 changes: 14 additions & 20 deletions docs/WORKFLOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,6 @@ 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 @@ -155,7 +140,6 @@ steps:
Usage:
```yaml
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 @@ -216,7 +200,6 @@ steps:
Usage:
```yaml
steps:
- uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main
- uses: javidahmed64592/template-python/.github/actions/build/build-wheel@main
```

Expand All @@ -229,16 +212,27 @@ steps:
- Uses the `install-python-core` action
- Downloads the wheel artifact (named `{PACKAGE_NAME}_wheel`)
- Installs the wheel using `uv pip install`
- Verifies that the package directory exists in site-packages
- Fails if required package structure is missing
- Verifies that `site-packages` and the package directory exist
- Optionally verifies additional directories and files specified in inputs
- Fails if any required structure is missing

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

Advanced usage with additional checks:
```yaml
steps:
- uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main
with:
expected-directories: |
static
expected-files: |
static/index.html
```

## Workflows (`./github/workflows`)

The following workflows ensure Python codebases are robust and thoroughly tested.
Expand Down