Skip to content

Commit 4bf9ab0

Browse files
author
ChristianHaase
committed
test
1 parent ba30686 commit 4bf9ab0

File tree

2 files changed

+67
-64
lines changed

2 files changed

+67
-64
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
CI_BUILD_NUMBER_BASE: ${{ github.run_number }}
1111
CI_TARGET_BRANCH: ${{ github.head_ref || github.ref_name }}
12-
TRIGGER: ${{ github.event_name == 'pull_request' }}
12+
PR_TRIGGER: ${{ github.event_name == 'pull_request' }}
1313

1414
jobs:
1515
build:
@@ -33,13 +33,13 @@ jobs:
3333
- name: TEST PR RUN CHECK
3434
shell: bash
3535
run: |
36-
echo "$TRIGGER"
37-
# - name: Build & Push
38-
# env:
39-
# DOTNET_CLI_TELEMTRY_OPTOUT: true
40-
# DUMMY: ${{ secrets.DUMMY }}
41-
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
42-
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
# shell: pwsh
44-
# run: |
45-
# ./Build.ps1
36+
echo "$PR_TRIGGER"
37+
- name: Build & Push
38+
env:
39+
DOTNET_CLI_TELEMTRY_OPTOUT: true
40+
PR_TRIGGER: ${{ env.PR_TRIGGER }}
41+
#NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
42+
#GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
shell: pwsh
44+
run: |
45+
./Build.ps1

Build.ps1

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,76 +6,79 @@ dotnet --list-sdks
66
Write-Output "build: Build started"
77

88
Push-Location $PSScriptRoot
9-
try {
10-
if(Test-Path .\artifacts) {
11-
Write-Output "build: Cleaning ./artifacts"
12-
Remove-Item ./artifacts -Force -Recurse
13-
}
149

15-
& dotnet restore --no-cache
10+
Write-Output "build: PR_TRIGGER value: $env:PR_TRIGGER"
1611

17-
$dvp = [Xml] (Get-Content .\Directory.Version.props)
18-
$versionPrefix = $dvp.Project.PropertyGroup.VersionPrefix
12+
# try {
13+
# if(Test-Path .\artifacts) {
14+
# Write-Output "build: Cleaning ./artifacts"
15+
# Remove-Item ./artifacts -Force -Recurse
16+
# }
1917

20-
Write-Output "build: Package base version is $versionPrefix"
18+
# & dotnet restore --no-cache
2119

22-
$branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH];
23-
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER];
24-
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "master" -and $revision -ne "local"]
25-
$commitHash = $(git rev-parse --short HEAD)
26-
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
20+
# $dvp = [Xml] (Get-Content .\Directory.Version.props)
21+
# $versionPrefix = $dvp.Project.PropertyGroup.VersionPrefix
2722

28-
Write-Output "build: Package version suffix is $suffix"
29-
Write-Output "build: Build version suffix is $buildSuffix"
23+
# Write-Output "build: Package base version is $versionPrefix"
3024

31-
& dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
32-
if($LASTEXITCODE -ne 0) { throw "Build failed" }
25+
# $branch = @{ $true = $env:CI_TARGET_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$NULL -ne $env:CI_TARGET_BRANCH];
26+
# $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:CI_BUILD_NUMBER, 10); $false = "local" }[$NULL -ne $env:CI_BUILD_NUMBER];
27+
# $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)) -replace '([^a-zA-Z0-9\-]*)', '')-$revision"}[$branch -eq "master" -and $revision -ne "local"]
28+
# $commitHash = $(git rev-parse --short HEAD)
29+
# $buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
3330

34-
foreach ($src in Get-ChildItem src/*) {
35-
Push-Location $src
31+
# Write-Output "build: Package version suffix is $suffix"
32+
# Write-Output "build: Build version suffix is $buildSuffix"
3633

37-
Write-Output "build: Packaging project in $src"
34+
# & dotnet build -c Release --version-suffix=$buildSuffix /p:ContinuousIntegrationBuild=true
35+
# if($LASTEXITCODE -ne 0) { throw "Build failed" }
3836

39-
if ($suffix) {
40-
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts --version-suffix=$suffix
41-
} else {
42-
& dotnet pack -c Release --no-build --no-restore -o ../../artifacts
43-
}
44-
if($LASTEXITCODE -ne 0) { throw "Packaging failed" }
37+
# foreach ($src in Get-ChildItem src/*) {
38+
# Push-Location $src
4539

46-
Pop-Location
47-
}
40+
# Write-Output "build: Packaging project in $src"
4841

49-
foreach ($test in Get-ChildItem tests/) {
50-
Push-Location $test
42+
# if ($suffix) {
43+
# & dotnet pack -c Release --no-build --no-restore -o ../../artifacts --version-suffix=$suffix
44+
# } else {
45+
# & dotnet pack -c Release --no-build --no-restore -o ../../artifacts
46+
# }
47+
# if($LASTEXITCODE -ne 0) { throw "Packaging failed" }
5148

52-
Write-Output "build: Testing project in $test"
49+
# Pop-Location
50+
# }
5351

54-
& dotnet test -c Release --no-build --no-restore
55-
if($LASTEXITCODE -ne 0) { throw "Testing failed" }
52+
# foreach ($test in Get-ChildItem tests/) {
53+
# Push-Location $test
5654

57-
Pop-Location
58-
}
55+
# Write-Output "build: Testing project in $test"
5956

60-
if ($env:DUMMY) {
61-
# GitHub Actions will only supply this to branch builds and not PRs. We publish
62-
# builds from any branch this action targets (i.e. master and dev).
57+
# & dotnet test -c Release --no-build --no-restore
58+
# if($LASTEXITCODE -ne 0) { throw "Testing failed" }
6359

64-
Write-Output "DUMMY value: $env:DUMMY"
60+
# Pop-Location
61+
# }
6562

66-
# Write-Output "build: Publishing NuGet package"
63+
# if ($env:DUMMY) {
64+
# # GitHub Actions will only supply this to branch builds and not PRs. We publish
65+
# # builds from any branch this action targets (i.e. master and dev).
6766

68-
# foreach ($nupkg in Get-ChildItem artifacts/*.nupkg) {
69-
# & dotnet nuget push -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json "$nupkg"
70-
# if($LASTEXITCODE -ne 0) { throw "Publishing failed" }
71-
# }
67+
# Write-Output "DUMMY value: $env:DUMMY"
7268

73-
# if (!($suffix)) {
74-
# Write-Output "build: Creating release for version $versionPrefix"
69+
# # Write-Output "build: Publishing NuGet package"
7570

76-
# iex "gh release create v$versionPrefix --title v$versionPrefix --generate-notes $(get-item ./artifacts/*.nupkg) $(get-item ./artifacts/*.snupkg)"
77-
# }
78-
}
79-
} finally {
80-
Pop-Location
81-
}
71+
# # foreach ($nupkg in Get-ChildItem artifacts/*.nupkg) {
72+
# # & dotnet nuget push -k $env:NUGET_API_KEY -s https://api.nuget.org/v3/index.json "$nupkg"
73+
# # if($LASTEXITCODE -ne 0) { throw "Publishing failed" }
74+
# # }
75+
76+
# # if (!($suffix)) {
77+
# # Write-Output "build: Creating release for version $versionPrefix"
78+
79+
# # iex "gh release create v$versionPrefix --title v$versionPrefix --generate-notes $(get-item ./artifacts/*.nupkg) $(get-item ./artifacts/*.snupkg)"
80+
# # }
81+
# }
82+
# } finally {
83+
# Pop-Location
84+
# }

0 commit comments

Comments
 (0)