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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ matrix:
addons:
artifacts:
paths:
- $(ls powershell*{deb,pkg,AppImage} | tr "\n" ":")
- $(ls powershell*{deb,pkg,AppImage,gz} | tr "\n" ":")
- pester-tests.xml

install:
Expand Down
19 changes: 16 additions & 3 deletions docs/testing-guidelines/testing-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,25 @@ Additionally, the tag:

#### Requesting additional tests for a PR

In our CI systems, we normally run only run tests tagged with `CI`. If in the first line of the last (most recent) commit description you add `[Feature]`,
we will ensure that we will also run the tests tagged with `Feature`. When you would want to do this:
In our CI systems, we normally run only run tests tagged with `CI`.
If in the first line of the last (most recent) commit description you add `[Feature]`,
we will ensure that we will also run the tests tagged with `Feature`.
When you would want to do this:

- You have added or changed a `Feature` test.
- A maintainer asks you to run the `Feature` tests.
- Based on experience, you are confident that a maintainer will ask you to run the `Feature` tests.

#### Validating packaging changes for a PR

By default, our CI system does a build and run tests for a PR and does not exercise code to create a package.
If your PR includes changes to packaging, you can have the CI system exercise the packaging code by
using `[Package]` as the first line in the commit message.
When you would want to do this:

- You made change to PowerShell Core packaging
- A maintainer asks you to run as `[Package]`

### xUnit

For those tests which are not easily run via Pester, we have decided to use [xUnit](https://xunit.github.io/) as the test framework.
Expand All @@ -100,7 +112,8 @@ Two helper functions are part of the build.psm1 module to help with that:

Our CI system runs these as well; there should be no difference between running these on your dev system, versus in CI.

Make sure that the git submodules have been loaded into your project before running `Start-PSPester`, or it will fail to run. If you did not clone the project with the `--recursive` flag, you can load the submodules by running:
Make sure that the git submodules have been loaded into your project before running `Start-PSPester`, or it will fail to run.
If you did not clone the project with the `--recursive` flag, you can load the submodules by running:

```
git submodule update --init
Expand Down
15 changes: 10 additions & 5 deletions tools/travis.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ else

# Run a full build if the build was trigger via cron, api or the commit message contains `[Feature]`
$hasFeatureTag = $commitMessage -match '\[feature\]'
$hasPackageTag = $commitMessage -match '\[package\]'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line Start-PSBootstrap -Package:(-not $isPr) needs to be updated.
How about change to:

$hasPackageTag = $commitMessage -match '\[package\]'
$createPackages = -not $isPr -or $hasPackageTag
...
Start-PSBootstrap -Package:$createPackages
...
if ($createPackages) {
   ## create package 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update

$createPackages = -not $isPr -or $hasPackageTag
$hasRunFailingTestTag = $commitMessage -match '\[includeFailingTest\]'
$isDailyBuild = $env:TRAVIS_EVENT_TYPE -eq 'cron' -or $env:TRAVIS_EVENT_TYPE -eq 'api'
# only update the build badge for the cron job
Expand All @@ -165,7 +167,7 @@ if($Stage -eq 'Bootstrap')
Write-Host -Foreground Green "Executing travis.ps1 -BootStrap `$isPR='$isPr' - $commitMessage"
# Make sure we have all the tags
Sync-PSTags -AddRemoteIfMissing
Start-PSBootstrap -Package:(-not $isPr)
Start-PSBootstrap -Package:$createPackages
}
elseif($Stage -eq 'Build')
{
Expand Down Expand Up @@ -232,7 +234,7 @@ elseif($Stage -eq 'Build')
}
}

if (-not $isPr) {
if ($createPackages) {
$packageParams = @{}
if($env:TRAVIS_BUILD_NUMBER)
{
Expand All @@ -255,9 +257,12 @@ elseif($Stage -eq 'Build')
Start-NativeExecution -sb {dotnet nuget push $package --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}
}
# Create and package Raspbian .tgz
Start-PSBuild -Clean -Runtime linux-arm
Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
if ($IsLinux)
{
# Create and package Raspbian .tgz
Start-PSBuild -Clean -Runtime linux-arm
Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
}
}

# if the tests did not pass, throw the reason why
Expand Down