From 1741863cab732adecea30d0cd48d6244e7ea8733 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 08:36:37 +0000 Subject: [PATCH 01/10] Initial plan From fcd4dc9e45bd3ddea96e1151d3e7c07071f59274 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 08:41:26 +0000 Subject: [PATCH 02/10] Create copilot-setup-steps workflow with Node.js and .NET environment setup Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .github/workflows/copilot-setup-steps.yml | 48 +++++++++++++++++++++++ package-lock.json | 16 ++++++++ package.json | 11 ++++++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/copilot-setup-steps.yml create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 00000000..d82b98f6 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,48 @@ +name: Copilot Setup Steps + +on: + push: + paths: + - '.github/workflows/copilot-setup-steps.yml' + pull_request: + paths: + - '.github/workflows/copilot-setup-steps.yml' + workflow_dispatch: + +jobs: + copilot-setup-steps: + name: copilot-setup-steps + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install JavaScript dependencies + run: npm ci + + - name: Setup dotnet SDK + uses: actions/setup-dotnet@v5 + with: + global-json-file: global.json + + - name: Set up dependency caching for faster builds + uses: actions/cache@v4 + id: nuget-cache + with: + path: | + ~/.nuget/packages + ${{ github.workspace }}/**/obj/project.assets.json + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + ${{ runner.os }}-nuget- \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..399fb69f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,16 @@ +{ + "name": "essential-csharp", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "essential-csharp", + "version": "1.0.0", + "devDependencies": {}, + "engines": { + "node": ">=20.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..663e087b --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "essential-csharp", + "version": "1.0.0", + "description": "Essential C# - A comprehensive guide to C# programming", + "private": true, + "scripts": {}, + "devDependencies": {}, + "engines": { + "node": ">=20.0.0" + } +} \ No newline at end of file From b09836264f94437c1c6fab3355bd0d89fb0e3d36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 08:53:09 +0000 Subject: [PATCH 03/10] Remove unnecessary Node.js setup and create reusable .NET setup action Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .github/actions/setup-dotnet/action.yml | 31 +++++++++++++++++++++++ .github/workflows/copilot-setup-steps.yml | 28 +++----------------- package-lock.json | 16 ------------ package.json | 11 -------- 4 files changed, 35 insertions(+), 51 deletions(-) create mode 100644 .github/actions/setup-dotnet/action.yml delete mode 100644 package-lock.json delete mode 100644 package.json diff --git a/.github/actions/setup-dotnet/action.yml b/.github/actions/setup-dotnet/action.yml new file mode 100644 index 00000000..0d54e0c2 --- /dev/null +++ b/.github/actions/setup-dotnet/action.yml @@ -0,0 +1,31 @@ +name: 'Setup .NET Environment' +description: 'Set up .NET SDK and configure dependency caching for faster builds' +inputs: + dotnet-version: + description: 'Specific .NET version(s) to install' + required: false + default: '' + use-global-json: + description: 'Use global.json file for .NET version' + required: false + default: 'true' +runs: + using: 'composite' + steps: + - name: Setup dotnet SDK + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ inputs.dotnet-version || '' }} + global-json-file: ${{ inputs.use-global-json == 'true' && 'global.json' || '' }} + + - name: Set up dependency caching for faster builds + uses: actions/cache@v4 + id: nuget-cache + with: + path: | + ~/.nuget/packages + ${{ github.workspace }}/**/obj/project.assets.json + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + ${{ runner.os }}-nuget- \ No newline at end of file diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index d82b98f6..02f5462a 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -21,28 +21,8 @@ jobs: - name: Checkout code uses: actions/checkout@v5 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'npm' + - name: Setup .NET environment + uses: ./.github/actions/setup-dotnet - - name: Install JavaScript dependencies - run: npm ci - - - name: Setup dotnet SDK - uses: actions/setup-dotnet@v5 - with: - global-json-file: global.json - - - name: Set up dependency caching for faster builds - uses: actions/cache@v4 - id: nuget-cache - with: - path: | - ~/.nuget/packages - ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- \ No newline at end of file + - name: Restore dependencies + run: dotnet restore \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 399fb69f..00000000 --- a/package-lock.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "essential-csharp", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "essential-csharp", - "version": "1.0.0", - "devDependencies": {}, - "engines": { - "node": ">=20.0.0" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 663e087b..00000000 --- a/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "essential-csharp", - "version": "1.0.0", - "description": "Essential C# - A comprehensive guide to C# programming", - "private": true, - "scripts": {}, - "devDependencies": {}, - "engines": { - "node": ">=20.0.0" - } -} \ No newline at end of file From 49acef2c73a065c2e1cbecb09b9e3ed689a19ee7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 09:03:10 +0000 Subject: [PATCH 04/10] Enhance .NET setup action with build/restore and update all workflows to use it Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> --- .github/actions/setup-dotnet/action.yml | 26 +++++++++++++---------- .github/workflows/Code-Analysis.yml | 20 ++--------------- .github/workflows/build-and-test.yml | 24 +++------------------ .github/workflows/copilot-setup-steps.yml | 5 +---- 4 files changed, 21 insertions(+), 54 deletions(-) diff --git a/.github/actions/setup-dotnet/action.yml b/.github/actions/setup-dotnet/action.yml index 0d54e0c2..e6c4f02b 100644 --- a/.github/actions/setup-dotnet/action.yml +++ b/.github/actions/setup-dotnet/action.yml @@ -1,22 +1,17 @@ name: 'Setup .NET Environment' -description: 'Set up .NET SDK and configure dependency caching for faster builds' +description: 'Set up .NET SDK, configure dependency caching, restore, and optionally build' inputs: - dotnet-version: - description: 'Specific .NET version(s) to install' + build: + description: 'Whether to run dotnet build after restore' required: false - default: '' - use-global-json: - description: 'Use global.json file for .NET version' - required: false - default: 'true' + default: 'false' runs: using: 'composite' steps: - name: Setup dotnet SDK uses: actions/setup-dotnet@v5 with: - dotnet-version: ${{ inputs.dotnet-version || '' }} - global-json-file: ${{ inputs.use-global-json == 'true' && 'global.json' || '' }} + global-json-file: global.json - name: Set up dependency caching for faster builds uses: actions/cache@v4 @@ -28,4 +23,13 @@ runs: key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} restore-keys: | ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- \ No newline at end of file + ${{ runner.os }}-nuget- + + - name: Restore dependencies + shell: bash + run: dotnet restore + + - name: Build + if: ${{ inputs.build == 'true' }} + shell: bash + run: dotnet build --no-restore \ No newline at end of file diff --git a/.github/workflows/Code-Analysis.yml b/.github/workflows/Code-Analysis.yml index 305672f0..ee303bf5 100644 --- a/.github/workflows/Code-Analysis.yml +++ b/.github/workflows/Code-Analysis.yml @@ -14,24 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Setup dotnet SDK - uses: actions/setup-dotnet@v5 - with: - global-json-file: global.json - - name: Set up dependency caching for faster builds - uses: actions/cache@v4 - id: nuget-cache - with: - path: | - ~/.nuget/packages - ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- - # Run NuGet restore for the solution at repo root - - name: Run NuGet restore - run: dotnet restore + - name: Setup .NET environment + uses: ./.github/actions/setup-dotnet # Run code analysis for the solution at repo root - name: Run .NET Code Analysis diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 9cd5b7d5..607ea897 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -30,28 +30,10 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - uses: actions/checkout@v5 - - name: Setup dotnet SDK - uses: actions/setup-dotnet@v5 + - name: Setup .NET environment + uses: ./.github/actions/setup-dotnet with: - dotnet-version: | - 6.0.x - 7.0.x - 8.0.x - - name: Set up dependency caching for faster builds - uses: actions/cache@v4 - id: nuget-cache - with: - path: | - ~/.nuget/packages - ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore + build: 'true' - name: Test run: dotnet test --no-build --no-restore --verbosity normal --logger trx --results-directory ${{ runner.temp }} diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 02f5462a..8775f1c6 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -22,7 +22,4 @@ jobs: uses: actions/checkout@v5 - name: Setup .NET environment - uses: ./.github/actions/setup-dotnet - - - name: Restore dependencies - run: dotnet restore \ No newline at end of file + uses: ./.github/actions/setup-dotnet \ No newline at end of file From 236ed97385ab36bde661f265f0bda7404630cafb Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 20 Sep 2025 02:13:02 -0700 Subject: [PATCH 05/10] Update action.yml --- .github/actions/setup-dotnet/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-dotnet/action.yml b/.github/actions/setup-dotnet/action.yml index e6c4f02b..cf36dbd0 100644 --- a/.github/actions/setup-dotnet/action.yml +++ b/.github/actions/setup-dotnet/action.yml @@ -4,7 +4,7 @@ inputs: build: description: 'Whether to run dotnet build after restore' required: false - default: 'false' + default: 'true' runs: using: 'composite' steps: From aec82a633ebfec673d8791066f810a3dbc8b25ed Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 20 Sep 2025 02:13:10 -0700 Subject: [PATCH 06/10] Update Code-Analysis.yml --- .github/workflows/Code-Analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Code-Analysis.yml b/.github/workflows/Code-Analysis.yml index ee303bf5..896167a5 100644 --- a/.github/workflows/Code-Analysis.yml +++ b/.github/workflows/Code-Analysis.yml @@ -16,6 +16,7 @@ jobs: - uses: actions/checkout@v5 - name: Setup .NET environment uses: ./.github/actions/setup-dotnet + build: 'false' # Run code analysis for the solution at repo root - name: Run .NET Code Analysis From 5b2bb6f16678017f8915285fb918132281158135 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 20 Sep 2025 02:14:07 -0700 Subject: [PATCH 07/10] Update build-and-test.yml --- .github/workflows/build-and-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 607ea897..0308f696 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -33,7 +33,6 @@ jobs: - name: Setup .NET environment uses: ./.github/actions/setup-dotnet with: - build: 'true' - name: Test run: dotnet test --no-build --no-restore --verbosity normal --logger trx --results-directory ${{ runner.temp }} From f1dafe293ca26261ccbf12f9c4bfb54920b43ff4 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 20 Sep 2025 02:14:40 -0700 Subject: [PATCH 08/10] Update Code-Analysis.yml --- .github/workflows/Code-Analysis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Code-Analysis.yml b/.github/workflows/Code-Analysis.yml index 896167a5..a5560e8e 100644 --- a/.github/workflows/Code-Analysis.yml +++ b/.github/workflows/Code-Analysis.yml @@ -16,7 +16,8 @@ jobs: - uses: actions/checkout@v5 - name: Setup .NET environment uses: ./.github/actions/setup-dotnet - build: 'false' + with: + build: 'false' # Run code analysis for the solution at repo root - name: Run .NET Code Analysis From 0234ca53d7641e83d063b7bcf71ba37382875eeb Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 20 Sep 2025 02:26:30 -0700 Subject: [PATCH 09/10] Update build-and-test.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build-and-test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 0308f696..aae9293e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -32,7 +32,6 @@ jobs: - uses: actions/checkout@v5 - name: Setup .NET environment uses: ./.github/actions/setup-dotnet - with: - name: Test run: dotnet test --no-build --no-restore --verbosity normal --logger trx --results-directory ${{ runner.temp }} From 99ad5d78870435d7a5f6659750e24ab6cf7d5971 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Sat, 20 Sep 2025 07:27:36 -0700 Subject: [PATCH 10/10] Update action.yml --- .github/actions/setup-dotnet/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-dotnet/action.yml b/.github/actions/setup-dotnet/action.yml index cf36dbd0..01a84e32 100644 --- a/.github/actions/setup-dotnet/action.yml +++ b/.github/actions/setup-dotnet/action.yml @@ -11,7 +11,10 @@ runs: - name: Setup dotnet SDK uses: actions/setup-dotnet@v5 with: - global-json-file: global.json + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x - name: Set up dependency caching for faster builds uses: actions/cache@v4