Skip to content

Commit

Permalink
cake: test without build (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm authored Aug 5, 2024
1 parent f3c5f5f commit be8103c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
35 changes: 17 additions & 18 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:

jobs:
build:
name: Build (Windows)
name: Build on Windows
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -33,17 +33,19 @@ jobs:
- name: Install .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: |
2.1
dotnet-version: '8.0.x'
- name: List SDKs
shell: pwsh
run: dotnet --list-sdks
- name: Dotnet Tool Restore
shell: pwsh
run: dotnet tool restore
- name: Dotnet Cake Build
- name: Dotnet restore
shell: pwsh
run: dotnet cake --target=Build
- name: Dotnet Cake Pack
run: dotnet restore
- name: Dotnet Cake CI
shell: pwsh
run: dotnet cake --target=Pack
run: dotnet cake --target=CI
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -63,33 +65,30 @@ jobs:
with:
lfs: true
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: "./artifacts"
- name: Install .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: |
6.0.x
8.0.x
- name: Dotnet Tool Restore
shell: pwsh
run: dotnet tool restore
- name: Dotnet restore
shell: pwsh
run: dotnet restore
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: "./artifacts"
- name: Install AtlasEF
shell: pwsh
run: dotnet tool install --prerelease --add-source ./artifacts atlas-ef
- name: Print SQL from Demo project
shell: pwsh
working-directory: ./src/Atlas.Provider.Demo
run: dotnet atlas-ef -- sqlserver
- name: Dotnet Tool Restore
shell: pwsh
run: dotnet tool restore
- name: Dotnet Cake Build
shell: pwsh
run: dotnet cake --target=Build
- name: Dotnet Cake Test
shell: pwsh
run: dotnet cake --target=Test
Expand Down
12 changes: 7 additions & 5 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ Task("Test")
$"html;LogFileName={project.GetFilenameWithoutExtension()}.html",
$"junit;LogFileName={project.GetFilenameWithoutExtension()}.xml",
},
NoBuild = true,
NoRestore = true,
ResultsDirectory = artifactsDirectory,
});
});
Expand All @@ -72,10 +70,14 @@ Task("Pack")
});
});

Task("Default")
.Description("Cleans, restores NuGet packages, builds the solution, runs unit tests and then creates NuGet packages.")
Task("CI")
.Description("Runs the default target in CI mode.")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Pack");

Task("Default")
.Description("Cleans, restores NuGet packages, builds the solution, runs unit tests and then creates NuGet packages.")
.IsDependentOn("CI")
.IsDependentOn("Test");

RunTarget(target);
4 changes: 2 additions & 2 deletions src/Atlas.Provider.Loader/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public static Project FromFile(
buildExtensionsDir ??= Path.Combine(Path.GetDirectoryName(file)!, "obj");
Directory.CreateDirectory(buildExtensionsDir);
var targetsPath = Path.Combine(buildExtensionsDir, Path.GetFileName(file) + ".atlas-ef.targets");
using (var input = typeof(Project).Assembly.GetManifestResourceStream("Atlas.Provider.Loader.Resources.AtlasEF.targets")!)
{
if (!File.Exists(targetsPath)) {
using var input = typeof(Project).Assembly.GetManifestResourceStream("Atlas.Provider.Loader.Resources.AtlasEF.targets") ?? throw new InvalidOperationException("Resource not found");
using var output = File.OpenWrite(targetsPath);
input.CopyTo(output);
}
Expand Down

0 comments on commit be8103c

Please sign in to comment.