From e7b1beec9c876aeeac087b5f4face70591b68dc3 Mon Sep 17 00:00:00 2001 From: Krishna Sharma Date: Thu, 26 Mar 2026 09:37:55 +0530 Subject: [PATCH 1/6] Action to create distribution artifact --- .../create-framework-artifact/action.yml | 9 +++ .../create-framework-artifact/copy-files.ps1 | 57 +++++++++++++++++++ .../create-distribution-artifact.yml | 22 +++++++ 3 files changed, 88 insertions(+) create mode 100644 .github/actions/create-framework-artifact/action.yml create mode 100644 .github/actions/create-framework-artifact/copy-files.ps1 create mode 100644 .github/workflows/create-distribution-artifact.yml diff --git a/.github/actions/create-framework-artifact/action.yml b/.github/actions/create-framework-artifact/action.yml new file mode 100644 index 0000000..4304424 --- /dev/null +++ b/.github/actions/create-framework-artifact/action.yml @@ -0,0 +1,9 @@ +name: 'Create Framework Artifact' +description: 'Prepares Actor Framework files in the correct directory structure for distribution' +runs: + using: 'composite' + steps: + - name: Prepare artifact structure + shell: pwsh + run: | + & "${{ github.action_path }}/copy-files.ps1" \ No newline at end of file diff --git a/.github/actions/create-framework-artifact/copy-files.ps1 b/.github/actions/create-framework-artifact/copy-files.ps1 new file mode 100644 index 0000000..802e217 --- /dev/null +++ b/.github/actions/create-framework-artifact/copy-files.ps1 @@ -0,0 +1,57 @@ +# Create artifact staging directory +$stagingDir = "artifact-staging" +New-Item -ItemType Directory -Force -Path $stagingDir +New-Item -ItemType Directory -Force -Path "$stagingDir\vi.lib\ActorFramework" +New-Item -ItemType Directory -Force -Path "$stagingDir\resource\AFDebug" +New-Item -ItemType Directory -Force -Path "$stagingDir\resource\Framework\Providers" +New-Item -ItemType Directory -Force -Path "$stagingDir\menus" + +# Define exclusion patterns +$excludeExtensions = @('*.lvproj', '*.vipb', '*.aliases', '*.lvlps') + +# Helper function to copy files with exclusions +function Copy-WithExclusions { + param($SourcePath, $DestPath, $Label) + + Write-Host "Copying $Label" + Get-ChildItem -Path $SourcePath -Recurse -File | ForEach-Object { + $excluded = $false + foreach ($pattern in $excludeExtensions) { + if ($_.Name -like $pattern) { + Write-Warning "Excluding file: $($_.FullName)" + $excluded = $true + break + } + } + + if (-not $excluded) { + $relativePath = $_.FullName.Substring((Resolve-Path $SourcePath).Path.Length + 1) + $destFilePath = Join-Path $DestPath $relativePath + $destDir = Split-Path -Parent $destFilePath + + if (-not (Test-Path $destDir)) { + New-Item -ItemType Directory -Force -Path $destDir | Out-Null + } + + Copy-Item -Path $_.FullName -Destination $destFilePath -Force + Write-Host "Copied: $relativePath" + } + } +} + +# Copy Core\ActorFramework\ to vi.lib\ActorFramework\ +Copy-WithExclusions -SourcePath "Core\ActorFramework" -DestPath "$stagingDir\vi.lib\ActorFramework" -Label "Core\ActorFramework\ to vi.lib\ActorFramework\" + +# Copy Core\AFDebug\ to resource\AFDebug\ +Write-Host "`n" +Copy-WithExclusions -SourcePath "Core\AFDebug" -DestPath "$stagingDir\resource\AFDebug" -Label "Core\AFDebug\ to resource\AFDebug\" + +# Copy Core\Menus\ to menus\ +Write-Host "`n" +Copy-WithExclusions -SourcePath "Core\Menus" -DestPath "$stagingDir\menus" -Label "Core\Menus\ to menus\" + +# Copy Providers\ to resource\Framework\Providers\ +Write-Host "`n" +Copy-WithExclusions -SourcePath "Providers" -DestPath "$stagingDir\resource\Framework\Providers" -Label "Providers\ to resource\Framework\Providers\" + +Write-Host "`nArtifact preparation complete" \ No newline at end of file diff --git a/.github/workflows/create-distribution-artifact.yml b/.github/workflows/create-distribution-artifact.yml new file mode 100644 index 0000000..e1ea0ca --- /dev/null +++ b/.github/workflows/create-distribution-artifact.yml @@ -0,0 +1,22 @@ +name: Create Distribution Artifact + +on: + workflow_dispatch: + +jobs: + create-artifact: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Create framework artifact structure + uses: ./.github/actions/create-framework-artifact + + - name: Upload artifact + uses: actions/upload-artifact@v6 + with: + name: actor-framework-distribution + path: artifact-staging/ + retention-days: 7 \ No newline at end of file From 0ae01ae3f2ace66946ed62eff329f6240d883337 Mon Sep 17 00:00:00 2001 From: Krishna Sharma Date: Thu, 26 Mar 2026 10:25:29 +0530 Subject: [PATCH 2/6] Added a release workflow --- .github/workflows/release-actor-framework.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/release-actor-framework.yml diff --git a/.github/workflows/release-actor-framework.yml b/.github/workflows/release-actor-framework.yml new file mode 100644 index 0000000..fb37f2b --- /dev/null +++ b/.github/workflows/release-actor-framework.yml @@ -0,0 +1,28 @@ +name: Create Release + +on: + push: + tags: + - 'v*.*.*.*' + +jobs: + create-release: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Create framework artifact structure + uses: ./.github/actions/create-framework-artifact + + - name: Create ZIP archive + shell: pwsh + run: | + Compress-Archive -Path artifact-staging\* -DestinationPath actor-framework-distribution.zip + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: actor-framework-distribution.zip + generate_release_notes: true \ No newline at end of file From 5b741ceb86273dfaf575246d6abeb728db45b309 Mon Sep 17 00:00:00 2001 From: Krishna Sharma Date: Thu, 26 Mar 2026 15:36:36 +0530 Subject: [PATCH 3/6] Added exclusions to release workflow --- .../create-framework-artifact/action.yml | 7 ++++- .../create-framework-artifact/copy-files.ps1 | 31 +++++++++++++++++++ .../create-distribution-artifact.yml | 3 ++ .github/workflows/release-actor-framework.yml | 5 ++- 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-framework-artifact/action.yml b/.github/actions/create-framework-artifact/action.yml index 4304424..4882c50 100644 --- a/.github/actions/create-framework-artifact/action.yml +++ b/.github/actions/create-framework-artifact/action.yml @@ -1,9 +1,14 @@ name: 'Create Framework Artifact' description: 'Prepares Actor Framework files in the correct directory structure for distribution' +inputs: + exclude-paths: + description: 'Paths to exclude (one per line, relative to repo root)' + required: false + default: '' runs: using: 'composite' steps: - name: Prepare artifact structure shell: pwsh run: | - & "${{ github.action_path }}/copy-files.ps1" \ No newline at end of file + & "${{ github.action_path }}/copy-files.ps1" -ExcludePaths "${{ inputs.exclude-paths }}" \ No newline at end of file diff --git a/.github/actions/create-framework-artifact/copy-files.ps1 b/.github/actions/create-framework-artifact/copy-files.ps1 index 802e217..51a8e2b 100644 --- a/.github/actions/create-framework-artifact/copy-files.ps1 +++ b/.github/actions/create-framework-artifact/copy-files.ps1 @@ -1,3 +1,7 @@ +param( + [string]$ExcludePaths = '' +) + # Create artifact staging directory $stagingDir = "artifact-staging" New-Item -ItemType Directory -Force -Path $stagingDir @@ -9,6 +13,25 @@ New-Item -ItemType Directory -Force -Path "$stagingDir\menus" # Define exclusion patterns $excludeExtensions = @('*.lvproj', '*.vipb', '*.aliases', '*.lvlps') +# Parse additional path exclusions +$excludePathsList = @() +if ($ExcludePaths) { + $excludePathsList = $ExcludePaths -split "`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' } +} + +# Helper function to check if path should be excluded +function Test-PathExcluded { + param($FilePath) + + foreach ($excludePath in $excludePathsList) { + $normalizedExclude = $excludePath -replace '/', '\' + if ($FilePath -like "*$normalizedExclude*") { + return $true + } + } + return $false +} + # Helper function to copy files with exclusions function Copy-WithExclusions { param($SourcePath, $DestPath, $Label) @@ -16,6 +39,8 @@ function Copy-WithExclusions { Write-Host "Copying $Label" Get-ChildItem -Path $SourcePath -Recurse -File | ForEach-Object { $excluded = $false + + # Check file extension exclusions foreach ($pattern in $excludeExtensions) { if ($_.Name -like $pattern) { Write-Warning "Excluding file: $($_.FullName)" @@ -24,6 +49,12 @@ function Copy-WithExclusions { } } + # Check path exclusions + if (-not $excluded -and (Test-PathExcluded -FilePath $_.FullName)) { + Write-Warning "Excluding path: $($_.FullName)" + $excluded = $true + } + if (-not $excluded) { $relativePath = $_.FullName.Substring((Resolve-Path $SourcePath).Path.Length + 1) $destFilePath = Join-Path $DestPath $relativePath diff --git a/.github/workflows/create-distribution-artifact.yml b/.github/workflows/create-distribution-artifact.yml index e1ea0ca..efa025f 100644 --- a/.github/workflows/create-distribution-artifact.yml +++ b/.github/workflows/create-distribution-artifact.yml @@ -13,6 +13,9 @@ jobs: - name: Create framework artifact structure uses: ./.github/actions/create-framework-artifact + with: + exclude-paths: | + Providers\Install Support - name: Upload artifact uses: actions/upload-artifact@v6 diff --git a/.github/workflows/release-actor-framework.yml b/.github/workflows/release-actor-framework.yml index fb37f2b..54bd764 100644 --- a/.github/workflows/release-actor-framework.yml +++ b/.github/workflows/release-actor-framework.yml @@ -3,7 +3,7 @@ name: Create Release on: push: tags: - - 'v*.*.*.*' + - 'v*.*.*' jobs: create-release: @@ -15,6 +15,9 @@ jobs: - name: Create framework artifact structure uses: ./.github/actions/create-framework-artifact + with: + exclude-files: | + Providers\Install Support - name: Create ZIP archive shell: pwsh From 2b2bad6f3e34d8aa8bde2b9f9b298476b4d17d22 Mon Sep 17 00:00:00 2001 From: Krishna Sharma Date: Thu, 26 Mar 2026 15:42:45 +0530 Subject: [PATCH 4/6] Updated release workflow --- .github/workflows/release-actor-framework.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-actor-framework.yml b/.github/workflows/release-actor-framework.yml index 54bd764..88d2db9 100644 --- a/.github/workflows/release-actor-framework.yml +++ b/.github/workflows/release-actor-framework.yml @@ -16,7 +16,7 @@ jobs: - name: Create framework artifact structure uses: ./.github/actions/create-framework-artifact with: - exclude-files: | + exclude-paths: | Providers\Install Support - name: Create ZIP archive From 54002b8bf3e3f94ad361c0b8f4567acab7e39327 Mon Sep 17 00:00:00 2001 From: Krishna Sharma Date: Fri, 27 Mar 2026 14:40:54 +0530 Subject: [PATCH 5/6] Refactored artifact creation and release workflows --- .../create-framework-artifact/action.yml | 14 -- .../create-distribution-artifact.yml | 21 ++- ...elease-actor-framework.yml => release.yml} | 19 ++- .../Workflows/releases-and-artifacts.md | 143 ++++++++++++++++++ .../scripts/Create_Distribution_Artifact.ps1 | 0 5 files changed, 171 insertions(+), 26 deletions(-) delete mode 100644 .github/actions/create-framework-artifact/action.yml rename .github/workflows/{release-actor-framework.yml => release.yml} (56%) create mode 100644 Documentation/Workflows/releases-and-artifacts.md rename .github/actions/create-framework-artifact/copy-files.ps1 => pipeline/scripts/Create_Distribution_Artifact.ps1 (100%) diff --git a/.github/actions/create-framework-artifact/action.yml b/.github/actions/create-framework-artifact/action.yml deleted file mode 100644 index 4882c50..0000000 --- a/.github/actions/create-framework-artifact/action.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'Create Framework Artifact' -description: 'Prepares Actor Framework files in the correct directory structure for distribution' -inputs: - exclude-paths: - description: 'Paths to exclude (one per line, relative to repo root)' - required: false - default: '' -runs: - using: 'composite' - steps: - - name: Prepare artifact structure - shell: pwsh - run: | - & "${{ github.action_path }}/copy-files.ps1" -ExcludePaths "${{ inputs.exclude-paths }}" \ No newline at end of file diff --git a/.github/workflows/create-distribution-artifact.yml b/.github/workflows/create-distribution-artifact.yml index efa025f..8bb39d3 100644 --- a/.github/workflows/create-distribution-artifact.yml +++ b/.github/workflows/create-distribution-artifact.yml @@ -2,6 +2,19 @@ name: Create Distribution Artifact on: workflow_dispatch: + inputs: + upload-artifact: + description: 'Upload as GitHub artifact' + required: false + type: boolean + default: true + workflow_call: + inputs: + upload-artifact: + description: 'Upload as GitHub artifact' + required: false + type: boolean + default: false jobs: create-artifact: @@ -12,12 +25,12 @@ jobs: uses: actions/checkout@v5 - name: Create framework artifact structure - uses: ./.github/actions/create-framework-artifact - with: - exclude-paths: | - Providers\Install Support + shell: pwsh + run: | + & "${{ github.workspace }}\pipeline\scripts\Create_Distribution_Artifact.ps1" -ExcludePaths "Providers\Install Support" - name: Upload artifact + if: ${{ inputs.upload-artifact }} uses: actions/upload-artifact@v6 with: name: actor-framework-distribution diff --git a/.github/workflows/release-actor-framework.yml b/.github/workflows/release.yml similarity index 56% rename from .github/workflows/release-actor-framework.yml rename to .github/workflows/release.yml index 88d2db9..66ce201 100644 --- a/.github/workflows/release-actor-framework.yml +++ b/.github/workflows/release.yml @@ -6,20 +6,23 @@ on: - 'v*.*.*' jobs: + create-artifact: + uses: ./.github/workflows/create-distribution-artifact.yml + with: + upload-artifact: true + create-release: + needs: create-artifact runs-on: windows-latest steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Create framework artifact structure - uses: ./.github/actions/create-framework-artifact + - name: Download artifact + uses: actions/download-artifact@v7 with: - exclude-paths: | - Providers\Install Support + name: actor-framework-distribution + path: artifact-staging - - name: Create ZIP archive + - name: Create actor-framework-distribution.zip shell: pwsh run: | Compress-Archive -Path artifact-staging\* -DestinationPath actor-framework-distribution.zip diff --git a/Documentation/Workflows/releases-and-artifacts.md b/Documentation/Workflows/releases-and-artifacts.md new file mode 100644 index 0000000..68d489a --- /dev/null +++ b/Documentation/Workflows/releases-and-artifacts.md @@ -0,0 +1,143 @@ +# Actor Framework Release Workflows + +This document contains information used to create the release artifacts using GitHub Actions workflows for the Actor Framework repository. + +## Workflows + +### 1. Create Distribution Artifact (`create-distribution-artifact.yml`) + +Creates a structured artifact containing Actor Framework files organized in the correct directory layout for LabVIEW installation. The workflow yml can be found [here](/.github/workflows/create-distribution-artifact.yml). + +**Triggers:** +- Manual dispatch via GitHub Actions UI +- Reusable workflow (called by other workflows) + +**Artifact Structure:** +``` +/ +├── vi.lib/ +│ └── ActorFramework/ # From Core/ActorFramework/ +├── resource/ +│ ├── AFDebug/ # From Core/AFDebug/ +│ └── Framework/ +│ └── Providers/ # From Providers/ +└── menus/ # From Core/Menus/ +``` + +**Excluded Files:** +- `*.lvproj` - LabVIEW project files +- `*.vipb` - VI Package Builder files +- `*.aliases` - LabVIEW aliases files +- `*.lvlps` - LabVIEW project settings +- `Providers\Install Support\` - Installation support files + +**Manual Usage:** +1. Go to Actions tab in GitHub +2. Select "Create Distribution Artifact" workflow +3. Click "Run workflow" +4. Download the `actor-framework-distribution` artifact + +**Reusable Workflow Inputs:** +- `upload-artifact` (boolean, default: false) - Whether to upload as GitHub artifact + +### 2. Create Release (`release.yml`) + +Automatically creates a GitHub release with the distribution artifact when a version tag is pushed. The workflow yml can be found [here](/.github/workflows/release.yml). + +**Triggers:** +- Push of tags matching pattern `v*.*.*` (e.g., `v2.0.0`, `v1.0.1`, `v.2.0.0.5`, `v1.0.0.0-rc`) + +**Process:** +1. Calls `create-distribution-artifact.yml` workflow +2. Downloads the created artifact +3. Compresses it into `actor-framework-distribution.zip` +4. Creates a GitHub release with: + - The ZIP file as release asset + - Auto-generated release notes + +**Usage:** +```bash +# Create and push a version tag +git tag v2.0.0.18 +git push origin v2.0.0.18 + +# The workflow runs automatically and creates the release +``` + +**Release Assets:** +- `actor-framework-distribution.zip` - Contains the complete framework in proper directory structure + +## Scripts + +### `pipeline/scripts/Create_Distribution_Artifact.ps1` + +PowerShell script that handles the actual file copying and artifact structure creation. + +**Parameters:** +- `ExcludePaths` (string) - Newline-separated list of paths to exclude (relative to repo root) + +**Example:** +```powershell +.\pipeline\scripts\Create_Distribution_Artifact.ps1 -ExcludePaths "Providers\Install Support" +``` + +**Logic:** +1. Creates staging directory structure +2. Copies files from source directories +3. Excludes files based on: + - File extensions (*.lvproj, *.vipb, *.aliases, *.lvlps) + - Specific paths (configurable via parameter) +4. Maintains relative directory structure within each target location + +## Development Guidelines + +### Adding New Exclusions + +To exclude additional files or directories: + +1. **For specific paths:** Update the workflow YAML files to pass additional exclusions: + ```yaml + run: | + & "${{ github.workspace }}\pipeline\scripts\Create_Distribution_Artifact.ps1" -ExcludePaths "Providers\Install Support`nCore\Examples" + ``` + +2. **For file patterns:** Edit `Create_Distribution_Artifact.ps1` and add to `$excludeExtensions`: + ```powershell + $excludeExtensions = @('*.lvproj', '*.vipb', '*.aliases', '*.lvlps', '*.your-extension') + ``` + +### Adding New Source Directories + +To include additional directories in the artifact: + +1. Update `Create_Distribution_Artifact.ps1`: + ```powershell + # Add new directory creation + New-Item -ItemType Directory -Force -Path "$stagingDir\your\target\path" + + # Add copy operation + Copy-WithExclusions -SourcePath "Source\Path" -DestPath "$stagingDir\your\target\path" -Label "Description" + ``` + +## Troubleshooting + +### Artifact is missing files +- Check workflow logs for exclusion warnings +- Verify source directories exist and contain expected files +- Ensure file extensions aren't in the exclusion list + +### Release workflow not triggering +- Verify tag matches pattern `v*.*.*` +- Check that tag was pushed to remote: `git push origin ` +- Review Actions tab for any errors + +### Path issues on Windows +- The script normalizes paths (`/` → `\`) +- Use backslashes in YAML: `Providers\Install Support` +- Paths are relative to repository root + +## Related Documentation + +- [GitHub Actions Documentation](https://docs.github.com/en/actions) +- [Reusable Workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows) +- [Creating Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) \ No newline at end of file diff --git a/.github/actions/create-framework-artifact/copy-files.ps1 b/pipeline/scripts/Create_Distribution_Artifact.ps1 similarity index 100% rename from .github/actions/create-framework-artifact/copy-files.ps1 rename to pipeline/scripts/Create_Distribution_Artifact.ps1 From 9452e548c8cdce587ec41320f5d987178b3332c5 Mon Sep 17 00:00:00 2001 From: Krishna Sharma Date: Fri, 27 Mar 2026 17:23:16 +0530 Subject: [PATCH 6/6] Read exclusion list from external file --- .../create-distribution-artifact.yml | 2 +- .../Workflows/releases-and-artifacts.md | 144 ++++++++++++++---- pipeline/config/artifact-exclusions.txt | 9 ++ .../scripts/Create_Distribution_Artifact.ps1 | 15 +- 4 files changed, 136 insertions(+), 34 deletions(-) create mode 100644 pipeline/config/artifact-exclusions.txt diff --git a/.github/workflows/create-distribution-artifact.yml b/.github/workflows/create-distribution-artifact.yml index 8bb39d3..35486ae 100644 --- a/.github/workflows/create-distribution-artifact.yml +++ b/.github/workflows/create-distribution-artifact.yml @@ -27,7 +27,7 @@ jobs: - name: Create framework artifact structure shell: pwsh run: | - & "${{ github.workspace }}\pipeline\scripts\Create_Distribution_Artifact.ps1" -ExcludePaths "Providers\Install Support" + & "${{ github.workspace }}\pipeline\scripts\Create_Distribution_Artifact.ps1" - name: Upload artifact if: ${{ inputs.upload-artifact }} diff --git a/Documentation/Workflows/releases-and-artifacts.md b/Documentation/Workflows/releases-and-artifacts.md index 68d489a..7f9578c 100644 --- a/Documentation/Workflows/releases-and-artifacts.md +++ b/Documentation/Workflows/releases-and-artifacts.md @@ -29,7 +29,7 @@ Creates a structured artifact containing Actor Framework files organized in the - `*.vipb` - VI Package Builder files - `*.aliases` - LabVIEW aliases files - `*.lvlps` - LabVIEW project settings -- `Providers\Install Support\` - Installation support files +- Paths listed in [`pipeline/config/artifact-exclusions.txt`](../../pipeline/config/artifact-exclusions.txt) **Manual Usage:** 1. Go to Actions tab in GitHub @@ -45,7 +45,7 @@ Creates a structured artifact containing Actor Framework files organized in the Automatically creates a GitHub release with the distribution artifact when a version tag is pushed. The workflow yml can be found [here](/.github/workflows/release.yml). **Triggers:** -- Push of tags matching pattern `v*.*.*` (e.g., `v2.0.0`, `v1.0.1`, `v.2.0.0.5`, `v1.0.0.0-rc`) +- Push of tags matching pattern `v*.*.*` (e.g., `v2.0.0`, `v1.0.1`, `v2.0.0.5`, `v1.0.0.0-rc`) **Process:** 1. Calls `create-distribution-artifact.yml` workflow @@ -67,56 +67,127 @@ git push origin v2.0.0.18 **Release Assets:** - `actor-framework-distribution.zip` - Contains the complete framework in proper directory structure +## Configuration Files + +### `pipeline/config/artifact-exclusions.txt` + +Text file containing paths to exclude from the distribution artifact. See the file [here](../../pipeline/config/artifact-exclusions.txt). + +**Format:** +- One path per line (relative to repository root) +- Lines starting with `#` are comments +- Empty lines are ignored +- Use backslashes for Windows paths: `Providers\Install Support` + +**Example:** +```text +# Installation support files +Providers\Install Support + +# Example exclusions (commented out) +# Examples\TestData +# Core\DeprecatedFeatures +``` + +**To add new exclusions:** +1. Edit `pipeline/config/artifact-exclusions.txt` +2. Add the path on a new line +3. Commit and push changes +4. Next workflow run will use updated exclusions + ## Scripts ### `pipeline/scripts/Create_Distribution_Artifact.ps1` -PowerShell script that handles the actual file copying and artifact structure creation. +PowerShell script that handles the actual file copying and artifact structure creation. See the script [here](../../pipeline/scripts/Create_Distribution_Artifact.ps1). **Parameters:** -- `ExcludePaths` (string) - Newline-separated list of paths to exclude (relative to repo root) +- `ExclusionFile` (string, optional) - Path to file containing exclusion patterns + - Default: `$PSScriptRoot\..\config\artifact-exclusions.txt` **Example:** ```powershell -.\pipeline\scripts\Create_Distribution_Artifact.ps1 -ExcludePaths "Providers\Install Support" +# Use default exclusion file +.\pipeline\scripts\Create_Distribution_Artifact.ps1 + +# Use custom exclusion file +.\pipeline\scripts\Create_Distribution_Artifact.ps1 -ExclusionFile "path\to\custom-exclusions.txt" ``` **Logic:** -1. Creates staging directory structure -2. Copies files from source directories -3. Excludes files based on: - - File extensions (*.lvproj, *.vipb, *.aliases, *.lvlps) - - Specific paths (configurable via parameter) -4. Maintains relative directory structure within each target location +1. Reads exclusion paths from configuration file +2. Creates staging directory structure +3. Copies files from source directories +4. Excludes files based on: + - File extensions: `*.lvproj`, `*.vipb`, `*.aliases`, `*.lvlps` + - Paths listed in exclusion file +5. Maintains relative directory structure within each target location +6. Logs all excluded files and paths for troubleshooting ## Development Guidelines ### Adding New Exclusions -To exclude additional files or directories: +**Recommended Method:** Edit the exclusion configuration file -1. **For specific paths:** Update the workflow YAML files to pass additional exclusions: - ```yaml - run: | - & "${{ github.workspace }}\pipeline\scripts\Create_Distribution_Artifact.ps1" -ExcludePaths "Providers\Install Support`nCore\Examples" +1. Open `pipeline/config/artifact-exclusions.txt` +2. Add new paths (one per line): + ```text + # Your comment explaining why + Path\To\Exclude ``` +3. Commit and push changes -2. **For file patterns:** Edit `Create_Distribution_Artifact.ps1` and add to `$excludeExtensions`: - ```powershell - $excludeExtensions = @('*.lvproj', '*.vipb', '*.aliases', '*.lvlps', '*.your-extension') - ``` +**Alternative Method:** Override in workflow (not recommended for permanent exclusions) + +```yaml +- name: Create framework artifact structure + shell: pwsh + run: | + & "${{ github.workspace }}\pipeline\scripts\Create_Distribution_Artifact.ps1" -ExclusionFile "custom-exclusions.txt" +``` + +### Adding New File Extension Exclusions + +Edit `Create_Distribution_Artifact.ps1` and add to `$excludeExtensions`: + +```powershell +$excludeExtensions = @('*.lvproj', '*.vipb', '*.aliases', '*.lvlps', '*.your-extension') +``` ### Adding New Source Directories -To include additional directories in the artifact: +Update `Create_Distribution_Artifact.ps1`: + +```powershell +# Add new directory creation +New-Item -ItemType Directory -Force -Path "$stagingDir\your\target\path" + +# Add copy operation +Copy-WithExclusions -SourcePath "Source\Path" -DestPath "$stagingDir\your\target\path" -Label "Description" +``` -1. Update `Create_Distribution_Artifact.ps1`: +### Testing Changes + +Before pushing changes: + +1. **Test locally:** ```powershell - # Add new directory creation - New-Item -ItemType Directory -Force -Path "$stagingDir\your\target\path" - - # Add copy operation - Copy-WithExclusions -SourcePath "Source\Path" -DestPath "$stagingDir\your\target\path" -Label "Description" + cd c:\dev\actor-framework + .\pipeline\scripts\Create_Distribution_Artifact.ps1 + # Inspect artifact-staging/ directory + ``` + +2. **Test via workflow:** + - Go to Actions → "Create Distribution Artifact" + - Click "Run workflow" + - Download and verify artifact contents + +3. **Test release workflow (use test tag):** + ```bash + git tag v0.0.0-test + git push origin v0.0.0-test + # Delete after testing: git push --delete origin v0.0.0-test ``` ## Troubleshooting @@ -124,17 +195,32 @@ To include additional directories in the artifact: ### Artifact is missing files - Check workflow logs for exclusion warnings - Verify source directories exist and contain expected files -- Ensure file extensions aren't in the exclusion list +- Review `pipeline/config/artifact-exclusions.txt` for unintended exclusions +- Ensure file extensions aren't in the `$excludeExtensions` list + +### Exclusions not working +- Verify exclusion file path is correct +- Check for typos in paths (case-sensitive on some systems) +- Ensure paths use backslashes: `Providers\Install Support` +- Review workflow logs for "Loaded X exclusion path(s)" message ### Release workflow not triggering - Verify tag matches pattern `v*.*.*` - Check that tag was pushed to remote: `git push origin ` - Review Actions tab for any errors +- Ensure you have permissions to create releases ### Path issues on Windows - The script normalizes paths (`/` → `\`) -- Use backslashes in YAML: `Providers\Install Support` +- Use backslashes in exclusion file: `Providers\Install Support` - Paths are relative to repository root +- Wildcards are supported in path matching + +### Script fails to find exclusion file +- Default location: `pipeline\config\artifact-exclusions.txt` +- Verify file exists and is committed to repository +- Check file is not excluded by `.gitignore` +- Use `-ExclusionFile` parameter to specify custom path ## Related Documentation diff --git a/pipeline/config/artifact-exclusions.txt b/pipeline/config/artifact-exclusions.txt new file mode 100644 index 0000000..5e580a1 --- /dev/null +++ b/pipeline/config/artifact-exclusions.txt @@ -0,0 +1,9 @@ +# Artifact Exclusion List +# One path per line, relative to repository root +# Lines starting with # are comments + +# Installation support files +Providers\Install Support + +# Add future exclusions here +# Examples\TestData \ No newline at end of file diff --git a/pipeline/scripts/Create_Distribution_Artifact.ps1 b/pipeline/scripts/Create_Distribution_Artifact.ps1 index 51a8e2b..401e5f5 100644 --- a/pipeline/scripts/Create_Distribution_Artifact.ps1 +++ b/pipeline/scripts/Create_Distribution_Artifact.ps1 @@ -1,5 +1,5 @@ param( - [string]$ExcludePaths = '' + [string]$ExclusionFile = "$PSScriptRoot\..\config\artifact-exclusions.txt" ) # Create artifact staging directory @@ -13,10 +13,17 @@ New-Item -ItemType Directory -Force -Path "$stagingDir\menus" # Define exclusion patterns $excludeExtensions = @('*.lvproj', '*.vipb', '*.aliases', '*.lvlps') -# Parse additional path exclusions +# Parse path exclusions from file $excludePathsList = @() -if ($ExcludePaths) { - $excludePathsList = $ExcludePaths -split "`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' } +if (Test-Path $ExclusionFile) { + Write-Host "Reading exclusions from: $ExclusionFile" + $excludePathsList = Get-Content $ExclusionFile | + Where-Object { $_ -notmatch '^\s*#' -and $_ -notmatch '^\s*$' } | + ForEach-Object { $_.Trim() } + + Write-Host "Loaded $($excludePathsList.Count) exclusion path(s)" +} else { + Write-Warning "Exclusion file not found: $ExclusionFile" } # Helper function to check if path should be excluded