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
32 changes: 32 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,38 @@ stages:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Check code formatting (run 'dotnet fantomas src -r' to fix)

# Check whether package with current version has been published to nuget.org
# We will try to restore both FSharp.Core and FCS and if restore is _successful_, package version needs to be bumped.
# NOTE: This CI check should only run on the release branches.
- job: Check_Published_Package_Versions
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), or(startsWith(variables['System.PullRequest.SourceBranch'], 'release/dev'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/dev')))
pool:
vmImage: $(UbuntuMachineQueueName)
strategy:
maxParallel: 2
matrix:
FCS:
_project: "FSharp.Compiler.Service_notshipped.fsproj"
FSCore:
_project: "FSharp.Core_notshipped.fsproj"
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
useGlobalJson: true
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Agent.ToolsDirectory)/dotnet
- pwsh: ./check.ps1 -project $(_project)
workingDirectory: $(Build.SourcesDirectory)/buildtools/checkpackages
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Check published package version


#-------------------------------------------------------------------------------------------------------------------#
# PR builds #
#-------------------------------------------------------------------------------------------------------------------#
Expand Down
1 change: 1 addition & 0 deletions buildtools/checkpackages/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<Project>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@
<PackageReference Include="FSharp.Compiler.Service" Version="[$(FSharpCompilerServicePackageVersion)]" />
</ItemGroup>

<Target Name="WritePackageVersion" BeforeTargets="Restore">
<WriteLinesToFile
File="Version.txt"
Lines="FSharp.Compiler.Service=$(FSharpCompilerServicePackageVersion)"
Overwrite="true"
Encoding="Unicode"/>
</Target>

</Project>
8 changes: 8 additions & 0 deletions buildtools/checkpackages/FSharp.Core_notshipped.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@
<PackageReference Include="FSharp.Core" Version="[$(FSCorePackageVersionValue)]" />
</ItemGroup>

<Target Name="WritePackageVersion" BeforeTargets="Restore">
<WriteLinesToFile
File="Version.txt"
Lines="FSharp.Core=$(FSCorePackageVersionValue)"
Overwrite="true"
Encoding="Unicode"/>
</Target>

</Project>
17 changes: 17 additions & 0 deletions buildtools/checkpackages/check.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ENTRY POINT MAIN()
Param(
[Parameter(Mandatory=$True)]
[String] $project
)
& dotnet restore $project 2>$null

if ($LASTEXITCODE -eq 0)
{
$package = Get-Content -Path .\Version.txt
Write-Error "
Package restore succeded for '${package}', expected to fail.
This usually means that the package has been already published.
Please, bump the version to fix this failure." -ErrorAction Stop
} else {
exit 0
}