diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2318581..71b254c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,7 +22,7 @@ env: jobs: build: - name: Build (Windows) + name: Build on Windows runs-on: windows-latest steps: - name: Checkout @@ -33,17 +33,19 @@ jobs: - name: Install .NET Core SDK uses: actions/setup-dotnet@v3.2.0 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: @@ -63,20 +65,23 @@ 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/setup-dotnet@v3.2.0 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 @@ -84,12 +89,6 @@ jobs: 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 diff --git a/build.cake b/build.cake index 9f8bc8c..44272ae 100644 --- a/build.cake +++ b/build.cake @@ -48,8 +48,6 @@ Task("Test") $"html;LogFileName={project.GetFilenameWithoutExtension()}.html", $"junit;LogFileName={project.GetFilenameWithoutExtension()}.xml", }, - NoBuild = true, - NoRestore = true, ResultsDirectory = artifactsDirectory, }); }); @@ -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); \ No newline at end of file diff --git a/src/Atlas.Provider.Loader/Project.cs b/src/Atlas.Provider.Loader/Project.cs index 3595e2d..62dd5a9 100644 --- a/src/Atlas.Provider.Loader/Project.cs +++ b/src/Atlas.Provider.Loader/Project.cs @@ -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); }