-
Notifications
You must be signed in to change notification settings - Fork 356
fix(upgrade): extend rename+retry workaround to Windows #27271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+275
−72
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
15b172e
Initial plan
Copilot d2ff26e
fix: extend rename+retry workaround to Windows for self-upgrade
Copilot 332839a
fix(upgrade): address review comments on Windows rename+retry workaround
Copilot 66245e0
fix(upgrade): render Windows manual-upgrade commands as plain indente…
Copilot 80b9c8c
feat(ci): add cross-platform upgrade integration test
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| name: Extension Upgrade Test | ||
|
|
||
| on: | ||
| workflow_dispatch: {} | ||
| pull_request: | ||
| paths: | ||
| - 'pkg/cli/update_extension_check.go' | ||
| - '.github/workflows/upgrade-test.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| upgrade-path-test: | ||
| name: Extension upgrade on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Find two most recent stable releases | ||
| id: releases | ||
| shell: bash | ||
| run: | | ||
| # Use /releases/latest to get n (mirrors getLatestRelease() logic: non-prerelease only). | ||
| LATEST=$(gh api repos/github/gh-aw/releases/latest --jq '.tag_name') | ||
|
|
||
| # Get the second most recent non-draft, non-prerelease release (n-1). | ||
| # per_page=50 is ample headroom given this project's release cadence. | ||
| PREVIOUS=$(gh api "repos/github/gh-aw/releases?per_page=50" \ | ||
| --jq '[.[] | select(.prerelease == false and .draft == false)][1].tag_name') | ||
|
|
||
| if [ -z "$LATEST" ] || [ -z "$PREVIOUS" ] || [ "$LATEST" = "null" ] || [ "$PREVIOUS" = "null" ]; then | ||
| echo "❌ Could not find two stable releases (latest=$LATEST, previous=$PREVIOUS)" | ||
| exit 1 | ||
| fi | ||
| if [ "$LATEST" = "$PREVIOUS" ]; then | ||
| echo "❌ Only one stable release found; cannot test upgrade path" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "latest=$LATEST" >> "$GITHUB_OUTPUT" | ||
| echo "previous=$PREVIOUS" >> "$GITHUB_OUTPUT" | ||
| echo "Latest stable: $LATEST" | ||
| echo "Previous stable: $PREVIOUS" | ||
|
|
||
| - name: Install previous version (n-1) | ||
| shell: bash | ||
| env: | ||
| PREVIOUS: ${{ steps.releases.outputs.previous }} | ||
| run: | | ||
| echo "Installing gh-aw $PREVIOUS ..." | ||
| gh extension install github/gh-aw --pin "$PREVIOUS" --force | ||
|
|
||
| # Extract version string (stable releases always have the simple vX.Y.Z form). | ||
| INSTALLED=$(gh aw version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1) | ||
| echo "Installed: $INSTALLED" | ||
| [ "$INSTALLED" = "$PREVIOUS" ] || { echo "❌ Expected $PREVIOUS, got $INSTALLED"; exit 1; } | ||
| echo "✅ n-1 installed: $INSTALLED" | ||
|
|
||
| - name: Run gh aw upgrade (exercises the self-upgrade code path) | ||
| shell: bash | ||
| env: | ||
| LATEST: ${{ steps.releases.outputs.latest }} | ||
| run: | | ||
| # gh aw upgrade calls upgradeExtensionIfOutdated which: | ||
| # 1. Detects current ($PREVIOUS) < latest ($LATEST) | ||
| # 2. Runs `gh extension upgrade github/gh-aw` | ||
| # 3. On Windows: binary is in use → rename+retry workaround is triggered | ||
| # 4. Re-launches the freshly installed binary with --skip-extension-upgrade | ||
| # --no-fix keeps the test focused: skips codemods, action updates, and compilation. | ||
| gh aw upgrade --no-fix | ||
|
|
||
| - name: Verify version after upgrade | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot file an issue if failed |
||
| shell: bash | ||
| env: | ||
| LATEST: ${{ steps.releases.outputs.latest }} | ||
| run: | | ||
| INSTALLED=$(gh aw version 2>&1 | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1) | ||
| echo "Installed: $INSTALLED" | ||
| echo "Expected: $LATEST" | ||
| [ "$INSTALLED" = "$LATEST" ] || { echo "❌ Version mismatch: got $INSTALLED, expected $LATEST"; exit 1; } | ||
| echo "✅ Upgrade succeeded: $INSTALLED" | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot run on release created