From 53a391e3e3670ef01f413497873496636c9049da Mon Sep 17 00:00:00 2001 From: Ieuan Walker Date: Fri, 11 Jul 2025 12:43:54 +0100 Subject: [PATCH] Create pr.yml (#47) * Create dotnet.yml * Replace dotnet.yml with pr.yml for GitHub Actions Updated the workflow to build and test a .NET project on pull requests to the master branch. Removed the old `dotnet.yml` file and added a new `pr.yml` file with necessary steps for setup, restore, build, and test. Updated the Visual Studio version in `GeoUK.OSTN.sln` from 16 to 17 and added a "Solution Items" section to include the new `pr.yml` file in the project structure. * Update workflow name in pr.yml Changed the workflow name from `.NET` to `PullRequest` for better clarity and to indicate its purpose in handling pull requests. * Update build command to use Release configuration Modified the `dotnet build` command to include the `--configuration Release` option. This change ensures that the build process targets the Release mode instead of the default Debug mode, enhancing the overall build process. * Update build and test commands in pr.yml Added `--configuration Release` to `dotnet build` and `dotnet test` commands to ensure optimized performance for production environments. The `--no-restore` and `--no-build` options remain unchanged. --- .github/workflows/pr.yml | 23 +++++++++++++++++++++++ GeoUK.OSTN.sln | 9 +++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..c7bd955 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,23 @@ +name: PullRequest + +on: + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Test + run: dotnet test --configuration Release --no-build --verbosity normal diff --git a/GeoUK.OSTN.sln b/GeoUK.OSTN.sln index be3da30..662740b 100644 --- a/GeoUK.OSTN.sln +++ b/GeoUK.OSTN.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29102.190 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36221.1 d17.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoUK.OSTN", "GeoUK.OSTN\GeoUK.OSTN.csproj", "{E7C614AC-E67D-4E04-BA4E-E1BBF4CAC6FD}" EndProject @@ -15,6 +15,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{F752E48A EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoUK.OSTN.XUnit", "Tests\GeoUK.OSTN.XUnit\GeoUK.OSTN.XUnit.csproj", "{DF00AA79-1818-4C7B-BE7E-694E955EAA3D}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}" + ProjectSection(SolutionItems) = preProject + .github\workflows\pr.yml = .github\workflows\pr.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU