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
7 changes: 5 additions & 2 deletions ci/build-package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ $ErrorActionPreference = "Stop"
. (Join-Path $PSScriptRoot 'packages.ps1')

# Builds the packages this publish releases, each at its own version from the
# release plan. $Version is common-ci's label for the run and is not used.
# release plan. When nothing is to be released, every package is built at its
# released version, so that the tests have packages to install and the nightly
# publish passes without publishing anything. $Version is common-ci's label for
# the run and is not used.

$plan = @(Get-ReleasePlan $RepoName)
$plan = @(Get-BuildPlan $RepoName)

# fiftyone_pipeline_did carries the OWID source inside itself, copied in by the
# pipeline product's script; see pipeline/ci/copy-owid-source.ps1.
Expand Down
30 changes: 30 additions & 0 deletions ci/packages.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,36 @@ Describe 'Get-ReleasePlan' {
}
}

Describe 'Get-BuildPlan' {
It 'is the release plan when a package is to be released' {
$script:Repo = New-Repo $script:AllFiles ($script:AllTags + 'ipi/4.5.0')
Add-Commit $script:Repo @('pipeline/engines/a.py')
$plan = @(Get-BuildPlan $script:Repo $script:Graph)
$plan.Name | Should -Be @('engines', 'dd', 'ipi')
($plan | Where-Object Name -eq 'engines').Version | Should -Be '4.5.39'
}

It 'builds every published package at its released version when nothing changed' {
$script:Repo = New-Repo $script:AllFiles ($script:AllTags + 'ipi/4.5.0')
Add-Commit $script:Repo @()
@(Get-ReleasePlan $script:Repo $script:Graph).Count | Should -Be 0
$plan = @(Get-BuildPlan $script:Repo $script:Graph)
$plan.Name | Should -Be @('core', 'did', 'engines', 'location', 'dd', 'ipi')
($plan | Where-Object Name -eq 'core').Version | Should -Be '4.5.38'
($plan | Where-Object Name -eq 'dd').Version | Should -Be '4.5.96'
($plan | Where-Object Name -eq 'location').Version | Should -Be '4.5.4'
($plan | Where-Object Name -eq 'ipi').Version | Should -Be '4.5.0'
}

It 'builds the released versions from a commit already released' {
$script:Repo = New-Repo $script:AllFiles ($script:AllTags + 'ipi/4.5.0')
Add-Commit $script:Repo @('device/dd/a.py')
git -C $script:Repo tag 'dd/4.5.97'
($plan = @(Get-BuildPlan $script:Repo $script:Graph)).Count | Should -Be 6
($plan | Where-Object Name -eq 'dd').Version | Should -Be '4.5.97'
}
}

Describe 'the real packages.json' {
BeforeAll {
$script:Real = Get-Packages (Split-Path $PSScriptRoot)
Expand Down
26 changes: 26 additions & 0 deletions ci/packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,29 @@ function Get-ReleasePlan([string]$RepoPath, $Packages = $null) {
}
}
}

# What a build of HEAD makes: the release plan, or, when nothing changed since
# the last release, every published package at its released version. Nothing
# is published then, because package-update-required.ps1 finds the release
# plan empty, but the publish's tests still have the packages to install.
function Get-BuildPlan([string]$RepoPath, $Packages = $null) {
if ($null -eq $Packages) {
$Packages = Get-Packages $RepoPath
}
$plan = @(Get-ReleasePlan $RepoPath $Packages)
if ($plan.Count -gt 0) {
return $plan
}
$published = @($Packages | Where-Object { $_.Publish -eq $true })
foreach ($name in (Sort-ByDependency $published @($published.Name))) {
$package = $published | Where-Object { $_.Name -eq $name }
$last = @(Get-ReleasedVersions $RepoPath $name)[-1]
[pscustomobject]@{
Name = $name
Path = $package.Path
Version = "$last"
Previous = $last
Reason = 'already released, built for the tests'
}
}
}
Loading