diff --git a/ci/README.md b/ci/README.md index bf6b2a62..b80c3659 100644 --- a/ci/README.md +++ b/ci/README.md @@ -12,9 +12,9 @@ repositories used to do for one package tree each. generated accessors. The other scripts loop over it rather than naming folders themselves. - The root `pom.xml` builds every tree in one reactor but is not their parent, - so [build-package.ps1](build-package.ps1) sets the version in each tree - before it deploys from the root. The examples are built and tested but left - out of the deploy. + so [build-package.ps1](build-package.ps1) has common-ci set the version in + each tree before it deploys from the root. The examples are built and tested + but left out of the deploy. - [build-project.ps1](build-project.ps1) and [run-unit-tests.ps1](run-unit-tests.ps1) use the `dev` profile, so a pull request tests the examples against the libraries it changes. The publish diff --git a/ci/build-package.ps1 b/ci/build-package.ps1 index 38de86fe..75464f09 100644 --- a/ci/build-package.ps1 +++ b/ci/build-package.ps1 @@ -21,19 +21,6 @@ foreach ($package in $NativePackages) { } } -# The root pom.xml is not the parent of the package trees, so setting the -# version at the root does not reach them. Set it in each tree, the examples -# included, so the whole repository carries the version being released. -foreach ($package in $Packages) { - Write-Host "Setting the version of '$($package.Path)' to '$Version'" - Push-Location "$RepoName/$($package.Path)" - try { - mvn versions:set @MavenOptions "-DnewVersion=$Version" -DgenerateBackupPoms=false - } finally { - Pop-Location - } -} - # The examples are never published. They are left out of the deploy so that # the last project in the reactor is one the publishing plugin is configured # for. Maven 3 does not exclude a folder's modules with the folder, so each of @@ -45,21 +32,18 @@ $examples = foreach ($package in $Packages | Where-Object { -not $_.Publish }) { ForEach-Object { '!' + [IO.Path]::GetRelativePath($repoPath, $_.DirectoryName).Replace('\', '/') } } -# The publishing plugin writes the one bundle for the whole reactor under the -# first tree that publishes. common-ci copies the bundle from where a single -# tree puts it, below target at the root, so a link at that path leads to the -# bundle. The link is made before the deploy, which Linux allows. -$firstPublishing = ($Packages | Where-Object { $_.Publish } | Select-Object -First 1).Path -New-Item -ItemType Directory -Force -Path "$RepoName/target" | Out-Null -New-Item -ItemType SymbolicLink -Force -Path "$RepoName/target/central-publishing" -Target "../$firstPublishing/target/central-publishing" | Out-Null - -# common-ci sets the version of the root pom.xml, deploys from the root to a -# local staging folder with signing, and copies the result and the publishing -# bundle into the package folder. +# common-ci sets the version, deploys from the root to a local staging folder +# with signing, and copies the result and the publishing bundle into the +# package folder. The root pom.xml is not the parent of the package trees, so +# setting the version at the root would not reach them. VersionPaths names each +# tree, the examples included, so the whole repository carries the version +# being released. The publishing plugin writes the one bundle for the whole +# reactor under the first tree that publishes, and common-ci finds it there. ./java/build-package.ps1 ` -RepoName $RepoName ` -Name $Name ` -Version $Version ` + -VersionPaths $Packages.Path ` -ExtraArgs "-DskipNativeBuild=true", "-pl", ($examples -join ',') ` -JavaGpgKeyPassphrase $Keys['JavaGpgKeyPassphrase'] ` -JavaPGP $Keys['JavaPGP'] ` diff --git a/ci/copy-test-results.ps1 b/ci/copy-test-results.ps1 index 712c1539..54334215 100644 --- a/ci/copy-test-results.ps1 +++ b/ci/copy-test-results.ps1 @@ -1,8 +1,9 @@ # Copies the Surefire reports of every module below Path into Destination. # -# common-ci's Java scripts only look one folder down for modules, which finds -# the modules of a single package tree but not those of this repository, where -# each tree is a folder of its own and the examples are a folder further down. +# common-ci's Java scripts copy the reports of the one Maven run they make. The +# integration and performance tests here make several runs, each in a tree of +# its own and each reporting into the same folder, so those two scripts copy +# the reports themselves. The unit tests are one run, which common-ci makes. param ( [Parameter(Mandatory)][string]$Path, [Parameter(Mandatory)][string]$Destination, diff --git a/ci/run-unit-tests.ps1 b/ci/run-unit-tests.ps1 index 562f2948..a5475533 100644 --- a/ci/run-unit-tests.ps1 +++ b/ci/run-unit-tests.ps1 @@ -4,39 +4,21 @@ param( [string]$TestResourceKey, [string]$DeviceDetection ) -$PSNativeCommandUseErrorActionPreference = $false - -. "$PSScriptRoot/packages.ps1" +$ErrorActionPreference = "Stop" # One run of every test in the reactor that build-project.ps1 built, the -# examples included. SuperResourceKey is read by the Location and Device -# Detection examples tests, and LicenseKey by the Device Detection data file -# update example. The IP Intelligence update example's test is ignored, so it -# does not need a key of its own. -Write-Host "Entering '$RepoName'" -Push-Location $RepoName -try { - Write-Host "Testing '$Name'" - mvn surefire:test @MavenOptions -Pdev -DfailIfNoTests=false ` - "-DTestResourceKey=$TestResourceKey" ` - "-DSuperResourceKey=$TestResourceKey" ` - "-DLicenseKey=$DeviceDetection" - # Kept here because the commands below run commands of their own, which - # would replace Maven's exit code. - $MavenExitCode = $LASTEXITCODE -} finally { - Write-Host "Leaving '$RepoName'" - Pop-Location -} - -& "$PSScriptRoot/copy-test-results.ps1" -Path $RepoName -Destination "$RepoName/test-results/unit" -Exclude '*ExampleTests*' - -# A forked JVM that dies leaves why it died only on the runner, so common-ci -# logs it. The collector is only in branches of common-ci that have it, so it -# is called only when present. It does not change the outcome. -$Collector = [IO.Path]::Combine($pwd, "java", "collect-jvm-crash-evidence.ps1") -if ($MavenExitCode -ne 0 -and (Test-Path $Collector) -eq $true) { - & $Collector -RepoName $RepoName -} +# examples included. common-ci runs Surefire from the root, copies the reports +# of every module at any depth into test-results/unit, leaving out the example +# tests the integration tests report, and logs why a forked JVM died when one +# does. The dev profile points the examples at the reactor. SuperResourceKey is +# read by the Location and Device Detection examples tests, and LicenseKey by +# the Device Detection data file update example. The IP Intelligence update +# example's test is ignored, so it does not need a key of its own. +./java/run-unit-tests.ps1 -RepoName $RepoName -Name $Name -ExtraArgs @( + '-Pdev' + "-DTestResourceKey=$TestResourceKey" + "-DSuperResourceKey=$TestResourceKey" + "-DLicenseKey=$DeviceDetection" +) -exit $MavenExitCode +exit $LASTEXITCODE