Skip to content

Commit 75c9d04

Browse files
committed
feature(vnext): update workflow
1 parent f6e7496 commit 75c9d04

9 files changed

Lines changed: 57 additions & 86 deletions

File tree

.build_helper.ps1

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
function Verbose($Message) {
1+
function Test-BuildServer {
22
if ($env:GITHUB_ACTIONS) {
3-
Write-Output "::debug::$Message"
3+
return 'github'
44
}
5-
else {
6-
Write-Verbose $Message
5+
6+
return $null
7+
}
8+
9+
function Verbose($Message) {
10+
switch (Test-BuildServer) {
11+
'github' {
12+
Write-Output "::debug::$Message"
13+
}
14+
default {
15+
Write-Verbose $Message
16+
}
717
}
818
}
919

@@ -16,19 +26,23 @@ function Info($Message) {
1626
}
1727

1828
function Warning($Message) {
19-
if ($env:GITHUB_ACTIONS) {
20-
Write-Output "::warning::$Message"
21-
}
22-
else {
23-
Write-Build Yellow $Message
29+
switch (Test-BuildServer) {
30+
'github' {
31+
Write-Output "::warning::$Message"
32+
}
33+
default {
34+
Write-Build Yellow $Message
35+
}
2436
}
2537
}
2638

27-
function Error($Message) {
28-
if ($env:GITHUB_ACTIONS) {
29-
Write-Output "::error::$Message"
30-
}
31-
else {
32-
Write-Build Red $Message
39+
function Err($Message) {
40+
switch (Test-BuildServer) {
41+
'github' {
42+
Write-Output "::error::$Message"
43+
}
44+
default {
45+
Write-Build Red $Message
46+
}
3347
}
3448
}

.github/workflows/github-actions.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ name: GitHub Actions Demo
22
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
33
on: [push]
44
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Setup .NET SDK
10+
uses: actions/setup-dotnet@v3
11+
with:
12+
# Semantic version range syntax or exact version of a dotnet version
13+
dotnet-version: '7.0.400'
14+
- name: Build
15+
shell: pwsh
16+
run: ./build.ps1 -Task Test
517
Explore-GitHub-Actions:
618
runs-on: ubuntu-latest
719
steps:

Testify.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5F33DA26-515
4848
EndProject
4949
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testify.Assertions", "src\Testify.Assertions\Testify.Assertions.csproj", "{5D45EAD5-5694-44A9-9BC5-E8D4EC223C72}"
5050
EndProject
51-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{38F9FCA7-EB52-400C-B9B9-8376AAB80C0F}"
51+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{38F9FCA7-EB52-400C-B9B9-8376AAB80C0F}"
5252
EndProject
53-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testify.Assertions.Tests", "src\tests\Testify.Assertions.Tests\Testify.Assertions.Tests.csproj", "{AC504586-CB6A-4355-84D4-D18BD2B76838}"
53+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testify.Assertions.Tests", "src\Tests\Testify.Assertions.Tests\Testify.Assertions.Tests.csproj", "{AC504586-CB6A-4355-84D4-D18BD2B76838}"
5454
EndProject
5555
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testify.xUnit.Traits", "src\Testify.xUnit.Traits\Testify.xUnit.Traits.csproj", "{E08C2037-1FF1-486D-BA93-956605D7007A}"
5656
EndProject

build.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,20 @@ Set-BuildFooter {
4040
Section DarkYellow "Done $Path, $($Task.Elapsed)"
4141
}
4242

43+
task update {
44+
exec -Echo { dotnet restore Testify.sln --no-cache --force --verbosity quiet }
45+
}
46+
4347
task restore {
44-
dotnet restore Testify.sln --no-cache --force --verbosity quiet
48+
exec -Echo { dotnet restore Testify.sln --locked-mode --no-cache --force --verbosity quiet }
4549
}
4650

4751
task build restore, {
48-
dotnet build Testify.sln -c Release --no-restore --nologo
52+
exec -Echo { dotnet build Testify.sln -c Release --no-restore --nologo }
4953
}
5054

5155
task test build, {
52-
dotnet test Testify.sln -c Release --no-build --no-restore --nologo
56+
exec -Echo { dotnet test Testify.sln -c Release --no-build --no-restore --nologo }
5357
}
5458

5559
# Synopsis: Default build task.

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "7.0.400"
4+
}
5+
}

src/Testify.Moq/Testify.Moq.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net7.0;net45</TargetFrameworks>
4+
<TargetFrameworks>net7.0</TargetFrameworks>
55
<AssemblyName>Testify.Moq</AssemblyName>
66
<RootNamespace>Testify</RootNamespace>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

src/Testify.Moq/packages.lock.json

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,6 @@
11
{
22
"version": 2,
33
"dependencies": {
4-
".NETFramework,Version=v4.5": {
5-
"Microsoft.NETFramework.ReferenceAssemblies": {
6-
"type": "Direct",
7-
"requested": "[1.0.3, )",
8-
"resolved": "1.0.3",
9-
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
10-
"dependencies": {
11-
"Microsoft.NETFramework.ReferenceAssemblies.net45": "1.0.3"
12-
}
13-
},
14-
"Moq": {
15-
"type": "Direct",
16-
"requested": "[4.7.99, )",
17-
"resolved": "4.7.99",
18-
"contentHash": "nABMpxtxUb14VoPd0p0maxqjjbpHV/1MpvFiq1Kwb9NhHFC7V/1E40XYSOB2GeQ8tfz0/RyMn8SlDcmw0MB71w==",
19-
"dependencies": {
20-
"Castle.Core": "4.1.1"
21-
}
22-
},
23-
"Castle.Core": {
24-
"type": "Transitive",
25-
"resolved": "4.1.1",
26-
"contentHash": "O+88tWlRvtYLTn4dgAENyOgaLcExeox73ledI92d72z4U9IGSiiO8n/gnTnWgEMpBuXIdcyzrXHdGtn0c5Dz/A=="
27-
},
28-
"Microsoft.NETFramework.ReferenceAssemblies.net45": {
29-
"type": "Transitive",
30-
"resolved": "1.0.3",
31-
"contentHash": "dcSLNuUX2rfZejsyta2EWZ1W5U6ucbFt697lRg1qiTlTM5ZlYv4uAvuxE6ROy6xLWWhLhOaReCDxkhxcajRYtQ=="
32-
},
33-
"testify": {
34-
"type": "Project",
35-
"dependencies": {
36-
"System.ValueTuple": "[4.5.0, )"
37-
}
38-
},
39-
"System.ValueTuple": {
40-
"type": "CentralTransitive",
41-
"requested": "[4.5.0, )",
42-
"resolved": "4.5.0",
43-
"contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ=="
44-
}
45-
},
464
"net7.0": {
475
"Moq": {
486
"type": "Direct",

src/Testify/Testify.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net7.0;net45</TargetFrameworks>
4+
<TargetFrameworks>net7.0</TargetFrameworks>
55
<AssemblyName>Testify</AssemblyName>
66
<RootNamespace>Testify</RootNamespace>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>

src/Testify/packages.lock.json

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,6 @@
11
{
22
"version": 2,
33
"dependencies": {
4-
".NETFramework,Version=v4.5": {
5-
"Microsoft.NETFramework.ReferenceAssemblies": {
6-
"type": "Direct",
7-
"requested": "[1.0.3, )",
8-
"resolved": "1.0.3",
9-
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
10-
"dependencies": {
11-
"Microsoft.NETFramework.ReferenceAssemblies.net45": "1.0.3"
12-
}
13-
},
14-
"System.ValueTuple": {
15-
"type": "Direct",
16-
"requested": "[4.5.0, )",
17-
"resolved": "4.5.0",
18-
"contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ=="
19-
},
20-
"Microsoft.NETFramework.ReferenceAssemblies.net45": {
21-
"type": "Transitive",
22-
"resolved": "1.0.3",
23-
"contentHash": "dcSLNuUX2rfZejsyta2EWZ1W5U6ucbFt697lRg1qiTlTM5ZlYv4uAvuxE6ROy6xLWWhLhOaReCDxkhxcajRYtQ=="
24-
}
25-
},
264
"net7.0": {
275
"System.ValueTuple": {
286
"type": "Direct",

0 commit comments

Comments
 (0)