From 1f23818043c9ebddc4b32100d11a7f48a4845c18 Mon Sep 17 00:00:00 2001 From: Manu <52102823+Manu098vm@users.noreply.github.com> Date: Mon, 17 Feb 2025 21:59:03 +0100 Subject: [PATCH] Update workflows --- .github/workflows/Linux.yml | 22 ++++++++++++---------- .github/workflows/Mac.yml | 25 ++++++++++++++++++------- .github/workflows/Windows.yml | 18 ++++++++---------- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index c29f3fd..8edd28f 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -18,6 +18,7 @@ jobs: env: Solution_Name: SwitchGiftDataManager.sln + Project_Path: SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj steps: - name: Checkout @@ -25,20 +26,21 @@ jobs: with: fetch-depth: 0 - - name: Install .NET Core + - name: Install .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x - - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --configuration Release --no-restore - - name: Test - run: dotnet test SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --no-restore --verbosity normal + dotnet-version: 9.0.x + + - name: Clean previous build artifacts + run: dotnet clean ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} + + - name: Install dependencies and build + run: | + dotnet restore ${{ env.Project_Path }} + dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --no-restore - name: Upload Linux CommandLine build artifacts uses: actions/upload-artifact@v4 with: name: Linux.CommandLine.App - path: SwitchGiftDataManager.CommandLine/bin + path: SwitchGiftDataManager.CommandLine/bin \ No newline at end of file diff --git a/.github/workflows/Mac.yml b/.github/workflows/Mac.yml index 93bbb84..240012d 100644 --- a/.github/workflows/Mac.yml +++ b/.github/workflows/Mac.yml @@ -18,6 +18,7 @@ jobs: env: Solution_Name: SwitchGiftDataManager.sln + Project_Path: SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj steps: - name: Checkout @@ -25,20 +26,30 @@ jobs: with: fetch-depth: 0 - - name: Install .NET Core + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x - + dotnet-version: 9.0.x + + - name: Cache NuGet packages + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- + - name: Install dependencies - run: dotnet restore + run: dotnet restore ${{ env.Project_Path }} + - name: Build - run: dotnet build SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --configuration Release --no-restore + run: dotnet build ${{ env.Project_Path }} --configuration ${{ matrix.configuration }} --no-restore + - name: Test - run: dotnet test SwitchGiftDataManager.CommandLine/SwitchGiftDataManager.CommandLine.csproj --no-restore --verbosity normal + run: dotnet test ${{ env.Project_Path }} --no-restore --verbosity normal - name: Upload MacOS CommandLine build artifacts uses: actions/upload-artifact@v4 with: name: MacOS.CommandLine.App - path: SwitchGiftDataManager.CommandLine/bin + path: SwitchGiftDataManager.CommandLine/bin \ No newline at end of file diff --git a/.github/workflows/Windows.yml b/.github/workflows/Windows.yml index 96cc40e..306cf22 100644 --- a/.github/workflows/Windows.yml +++ b/.github/workflows/Windows.yml @@ -18,6 +18,7 @@ jobs: env: Solution_Name: SwitchGiftDataManager.sln + Configuration: ${{ matrix.configuration }} steps: - name: Checkout @@ -25,10 +26,10 @@ jobs: with: fetch-depth: 0 - - name: Install .NET Core + - name: Install .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Setup MSBuild.exe uses: microsoft/setup-msbuild@v2 @@ -36,13 +37,10 @@ jobs: - name: Execute unit tests run: dotnet test - - name: Restore the application - run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration - env: - Configuration: ${{ matrix.configuration }} - - - name: Create the app package - run: msbuild $env:Solution_Name /property:Configuration=Release + - name: Restore and build the application + run: | + msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + msbuild $env:Solution_Name /property:Configuration=$env:Configuration - name: Upload WinForms build artifacts uses: actions/upload-artifact@v4 @@ -54,4 +52,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: Windows.CommandLine.App - path: SwitchGiftDataManager.CommandLine/bin + path: SwitchGiftDataManager.CommandLine/bin \ No newline at end of file