From 9b9302800bd39e13580f6e36c23720e2a46e7045 Mon Sep 17 00:00:00 2001 From: Javid Ahmed Date: Fri, 6 Mar 2026 20:54:36 +0000 Subject: [PATCH 1/4] Add FRONTEND_PACKAGE_NAME to environment variables in action --- .github/actions/setup/set-package-name/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup/set-package-name/action.yml b/.github/actions/setup/set-package-name/action.yml index 2341112..f884570 100644 --- a/.github/actions/setup/set-package-name/action.yml +++ b/.github/actions/setup/set-package-name/action.yml @@ -8,4 +8,5 @@ runs: run: | REPO_NAME="${{ github.event.repository.name }}" echo "PACKAGE_NAME=${REPO_NAME//-/_}" >> $GITHUB_ENV + echo "FRONTEND_PACKAGE_NAME=${REPO_NAME}-frontend" >> $GITHUB_ENV shell: bash From 5d1c5cd7347d133e8781e28d1b958615b833305c Mon Sep 17 00:00:00 2001 From: Javid Ahmed Date: Fri, 6 Mar 2026 21:18:41 +0000 Subject: [PATCH 2/4] Refactor: Remove set-package-name action and update workflows accordingly --- .../actions/setup/set-package-name/action.yml | 12 ------------ .../actions/setup/setup-uv-python/action.yml | 5 +++++ .github/workflows/build.yml | 8 -------- .github/workflows/ci.yml | 4 ---- docs/WORKFLOWS.md | 18 ------------------ 5 files changed, 5 insertions(+), 42 deletions(-) delete mode 100644 .github/actions/setup/set-package-name/action.yml diff --git a/.github/actions/setup/set-package-name/action.yml b/.github/actions/setup/set-package-name/action.yml deleted file mode 100644 index f884570..0000000 --- a/.github/actions/setup/set-package-name/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -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 - echo "FRONTEND_PACKAGE_NAME=${REPO_NAME}-frontend" >> $GITHUB_ENV - shell: bash diff --git a/.github/actions/setup/setup-uv-python/action.yml b/.github/actions/setup/setup-uv-python/action.yml index 355e7f1..e72bbe4 100644 --- a/.github/actions/setup/setup-uv-python/action.yml +++ b/.github/actions/setup/setup-uv-python/action.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 135fc8b..e5fb4e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6455dca..f368253 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/docs/WORKFLOWS.md b/docs/WORKFLOWS.md index 951522f..fc133ca 100644 --- a/docs/WORKFLOWS.md +++ b/docs/WORKFLOWS.md @@ -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:** @@ -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 ``` @@ -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 ``` @@ -235,7 +218,6 @@ steps: Usage: ```yaml steps: - - uses: javidahmed64592/template-python/.github/actions/setup/set-package-name@main - uses: javidahmed64592/template-python/.github/actions/build/verify-structure@main ``` From 4e96bd18b994dd09c0d0cf32576f86084604b476 Mon Sep 17 00:00:00 2001 From: Javid Ahmed Date: Fri, 6 Mar 2026 21:18:44 +0000 Subject: [PATCH 3/4] Add new .here file to the repository --- .here | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .here diff --git a/.here b/.here new file mode 100644 index 0000000..e69de29 From 2fac4fa1a83b777b995c81b88a4a3f7df5295896 Mon Sep 17 00:00:00 2001 From: Javid Ahmed Date: Fri, 6 Mar 2026 21:59:30 +0000 Subject: [PATCH 4/4] Enhance verify-structure action to support optional directory and file checks --- .../actions/build/verify-structure/action.yml | 44 +++++++++++++++++++ docs/WORKFLOWS.md | 16 ++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/.github/actions/build/verify-structure/action.yml b/.github/actions/build/verify-structure/action.yml index 142df6f..31e509e 100644 --- a/.github/actions/build/verify-structure/action.yml +++ b/.github/actions/build/verify-structure/action.yml @@ -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: @@ -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 diff --git a/docs/WORKFLOWS.md b/docs/WORKFLOWS.md index fc133ca..0e55230 100644 --- a/docs/WORKFLOWS.md +++ b/docs/WORKFLOWS.md @@ -212,8 +212,9 @@ 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 @@ -221,6 +222,17 @@ steps: - 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.