Skip to content

Commit

Permalink
Add Test target to execution plan
Browse files Browse the repository at this point in the history
  • Loading branch information
MRmlik12 committed May 11, 2024
1 parent 523e1aa commit 6340997
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget-
- name: Run NUKE
run: .\build.ps1
run: .\build.ps1 --skip-tests --configuration Release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -33,7 +33,7 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget-
- name: Run NUKE
run: chmod +x build.sh && ./build.sh --configuration Release
run: chmod +x build.sh && ./build.sh --skip-tests --configuration Release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -52,7 +52,7 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget-
- name: Run NUKE
run: chmod +x build.sh && ./build.sh --configuration Release
run: chmod +x build.sh && ./build.sh --skip-tests --configuration Release
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -71,7 +71,7 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget-
- name: Run NUKE
run: chmod +x build.sh && ./build.sh CompileBrowser --allow-browser-build --allow-desktop-build false --configuration Release
run: chmod +x build.sh && ./build.sh CompileBrowser --skip-tests --allow-browser-build --allow-desktop-build false --configuration Release
env:
NetlifySiteId: ${{ secrets.NETLIFY_SITE_ID }}
NetlifyAccessToken: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
Expand Down
10 changes: 8 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,15 @@
"CompileBrowser",
"Pack",
"Restore",
"Setup"
"Setup",
"Test"
]
}
},
"SkipTests": {
"type": "boolean",
"description": "Skip tests"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
Expand All @@ -120,7 +125,8 @@
"CompileBrowser",
"Pack",
"Restore",
"Setup"
"Setup",
"Test"
]
}
},
Expand Down
12 changes: 11 additions & 1 deletion build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Build : NukeBuild

[Parameter("Allow browser build")] readonly bool AllowBrowserBuild;

[Parameter("Skip tests")] readonly bool SkipTests;

[Parameter("Artifacts path")] readonly AbsolutePath ArtifactsPath = RootDirectory / "artifacts";

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
Expand Down Expand Up @@ -117,9 +119,17 @@ class Build : NukeBuild
.SetConfiguration(Configuration)
.SetProjectFile(Solution.AllProjects.Single(x => x.Name == "NoteSHR.Browser").Path));
});

Target Test => _ => _
.DependsOn(Restore)
.OnlyWhenDynamic(() => !SkipTests)
.Executes(() =>
{
DotNetTasks.DotNetTest();
});

Target Compile => _ => _
.DependsOn(Restore)
.DependsOn(Test)
.Executes(() =>
{
var projects = Solution.AllProjects.Where(x => Platforms.Select(p => p.Name).Contains(x.Name));
Expand Down

0 comments on commit 6340997

Please sign in to comment.