Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .azure/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ variables:
value: 'true'
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 'true'
- name: INPUT_VERSIONSPEC
value: '7.0.0-alpha.actions.1'
- name: INPUT_INCLUDEPRERELEASE
value: 'true'
- name: INPUT_IGNOREFAILEDSOURCES
value: 'true'
- name: INPUT_PREFERLATESTVERSION
value: 'false'
- name: INPUT_NUGETCONFIGPATH
value: '$(Build.SourcesDirectory)/.test/gitversion.nuget.config'
value: '$(Build.SourcesDirectory)/nuget.config'

jobs:
- job: build
Expand All @@ -33,6 +31,8 @@ jobs:
matrix:
'ubuntu-26.04':
imageName: 'ubuntu-26.04'
'macos-26':
imageName: 'macos-26'
'windows-2025-vs2026':
imageName: 'windows-2025-vs2026'

Expand All @@ -54,11 +54,11 @@ jobs:
- task: UseDotNet@2
inputs:
packageType: sdk
version: '11.0.100-rc.3.26522.148'
includePreviewVersions: true
version: '11.0.x'
- pwsh: |
node scripts/prepare-gitversion.mjs
displayName: Prepare pinned GitVersion 7 source packages
$version = (Get-Content package.json -Raw | ConvertFrom-Json).config.gitversionVersion
Write-Host "##vso[task.setvariable variable=GITVERSION_TEST_VERSION]$version"
displayName: Select GitVersion test version
- pwsh: |
npm install --ignore-scripts
displayName: 'Install dependencies'
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
$env:INPUT_INCLUDEPRERELEASE = "$(INPUT_INCLUDEPRERELEASE)"
$env:INPUT_IGNOREFAILEDSOURCES = "$(INPUT_IGNOREFAILEDSOURCES)"
$env:INPUT_PREFERLATESTVERSION = "$(INPUT_PREFERLATESTVERSION)"
$env:INPUT_NUGETCONFIGPATH = "$(GITVERSION_TEST_NUGET_CONFIG)"
$env:INPUT_NUGETCONFIGPATH = "$(INPUT_NUGETCONFIGPATH)"

# run the 'gitversion/setup' action
node gitversion/setup/main.mjs
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/checkout-path.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,26 @@ jobs:
with:
dotnet-version: |
10.0.x
11.0.100-rc.3.26522.148
11.0.x

- name: Build the checked-out actions and prepare v7 packages
- name: Build the checked-out actions
working-directory: gv-repo
run: |
npm ci --ignore-scripts
npm run build
node scripts/prepare-gitversion.mjs

- name: Select GitVersion test version
working-directory: gv-repo
run: |
$version = (Get-Content package.json -Raw | ConvertFrom-Json).config.gitversionVersion
"GITVERSION_TEST_VERSION=$version" >> $env:GITHUB_ENV

- name: Install GitVersion
uses: ./gv-repo/gitversion/setup
with:
versionSpec: '${{ env.GITVERSION_TEST_VERSION }}'
includePrerelease: true
nugetConfigPath: '${{ env.GITVERSION_TEST_NUGET_CONFIG }}'
nugetConfigPath: '${{ github.workspace }}/gv-repo/nuget.config'

- name: Determine version
id: gitversion
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
workflow_dispatch:
inputs:
gitversion-version:
description: 'Exact published v7 package to validate (blank uses the manifest baseline)'
description: 'Exact published v7 package to validate (blank uses the package.json baseline)'
required: false
default: ''

Expand Down Expand Up @@ -52,15 +52,19 @@ jobs:
with:
node-version: '24.x'

- name: Install .NET SDKs for the pinned GitVersion rehearsal
- name: Install .NET SDKs
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: |
10.0.x
11.0.100-rc.3.26522.148
11.0.x

- name: Prepare GitVersion 7 test package settings
run: node scripts/prepare-gitversion.mjs
- name: Select GitVersion test version
run: |
if (!$env:GITVERSION_TEST_VERSION) {
$version = (Get-Content package.json -Raw | ConvertFrom-Json).config.gitversionVersion
"GITVERSION_TEST_VERSION=$version" >> $env:GITHUB_ENV
}

- run: |
npm ci --ignore-scripts
Expand Down Expand Up @@ -92,7 +96,7 @@ jobs:
with:
versionSpec: '${{ env.GITVERSION_TEST_VERSION }}'
includePrerelease: true
nugetConfigPath: '${{ env.GITVERSION_TEST_NUGET_CONFIG }}'
nugetConfigPath: '${{ github.workspace }}/nuget.config'

- name: gitversion/command (showvariable)
uses: ./gitversion/command
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gitversion-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
labels: dependencies
title: "Update GitVersion version to ${{ github.event.client_payload.newTag }}"
body: |
Updates the published-package validation baseline in `scripts/gitversion-test.json`
Updates the published-package validation baseline in `package.json` (`config.gitversionVersion`)
following publication of GitVersion `${{ github.event.client_payload.newTag }}`.

Triggered by the `gitversion-release-published` repository dispatch.
29 changes: 10 additions & 19 deletions docs/migration-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,12 @@ scheduled for removal in GitVersion 7.1. V5 uses v7 behavior directly.

