Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
Add Azure DevOps Server (on-premises) compatibility#111
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:CI | |
permissions: | |
contents:write | |
concurrency: | |
group:${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress:true | |
on: | |
push: | |
branches:[main] | |
pull_request: | |
branches:[main] | |
jobs: | |
build-and-test: | |
runs-on:ubuntu-latest | |
timeout-minutes:20 | |
steps: | |
-uses:actions/checkout@v4 | |
with: | |
fetch-depth:0 | |
-name:Use Node.js 20 | |
uses:actions/setup-node@v4 | |
with: | |
node-version:'20.x' | |
-name:Install dependencies | |
run:npm ci | |
-name:Check format | |
run:npm run check-format | |
continue-on-error:true | |
-name:Lint | |
run:npm run lint | |
continue-on-error:true | |
# Webview assets are committed under media/webview; no separate build step required. | |
-name:Build | |
run:npm run build | |
-name:Run selective tests for changed files (PRs) | |
if:github.event_name == 'pull_request' | |
run:npm run test:changed | |
-name:Run full tests (push to main) | |
if:github.event_name == 'push' | |
run:npm test | |
-name:Coverage check | |
if:github.event_name == 'push' | |
run:npm run coverage:ci | |
continue-on-error:true | |
release-check: | |
runs-on:ubuntu-latest | |
if:github.ref == 'refs/heads/main' | |
steps: | |
-uses:actions/checkout@v4 | |
with: | |
fetch-depth:0 | |
-name:Use Node.js 20 | |
uses:actions/setup-node@v4 | |
with: | |
node-version:'20.x' | |
-name:Install dependencies | |
run:npm ci | |
-name:Run release-check | |
run:npm run release-check | |
integration-tests: | |
runs-on:ubuntu-latest | |
needs:build-and-test | |
if:github.ref == 'refs/heads/main' | |
continue-on-error:true | |
steps: | |
-uses:actions/checkout@v4 | |
-name:Use Node.js 20 | |
uses:actions/setup-node@v4 | |
with: | |
node-version:'20.x' | |
-name:Install system dependencies for headless testing | |
run:| | |
sudo apt-get update | |
sudo apt-get install -y xvfb | |
-name:Restore VS Code test cache | |
uses:actions/cache@v4 | |
with: | |
path:.vscode-test | |
key:vscode-test-${{ runner.os }}-1.78.0 | |
-name:Install dependencies | |
run:npm ci | |
-name:Run integration tests with virtual display | |
run:xvfb-run -a npm run pretest && xvfb-run -a npm run test:integration | |
version-bump-and-tag: | |
name:Bump version and tag (main) | |
runs-on:ubuntu-latest | |
needs:build-and-test | |
if:github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
-uses:actions/checkout@v4 | |
with: | |
fetch-depth:0 | |
-name:Use Node.js 20 | |
uses:actions/setup-node@v4 | |
with: | |
node-version:'20.x' | |
-name:Configure git user | |
run:| | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
-name:Fetch tags | |
run:git fetch --tags --force | |
-name:Install dependencies | |
run:npm ci | |
-name:Determine bump type and update changelog | |
env: | |
GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }} | |
run:| | |
# Skip if this is already a release commit | |
if git log -1 --pretty=%s | grep -qE '^chore\(release\):'; then | |
echo "Release commit detected, skipping bump." | |
exit 0 | |
fi | |
last_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
range="" | |
if [ -n "$last_tag" ]; then | |
range="$last_tag..HEAD" | |
fi | |
subjects=$(git log --format=%s $range) | |
bodies=$(git log --format=%B $range) | |
bump="patch" | |
# Major if breaking change markers present ("!" in type or BREAKING CHANGE in body) | |
if echo "$subjects" | grep -Ei '^[a-z]+(\(.+\))?!:' >/dev/null || echo "$bodies" | grep -Ei 'BREAKING CHANGE' >/dev/null; then | |
bump="major" | |
elif echo "$subjects" | grep -Ei '^feat(\(.+\))?: ' >/dev/null; then | |
bump="minor" | |
else | |
bump="patch" | |
fi | |
echo "Bump type: $bump" | |
# Get the new version that will be created | |
current_version=$(node -p "require('./package.json').version") | |
new_version=$(npm version "$bump" --no-git-tag-version) | |
new_version=${new_version#v} # Remove 'v' prefix | |
# Update changelog with new version | |
node scripts/update-changelog.js "$new_version" | |
# Add changelog to git | |
git add CHANGELOG.md package.json package-lock.json | |
# Create commit and tag | |
git commit -m "chore(release): $new_version" | |
git tag "v$new_version" | |
# Push commit and tags with retry logic and verification | |
for i in {1..3}; do | |
echo "Attempt $i: Pushing commit and tags..." | |
if git push --follow-tags; then | |
echo "✅ Push successful on attempt $i" | |
break | |
else | |
echo "❌ Push failed on attempt $i" | |
if [ $i -eq 3 ]; then | |
echo "ERROR: Failed to push after 3 attempts" | |
exit 1 | |
fi | |
echo "Retrying in 5 seconds..." | |
sleep 5 | |
fi | |
done | |
# Verify tag was pushed successfully | |
echo "Verifying tag was pushed to remote..." | |
sleep 10 # Allow time for propagation | |
if git ls-remote --tags origin | grep -q "refs/tags/v$new_version"; then | |
echo "✅ Tag v$new_version verified on remote" | |
else | |
echo "❌ ERROR: Tag v$new_version not found on remote after push" | |
exit 1 | |
fi | |
# Notify on tag failure | |
-name:Notify on tag failure | |
if:failure() | |
uses:actions/github-script@v7 | |
with: | |
script:| | |
github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: 'Release tag creation failed', | |
body: `The automated release process failed to create/push a tag. Manual intervention required. | |
**Failed workflow:** ${context.workflow} | |
**Run ID:** ${context.runId} | |
**Commit:** ${context.sha} | |
Please check the workflow logs and manually create the missing tag if needed. | |
See: ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | |
labels: ['bug', 'release', 'automation'] | |
}) |