From 75c9d04bb0c5af2b95f7d64f849715697e5e1835 Mon Sep 17 00:00:00 2001 From: William Kempf Date: Sun, 1 Oct 2023 12:04:35 -0400 Subject: [PATCH] feature(vnext): update workflow --- .build_helper.ps1 | 44 ++++++++++++++++++---------- .github/workflows/github-actions.yml | 12 ++++++++ Testify.sln | 4 +-- build.ps1 | 10 +++++-- global.json | 5 ++++ src/Testify.Moq/Testify.Moq.csproj | 2 +- src/Testify.Moq/packages.lock.json | 42 -------------------------- src/Testify/Testify.csproj | 2 +- src/Testify/packages.lock.json | 22 -------------- 9 files changed, 57 insertions(+), 86 deletions(-) create mode 100644 global.json diff --git a/.build_helper.ps1 b/.build_helper.ps1 index 06d81bc..32aee86 100644 --- a/.build_helper.ps1 +++ b/.build_helper.ps1 @@ -1,9 +1,19 @@ -function Verbose($Message) { +function Test-BuildServer { if ($env:GITHUB_ACTIONS) { - Write-Output "::debug::$Message" + return 'github' } - else { - Write-Verbose $Message + + return $null +} + +function Verbose($Message) { + switch (Test-BuildServer) { + 'github' { + Write-Output "::debug::$Message" + } + default { + Write-Verbose $Message + } } } @@ -16,19 +26,23 @@ function Info($Message) { } function Warning($Message) { - if ($env:GITHUB_ACTIONS) { - Write-Output "::warning::$Message" - } - else { - Write-Build Yellow $Message + switch (Test-BuildServer) { + 'github' { + Write-Output "::warning::$Message" + } + default { + Write-Build Yellow $Message + } } } -function Error($Message) { - if ($env:GITHUB_ACTIONS) { - Write-Output "::error::$Message" - } - else { - Write-Build Red $Message +function Err($Message) { + switch (Test-BuildServer) { + 'github' { + Write-Output "::error::$Message" + } + default { + Write-Build Red $Message + } } } \ No newline at end of file diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 15a61d6..a76b154 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -2,6 +2,18 @@ name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: [push] jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + # Semantic version range syntax or exact version of a dotnet version + dotnet-version: '7.0.400' + - name: Build + shell: pwsh + run: ./build.ps1 -Task Test Explore-GitHub-Actions: runs-on: ubuntu-latest steps: diff --git a/Testify.sln b/Testify.sln index af8f7da..92e568a 100644 --- a/Testify.sln +++ b/Testify.sln @@ -48,9 +48,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5F33DA26-515 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testify.Assertions", "src\Testify.Assertions\Testify.Assertions.csproj", "{5D45EAD5-5694-44A9-9BC5-E8D4EC223C72}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{38F9FCA7-EB52-400C-B9B9-8376AAB80C0F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{38F9FCA7-EB52-400C-B9B9-8376AAB80C0F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testify.Assertions.Tests", "src\tests\Testify.Assertions.Tests\Testify.Assertions.Tests.csproj", "{AC504586-CB6A-4355-84D4-D18BD2B76838}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testify.Assertions.Tests", "src\Tests\Testify.Assertions.Tests\Testify.Assertions.Tests.csproj", "{AC504586-CB6A-4355-84D4-D18BD2B76838}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testify.xUnit.Traits", "src\Testify.xUnit.Traits\Testify.xUnit.Traits.csproj", "{E08C2037-1FF1-486D-BA93-956605D7007A}" EndProject diff --git a/build.ps1 b/build.ps1 index 85ab372..8aadfc3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -40,16 +40,20 @@ Set-BuildFooter { Section DarkYellow "Done $Path, $($Task.Elapsed)" } +task update { + exec -Echo { dotnet restore Testify.sln --no-cache --force --verbosity quiet } +} + task restore { - dotnet restore Testify.sln --no-cache --force --verbosity quiet + exec -Echo { dotnet restore Testify.sln --locked-mode --no-cache --force --verbosity quiet } } task build restore, { - dotnet build Testify.sln -c Release --no-restore --nologo + exec -Echo { dotnet build Testify.sln -c Release --no-restore --nologo } } task test build, { - dotnet test Testify.sln -c Release --no-build --no-restore --nologo + exec -Echo { dotnet test Testify.sln -c Release --no-build --no-restore --nologo } } # Synopsis: Default build task. diff --git a/global.json b/global.json new file mode 100644 index 0000000..fb34cf6 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "7.0.400" + } +} \ No newline at end of file diff --git a/src/Testify.Moq/Testify.Moq.csproj b/src/Testify.Moq/Testify.Moq.csproj index c0ecc07..3003ff9 100644 --- a/src/Testify.Moq/Testify.Moq.csproj +++ b/src/Testify.Moq/Testify.Moq.csproj @@ -1,7 +1,7 @@  - net7.0;net45 + net7.0 Testify.Moq Testify true diff --git a/src/Testify.Moq/packages.lock.json b/src/Testify.Moq/packages.lock.json index 6356022..45c8ce4 100644 --- a/src/Testify.Moq/packages.lock.json +++ b/src/Testify.Moq/packages.lock.json @@ -1,48 +1,6 @@ { "version": 2, "dependencies": { - ".NETFramework,Version=v4.5": { - "Microsoft.NETFramework.ReferenceAssemblies": { - "type": "Direct", - "requested": "[1.0.3, )", - "resolved": "1.0.3", - "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", - "dependencies": { - "Microsoft.NETFramework.ReferenceAssemblies.net45": "1.0.3" - } - }, - "Moq": { - "type": "Direct", - "requested": "[4.7.99, )", - "resolved": "4.7.99", - "contentHash": "nABMpxtxUb14VoPd0p0maxqjjbpHV/1MpvFiq1Kwb9NhHFC7V/1E40XYSOB2GeQ8tfz0/RyMn8SlDcmw0MB71w==", - "dependencies": { - "Castle.Core": "4.1.1" - } - }, - "Castle.Core": { - "type": "Transitive", - "resolved": "4.1.1", - "contentHash": "O+88tWlRvtYLTn4dgAENyOgaLcExeox73ledI92d72z4U9IGSiiO8n/gnTnWgEMpBuXIdcyzrXHdGtn0c5Dz/A==" - }, - "Microsoft.NETFramework.ReferenceAssemblies.net45": { - "type": "Transitive", - "resolved": "1.0.3", - "contentHash": "dcSLNuUX2rfZejsyta2EWZ1W5U6ucbFt697lRg1qiTlTM5ZlYv4uAvuxE6ROy6xLWWhLhOaReCDxkhxcajRYtQ==" - }, - "testify": { - "type": "Project", - "dependencies": { - "System.ValueTuple": "[4.5.0, )" - } - }, - "System.ValueTuple": { - "type": "CentralTransitive", - "requested": "[4.5.0, )", - "resolved": "4.5.0", - "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==" - } - }, "net7.0": { "Moq": { "type": "Direct", diff --git a/src/Testify/Testify.csproj b/src/Testify/Testify.csproj index aacd01d..f47132f 100644 --- a/src/Testify/Testify.csproj +++ b/src/Testify/Testify.csproj @@ -1,7 +1,7 @@  - net7.0;net45 + net7.0 Testify Testify true diff --git a/src/Testify/packages.lock.json b/src/Testify/packages.lock.json index 4646e61..fdf3dec 100644 --- a/src/Testify/packages.lock.json +++ b/src/Testify/packages.lock.json @@ -1,28 +1,6 @@ { "version": 2, "dependencies": { - ".NETFramework,Version=v4.5": { - "Microsoft.NETFramework.ReferenceAssemblies": { - "type": "Direct", - "requested": "[1.0.3, )", - "resolved": "1.0.3", - "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", - "dependencies": { - "Microsoft.NETFramework.ReferenceAssemblies.net45": "1.0.3" - } - }, - "System.ValueTuple": { - "type": "Direct", - "requested": "[4.5.0, )", - "resolved": "4.5.0", - "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==" - }, - "Microsoft.NETFramework.ReferenceAssemblies.net45": { - "type": "Transitive", - "resolved": "1.0.3", - "contentHash": "dcSLNuUX2rfZejsyta2EWZ1W5U6ucbFt697lRg1qiTlTM5ZlYv4uAvuxE6ROy6xLWWhLhOaReCDxkhxcajRYtQ==" - } - }, "net7.0": { "System.ValueTuple": { "type": "Direct",