Install the .NET 10 SDK before setup. V5 requests the tool's `net10.0` target,
including when a newer SDK is installed, so a cached tool does not unexpectedly
require a .NET 11 runtime. Execution retains major runtime roll-forward. The
pinned source rehearsal currently also needs its exact .NET 11 preview SDK to
build upstream; that is a test-build prerequisite, not a requirement imposed on
all v5 consumers.

GitVersion 7 packages tools per RID. Windows and Linux x64/ARM64, Linux musl
variants, and Apple Silicon macOS are upstream targets. Intel macOS users should
remain on Actions v4 and GitVersion 6. CI currently exercises Windows x64, Linux
x64/ARM64 and Apple Silicon macOS; Windows ARM64 and musl remain release checks.
Tool caches are separated by OS/process architecture and Linux libc family. Incomplete installations
are not reused. Installation happens at the final cache path because RID tool
require a .NET 11 runtime. Execution retains major runtime roll-forward.

GitVersion 7 provides RID-specific tool packages for Windows and Linux x64/ARM64,
Linux musl variants, and Intel/Apple Silicon macOS. Tool caches are separated by
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
OS/process architecture and Linux libc family. Incomplete installations are not
reused. Installation happens at the final cache path because RID tool
launchers can depend on that location.

Keep Git on PATH for shallow-clone checks, normalization, dynamic repositories
Expand Down Expand Up @@ -139,19 +134,15 @@ steps:
## Validation and release order

The default test baseline installs the exact published GitVersion 7 beta selected
by `publishedVersion` in `scripts/gitversion-test.json`. Run `npm run test:ci` to
by `config.gitversionVersion` in `package.json`. Run `npm run test:ci` to
validate it. CI tests the built GitHub entrypoints and the Azure adapter; Azure CI
also packages and executes the local VSIX without publishing it.

Set `GITVERSION_TEST_MODE=source` to build RID-specific packages from the immutable
upstream commit retained in that manifest, using its required SDKs. This optional
source rehearsal is not published-package validation.

Use the CI workflow's `gitversion-version` input to validate an exact published
v7 prerelease or stable version. Locally set `GITVERSION_TEST_VERSION` before
`npm run test:ci` to override the manifest baseline. Published-package validation
uses NuGet rather than the local source package feed. Passing the beta validates
that exact beta; repeat against the final RC and exact stable package before
`npm run test:ci` to override the package baseline. Published-package validation
uses NuGet. Passing the beta validates that exact beta; repeat against the final
RC and exact stable package before
declaring stable-release compatibility.

