-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new line before the content of each script file (fixes #126)
Merge pull request #127 from johlju/f/issue-126
- Loading branch information
Showing
21 changed files
with
341 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ignore Modules (because we output there now) | ||
/Modules/* | ||
# These aren't part of the module (yet) | ||
/PotentialContribution/* | ||
/Content/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Ignore version number folders and "output" where we build | ||
# All of these folders are (or were) build outputs | ||
[0-9]*/ | ||
obj/ | ||
Modules/ | ||
Output/ | ||
obj/ | ||
Tools/ | ||
coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<# | ||
.SYNOPSIS | ||
./project.build.ps1 | ||
.EXAMPLE | ||
Invoke-Build | ||
.NOTES | ||
0.5.0 - Parameterize | ||
Add parameters to this script to control the build | ||
#> | ||
[CmdletBinding()] | ||
param( | ||
# dotnet build configuration parameter (Debug or Release) | ||
[ValidateSet('Debug', 'Release')] | ||
[string]$Configuration = 'Release', | ||
|
||
# Add the clean task before the default build | ||
[switch]$Clean, | ||
|
||
# Collect code coverage when tests are run | ||
[switch]$CollectCoverage, | ||
|
||
# Which projects to build | ||
[Alias("Projects")] | ||
$dotnetProjects = @(), | ||
|
||
# Which projects are test projects | ||
[Alias("TestProjects")] | ||
$dotnetTestProjects = @(), | ||
|
||
# Further options to pass to dotnet | ||
[Alias("Options")] | ||
$dotnetOptions = @{ | ||
"-verbosity" = "minimal" | ||
# "-runtime" = "linux-x64" | ||
} | ||
) | ||
$InformationPreference = "Continue" | ||
$ErrorView = 'DetailedView' | ||
|
||
# The name of the module to publish | ||
$script:PSModuleName = "TerminalBlocks" | ||
# Use Env because Earthly can override it | ||
$Env:OUTPUT_ROOT ??= Join-Path $BuildRoot Modules | ||
|
||
$Tasks = "Tasks", "../Tasks", "../../Tasks" | Convert-Path -ErrorAction Ignore | Select-Object -First 1 | ||
Write-Information "$($PSStyle.Foreground.BrightCyan)Found shared tasks in $Tasks" -Tag "InvokeBuild" | ||
## Self-contained build script - can be invoked directly or via Invoke-Build | ||
if ($MyInvocation.ScriptName -notlike '*Invoke-Build.ps1') { | ||
& "$Tasks/_Bootstrap.ps1" | ||
|
||
Invoke-Build -File $MyInvocation.MyCommand.Path @PSBoundParameters -Result Result | ||
|
||
if ($Result.Error) { | ||
$Error[-1].ScriptStackTrace | Out-String | ||
exit 1 | ||
} | ||
exit 0 | ||
} | ||
|
||
## The first task defined is the default task. Put the right values for your project type here... | ||
if ($dotnetProjects -and $Clean) { | ||
Add-BuildTask CleanBuild Clean, ($Task ?? "Test") | ||
} elseif ($Clean) { | ||
Add-BuildTask CleanBuild Clean, ($Task ?? "Test") | ||
} | ||
|
||
## Initialize the build variables, and import shared tasks, including DotNet tasks | ||
. "$Tasks/_Initialize.ps1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
VERSION 0.7 | ||
IMPORT github.com/poshcode/tasks | ||
FROM mcr.microsoft.com/dotnet/sdk:7.0 | ||
WORKDIR /work | ||
|
||
ARG --global EARTHLY_GIT_ORIGIN_URL | ||
ARG --global EARTHLY_BUILD_SHA | ||
ARG --global EARTHLY_GIT_BRANCH | ||
# These are my common paths, used in my shared /Tasks repo | ||
ARG --global OUTPUT_ROOT=/Modules | ||
ARG --global TEST_ROOT=/Tests | ||
ARG --global TEMP_ROOT=/temp | ||
# These are my common build args, used in my shared /Tasks repo | ||
ARG --global MODULE_NAME=ModuleBuilder | ||
ARG --global CONFIGURATION=Release | ||
|
||
|
||
worker: | ||
# Dotnet tools and scripts installed by PSGet | ||
ENV PATH=$HOME/.dotnet/tools:$HOME/.local/share/powershell/Scripts:$PATH | ||
RUN mkdir /Tasks \ | ||
&& git config --global user.email "[email protected]" \ | ||
&& git config --global user.name "Earthly Build" | ||
# I'm using Invoke-Build tasks from this other repo which rarely changes | ||
COPY tasks+tasks/* /Tasks | ||
# Dealing with dependencies first allows docker to cache packages for us | ||
# So the dependency cach only re-builds when you add a new dependency | ||
COPY RequiredModules.psd1 . | ||
# COPY *.csproj . | ||
RUN ["pwsh", "-File", "/Tasks/_Bootstrap.ps1", "-RequiredModulesPath", "RequiredModules.psd1"] | ||
|
||
build: | ||
FROM +worker | ||
RUN mkdir $OUTPUT_ROOT $TEST_ROOT $TEMP_ROOT | ||
COPY . . | ||
# make sure you have bin and obj in .earthlyignore, as their content from context might cause problems | ||
RUN ["pwsh", "-Command", "Invoke-Build", "-Task", "Build", "-File", "Build.build.ps1"] | ||
|
||
# SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>] | ||
SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME | ||
|
||
test: | ||
# If we run a target as a reference in FROM or COPY, it's outputs will not be produced | ||
BUILD +build | ||
FROM +build | ||
# make sure you have bin and obj in .earthlyignore, as their content from context might cause problems | ||
RUN ["pwsh", "-Command", "Invoke-Build", "-Task", "Test", "-File", "Build.build.ps1"] | ||
|
||
# SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>] | ||
SAVE ARTIFACT $TEST_ROOT AS LOCAL ./Modules/$MODULE_NAME-TestResults | ||
|
||
# pack: | ||
# BUILD +test # So that we get the module artifact from build too | ||
# FROM +test | ||
# RUN ["pwsh", "-Command", "Invoke-Build", "-Task", "Pack", "-File", "Build.build.ps1", "-Verbose"] | ||
# SAVE ARTIFACT $OUTPUT_ROOT/publish/*.nupkg AS LOCAL ./Modules/$MODULE_NAME-Packages/ | ||
|
||
push: | ||
FROM +build | ||
RUN --push --secret NUGET_API_KEY --secret PSGALLERY_API_KEY -- \ | ||
pwsh -Command Invoke-Build -Task Push -File Build.build.ps1 -Verbose | ||
|
||
all: | ||
# BUILD +build | ||
BUILD +test | ||
BUILD +push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# NOTE: follow nuget syntax for versions: https://docs.microsoft.com/en-us/nuget/reference/package-versioning#version-ranges-and-wildcards | ||
@{ | ||
"Configuration" = "[1.3.1,2.0)" | ||
"ModuleBuilder" = "1.*" | ||
"Pester" = "[4.10.1,5.0)" | ||
"PowerShellGet" = "2.0.4" | ||
"PSScriptAnalyzer" = "1.*" | ||
Configuration = "[1.5.0, 2.0)" | ||
Metadata = "[1.5.1, 2.0)" | ||
Pester = "[4.10.1,5.0)" | ||
ModuleBuilder = "[3.0.0, 4.0)" | ||
PSScriptAnalyzer = "[1.21.0,2.0)" | ||
PowerShellGet = "2.0.4" | ||
InvokeBuild = "[5.10.4,6.0)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
Severity = @('Error', 'Warning') | ||
ExcludeRules = @('PSAvoidGlobalVars', 'PSAvoidUsingDeprecatedManifestFields', 'PSPossibleIncorrectUsageOfAssignmentOperator', 'PSUseShouldProcessForStateChangingFunctions') | ||
} |
Oops, something went wrong.