chore: update version to 0.31.1 #1276
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Node PR Lint, Build and Test | |
| permissions: | |
| contents: read | |
| on: | |
| # Trigger when manually run | |
| workflow_dispatch: | |
| # Trigger on pushes to `main` or `rel/*` | |
| push: | |
| branches: | |
| - main | |
| - rel/* | |
| # Trigger on pull requests to `main` or `rel/*` | |
| pull_request: | |
| branches: | |
| - main | |
| - rel/* | |
| - dev/** | |
| jobs: | |
| Build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: '.' | |
| steps: | |
| # Setup | |
| - uses: actions/checkout@v4 | |
| - name: π¦ Using Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| - name: βοΈ Validate Version / Preview Alignment | |
| shell: pwsh | |
| run: | | |
| $packageJson = Get-Content "package.json" -Raw | ConvertFrom-Json | |
| $version = $packageJson.version | |
| $preview = [bool]$packageJson.preview | |
| Write-Output "π¦ Package version: $version" | |
| Write-Output "π·οΈ Preview flag: $preview" | |
| # Validate semantic versioning format | |
| if ($version -notmatch '^(\d+)\.(\d+)\.(\d+)$') { | |
| Write-Error "β Invalid semantic version format: $version" | |
| exit 1 | |
| } | |
| $minor = [int]$Matches[2] | |
| $minorEven = ($minor % 2) -eq 0 | |
| # Check version/preview alignment | |
| # Convention: odd minor versions = preview, even minor versions = stable | |
| if ($preview -and $minorEven) { | |
| Write-Warning "β οΈ Version/preview misalignment: preview=$preview but minor version $minor is even (should be odd for preview)" | |
| Write-Warning "Convention: Odd minor versions (e.g., 1.1.x, 1.3.x) should be preview, even (e.g., 1.0.x, 1.2.x) should be stable" | |
| } elseif (-not $preview -and -not $minorEven) { | |
| Write-Warning "β οΈ Version/preview misalignment: preview=$preview but minor version $minor is odd (should be even for stable)" | |
| Write-Warning "Convention: Odd minor versions (e.g., 1.1.x, 1.3.x) should be preview, even (e.g., 1.0.x, 1.2.x) should be stable" | |
| } else { | |
| Write-Output "β Version/preview alignment is correct" | |
| } | |
| - name: β¬οΈ Install Dependencies | |
| run: npm ci | |
| - name: π Localize | |
| run: npm run l10n:check | |
| - name: π Lint | |
| run: npm run lint | |
| - name: β¨ Prettier | |
| run: npm run prettier | |
| - name: π¨ Compile | |
| run: npm run build | |
| - name: π¦ Package | |
| run: npm run package | |
| - name: π Verify VSIX File | |
| shell: pwsh | |
| run: | | |
| # Find VSIX file | |
| $vsixFiles = Get-ChildItem -Path . -Filter *.vsix -File | |
| if ($vsixFiles.Count -eq 0) { | |
| Write-Error "β No VSIX file found" | |
| exit 1 | |
| } elseif ($vsixFiles.Count -gt 1) { | |
| Write-Error "β Multiple VSIX files found: $($vsixFiles.Name -join ', ')" | |
| exit 1 | |
| } | |
| $vsixFile = $vsixFiles[0] | |
| $vsixFileName = $vsixFile.Name | |
| $vsixFileSize = [math]::Round($vsixFile.Length / 1MB, 2) | |
| Write-Output "β Found VSIX: $vsixFileName (${vsixFileSize} MB)" | |
| # Verify filename matches expected pattern | |
| $packageJson = Get-Content "package.json" -Raw | ConvertFrom-Json | |
| $expectedName = "$($packageJson.name)-$($packageJson.version).vsix" | |
| if ($vsixFileName -ne $expectedName) { | |
| Write-Error "β VSIX filename mismatch: expected '$expectedName', got '$vsixFileName'" | |
| exit 1 | |
| } | |
| Write-Output "β VSIX filename is correct: $vsixFileName" | |
| # Set output for job summary | |
| echo "VSIX_FILE=$vsixFileName" >> $env:GITHUB_ENV | |
| echo "VSIX_SIZE=$vsixFileSize" >> $env:GITHUB_ENV | |
| echo "PACKAGE_VERSION=$($packageJson.version)" >> $env:GITHUB_ENV | |
| echo "PACKAGE_PREVIEW=$($packageJson.preview)" >> $env:GITHUB_ENV | |
| - name: π€ Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Artifacts | |
| path: | | |
| **/*.vsix | |
| **/*.tgz | |
| !**/node_modules | |
| - name: π§ͺ Unit Tests | |
| id: unit-tests | |
| continue-on-error: true | |
| run: npm run jesttest | |
| - name: π§ͺ Integration Tests | |
| id: integration-tests | |
| continue-on-error: true | |
| run: xvfb-run -a npm test | |
| - name: π Generate Job Summary | |
| if: always() | |
| shell: pwsh | |
| run: | | |
| # Only generate summary if VSIX verification completed | |
| if ($env:PACKAGE_VERSION) { | |
| # Determine test results | |
| $unitTestResult = "${{ steps.unit-tests.outcome }}" | |
| $integrationTestResult = "${{ steps.integration-tests.outcome }}" | |
| $unitTestIcon = if ($unitTestResult -eq "success") { "β " } else { "β" } | |
| $integrationTestIcon = if ($integrationTestResult -eq "success") { "β " } else { "β" } | |
| $overallStatus = if ($unitTestResult -eq "success" -and $integrationTestResult -eq "success") { | |
| "## β Build Status`nAll checks completed successfully!" | |
| } else { | |
| "## β Build Status`nSome checks failed. Please review the logs." | |
| } | |
| $summary = @" | |
| # π Build Summary | |
| ## π¦ Package Information | |
| - **Version:** $env:PACKAGE_VERSION | |
| - **Preview:** $env:PACKAGE_PREVIEW | |
| - **VSIX File:** $env:VSIX_FILE | |
| - **VSIX Size:** $env:VSIX_SIZE MB | |
| ## π§ͺ Test Results | |
| - **Unit Tests:** $unitTestIcon $unitTestResult | |
| - **Integration Tests:** $integrationTestIcon $integrationTestResult | |
| $overallStatus | |
| "@ | |
| $summary | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 | |
| # Fail the job if any tests failed | |
| if ($unitTestResult -ne "success" -or $integrationTestResult -ne "success") { | |
| exit 1 | |
| } | |
| } else { | |
| Write-Output "β οΈ Skipping job summary - VSIX verification did not complete" | |
| } |