The release notification workflow accepts stable GitVersion 7 updates only. It
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@
"run:local:gitreleasemanager": "node dist/tools/cli.mjs --tool gitreleasemanager --agent local",
"run:azure:gitreleasemanager": "node dist/tools/cli.mjs --tool gitreleasemanager --agent azure",
"run:github:gitreleasemanager": "node dist/tools/cli.mjs --tool gitreleasemanager --agent github",
"test:ci": "node scripts/prepare-gitversion.mjs && vitest --run src/__tests__ --config src/__tests__/vitest.config.ts",
"test:tools": "node scripts/prepare-gitversion.mjs && vitest --run src/__tests__/tools --config src/__tests__/vitest.config.ts",
"test:ci": "vitest --run src/__tests__ --config src/__tests__/vitest.config.ts",
"test:tools": "vitest --run src/__tests__/tools --config src/__tests__/vitest.config.ts",
"test:agents": "vitest --run src/__tests__/agents --config src/__tests__/vitest.config.ts",
"publish:prepare": "./dist/azure/updateTasks.mjs",
"publish:azure:local": "tfx extension create --root ./dist/azure --manifest-js dist/azure/manifest.config.cjs",
"publish:azure:marketplace": "tfx extension publish --root ./dist/azure --manifest-js dist/azure/manifest.config.cjs --auth-type pat",
"prepare": "husky",
"prepare:gitversion": "node scripts/prepare-gitversion.mjs"
"prepare": "husky"
},
"config": {
"gitversionVersion": "7.0.0-beta.2"
},
"devDependencies": {
"@eslint/js": "10.0.1",
Expand Down
7 changes: 0 additions & 7 deletions scripts/gitversion-test.json

This file was deleted.

69 changes: 0 additions & 69 deletions scripts/prepare-gitversion.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/update-gitversion-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { readFileSync, writeFileSync } from 'node:fs'
const version = (process.env.GITVERSION_RELEASE_TAG || '').replace(/^v/, '')
if (version.trim() !== version || !/^7\.\d+\.\d+$/.test(version)) throw new Error('Only stable GitVersion 7 notifications belong on the Actions v5 line')
const manifest = new URL('./gitversion-test.json', import.meta.url)
const manifest = new URL('../package.json', import.meta.url)
const baseline = JSON.parse(readFileSync(manifest, 'utf8'))
baseline.publishedVersion = version
baseline.config.gitversionVersion = version
writeFileSync(manifest, `${JSON.stringify(baseline, null, 2)}\n`)
console.log(`GitVersion published-package validation baseline: ${version}`)
8 changes: 5 additions & 3 deletions src/__tests__/tools/gitversion/compatibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { pathToFileURL } from 'node:url'
import { simpleGit } from 'simple-git'
import { BuildAgent } from '@agents/local'
import { Runner } from '@tools/gitversion'
import baseline from '../../../../scripts/gitversion-test.json'
import { selectTestVersion } from './test-version'

describe('installed GitVersion 7 compatibility', () => {
Expand Down Expand Up @@ -38,10 +37,10 @@ describe('installed GitVersion 7 compatibility', () => {
const agent = new BuildAgent()
vi.spyOn(agent, 'tempDir', 'get').mockReturnValue(path.join(root, 'temp'))
vi.spyOn(agent, 'cacheDir', 'get').mockReturnValue(path.join(root, 'cache'))
const version = selectTestVersion(baseline)
const version = selectTestVersion()
vi.stubEnv('INPUT_VERSIONSPEC', version)
vi.stubEnv('INPUT_INCLUDEPRERELEASE', 'true')
vi.stubEnv('INPUT_NUGETCONFIGPATH', path.resolve('.test/gitversion.nuget.config'))
vi.stubEnv('INPUT_NUGETCONFIGPATH', path.resolve('nuget.config'))
vi.stubEnv('INPUT_PREFERLATESTVERSION', 'true')
vi.stubEnv('GITVERSION_PATH', '')
runner = new Runner(agent)
Expand All @@ -63,6 +62,9 @@ describe('installed GitVersion 7 compatibility', () => {
for (const name of [
'GIT_BRANCH',
'Git_Branch',
// Fixture repositories must not inherit the enclosing CI checkout's branch.
'GITHUB_REF',
'BUILD_SOURCEBRANCH',
'GITVERSION_CONFIGURATION_VERSION',
'GITVERSION_ARGUMENT_PARSER_VERSION',
'GITVERSION_USE_V6_ARGUMENT_PARSER',
Expand Down
11 changes: 6 additions & 5 deletions src/__tests__/tools/gitversion/release-baseline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ let script: string
let manifest: string
beforeEach(async () => {
root = await fs.mkdtemp(path.join(os.tmpdir(), 'gittools-release-'))
script = path.join(root, 'update-gitversion-version.mjs')
manifest = path.join(root, 'gitversion-test.json')
script = path.join(root, 'scripts', 'update-gitversion-version.mjs')
await fs.mkdir(path.join(root, 'scripts'))
manifest = path.join(root, 'package.json')
await fs.copyFile(path.resolve('scripts/update-gitversion-version.mjs'), script)
await fs.writeFile(manifest, JSON.stringify({ commit: 'pinned-source', version: '7.0.0-alpha.actions.1', publishedVersion: null }))
await fs.writeFile(manifest, JSON.stringify({ name: 'test-package', version: '5.0.0-alpha.0', config: { gitversionVersion: '7.0.0-beta.2' } }))
})
afterEach(async () => {
await fs.rm(root, { recursive: true, force: true })
})

it('selects a stable v7 package without changing the pinned source rehearsal', async () => {
it('selects a stable v7 package without changing the Actions package version', async () => {
execFileSync(process.execPath, [script], { env: { ...process.env, GITVERSION_RELEASE_TAG: '7.0.1' }, stdio: 'pipe' })
expect(JSON.parse(await fs.readFile(manifest, 'utf8'))).toEqual({ commit: 'pinned-source', version: '7.0.0-alpha.actions.1', publishedVersion: '7.0.1' })
expect(JSON.parse(await fs.readFile(manifest, 'utf8'))).toEqual({ name: 'test-package', version: '5.0.0-alpha.0', config: { gitversionVersion: '7.0.1' } })
})

it.each([
Expand Down
5 changes: 2 additions & 3 deletions src/__tests__/tools/gitversion/runner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { simpleGit } from 'simple-git'

import { type IBuildAgent } from '@agents/common'
import { Runner } from '@tools/gitversion'
import baseline from '../../../../scripts/gitversion-test.json'
import { selectTestVersion } from './test-version'
import { BuildAgent as AzurePipelinesAgent } from '@agents/azure'
import { BuildAgent as LocalBuildAgent } from '@agents/local'
Expand All @@ -17,7 +16,7 @@ describe('GitVersion Runner', () => {

const toolPathVariable = 'GITVERSION_PATH'
const toolName = 'dotnet-gitversion'
const versionSpec = selectTestVersion(baseline)
const versionSpec = selectTestVersion()

function testOnAgent(agent: IBuildAgent): void {
let version: string
Expand Down Expand Up @@ -50,7 +49,7 @@ describe('GitVersion Runner', () => {
setInputs({
versionSpec: versionSpec,
includePrerelease: true,
nugetConfigPath: process.env.GITVERSION_TEST_NUGET_CONFIG || path.resolve(baseDir, 'gitversion.nuget.config'),
nugetConfigPath: path.resolve('nuget.config'),
ignoreFailedSources: false,
preferLatestVersion: true
})
Expand Down
Loading
Loading