Skip to content

Commit 15ab821

Browse files
authored
Move to GitHub actions (#9)
* move to gha, package and x-plat updates
1 parent 9643ce7 commit 15ab821

19 files changed

+165
-271
lines changed

.github/workflows/build-and-stage.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build and stage
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
env:
10+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
11+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
12+
DOTNET_VERSION: '8.0'
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
permissions:
19+
checks: write
20+
contents: read
21+
statuses: write
22+
23+
jobs:
24+
build:
25+
name: Build and publish app
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
31+
32+
- name: Set up .NET Core
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: ${{ env.DOTNET_VERSION }}
36+
37+
- name: Set up dependency caching for faster builds
38+
uses: actions/cache@v4
39+
with:
40+
path: ~/.nuget/packages
41+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
42+
restore-keys: |
43+
${{ runner.os }}-nuget-
44+
45+
- name: dotnet restore
46+
run: dotnet restore
47+
48+
- name: dotnet build
49+
run: dotnet build --no-restore /p:TreatWarningsAsErrors=True
50+
51+
- name: dotnet test
52+
run: dotnet test --logger trx --results-directory "${{ runner.temp }}" --no-build
53+
54+
- name: dotnet test
55+
uses: NasAmin/trx-parser@v0.5.0
56+
with:
57+
TRX_PATH: "${{ runner.temp }}"
58+
REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
59+
60+
- name: dotnet publish
61+
run: dotnet publish src/NetCoreToolService/Steeltoe.NetCoreToolService.csproj -o publish
62+
63+
- name: Upload artifact for deployment job
64+
if: ${{ github.event_name != 'pull_request' }}
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: published-app
68+
path: publish
69+
70+
deploy:
71+
name: Deploy
72+
environment: production
73+
needs:
74+
- build
75+
runs-on: ubuntu-latest
76+
if: ${{ github.event_name != 'pull_request' }}
77+
steps:
78+
- name: Download artifact from build job
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: published-app
82+
83+
- name: Log into Azure CLI with service principal
84+
uses: azure/login@v1
85+
with:
86+
creds: ${{ secrets.AZURE_CREDENTIALS }}
87+
88+
- name: Deploy to Azure Web App
89+
id: deploy-to-webapp
90+
uses: azure/webapps-deploy@v3
91+
with:
92+
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
93+
package: '.'
94+
slot-name: 'production'

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project>
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
10-
<Version>3.4.*</Version>
10+
<Version>3.6.*</Version>
1111
<PrivateAssets>all</PrivateAssets>
1212
</PackageReference>
1313
</ItemGroup>

Steeltoe.NetCoreToolService.sln

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.6.30114.105
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.9.34414.90
54
MinimumVisualStudioVersion = 10.0.40219.1
65
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C742A7B8-80CA-4365-85CA-C29AA744CE54}"
76
EndProject
@@ -20,11 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2019
Directory.Build.props = Directory.Build.props
2120
docker-compose.yaml = docker-compose.yaml
2221
Dockerfile = Dockerfile
23-
kubernetes.yaml = kubernetes.yaml
2422
stylecop.json = stylecop.json
2523
Version.props = Version.props
26-
azure-pipelines.yaml = azure-pipelines.yaml
27-
setversion.sh = setversion.sh
2824
EndProjectSection
2925
EndProject
3026
Global

Version.props

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55
</PropertyGroup>
66

77
<PropertyGroup>
8-
<MicrosoftExtensionsVersion>5.0.*</MicrosoftExtensionsVersion>
98
<SteeltoeVersion>3.2.*</SteeltoeVersion>
10-
<SwashbuckleVersion>6.1.*</SwashbuckleVersion>
9+
<SwashbuckleVersion>6.5.0</SwashbuckleVersion>
1110
</PropertyGroup>
1211

1312
<PropertyGroup>
1413
<CoverletCollectorVersion>1.3.*</CoverletCollectorVersion>
1514
<CoverletMsBuildVersion>2.9.*</CoverletMsBuildVersion>
16-
<FluentAssertionsVersion>5.10.*</FluentAssertionsVersion>
17-
<FluentAssertionsJsonVersion>5.5.*</FluentAssertionsJsonVersion>
18-
<MicrosoftAspNetCoreMvcTestingVersion>3.1.*</MicrosoftAspNetCoreMvcTestingVersion>
19-
<MicrosoftNetTestSdkVersion>16.7.*</MicrosoftNetTestSdkVersion>
20-
<MoqVersion>4.14.*</MoqVersion>
21-
<XunitVersion>2.4.*</XunitVersion>
15+
<FluentAssertionsVersion>6.12.0</FluentAssertionsVersion>
16+
<FluentAssertionsJsonVersion>6.1.0</FluentAssertionsJsonVersion>
17+
<MicrosoftAspNetCoreMvcTestingVersion>8.0.1</MicrosoftAspNetCoreMvcTestingVersion>
18+
<MicrosoftNetTestSdkVersion>17.9.0</MicrosoftNetTestSdkVersion>
19+
<MoqVersion>4.18.4</MoqVersion>
20+
<XunitVersion>2.6.6</XunitVersion>
2221
</PropertyGroup>
2322

2423
</Project>

azure-pipelines.yaml

Lines changed: 0 additions & 81 deletions
This file was deleted.

global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

kubernetes/defaults.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

kubernetes/net-core-tool-service.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/Directory.Build.props

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/NetCoreToolService/Controllers/NewController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public async Task<ActionResult> GetTemplateProject(
208208
var start = newCommand.Error.IndexOf(invalidOptionError, StringComparison.Ordinal) +
209209
invalidOptionError.Length;
210210
start = newCommand.Error.IndexOf("--", start, StringComparison.Ordinal) + "--".Length;
211-
var end = newCommand.Error.IndexOf('\n', start);
211+
var end = newCommand.Error.IndexOf(Environment.NewLine, start, StringComparison.Ordinal);
212212
return NotFound($"Switch '{newCommand.Error[start..end]}' not found.");
213213
}
214214

@@ -218,7 +218,7 @@ public async Task<ActionResult> GetTemplateProject(
218218
var start = newCommand.Error.IndexOf(invalidSwitchError, StringComparison.Ordinal) +
219219
invalidSwitchError.Length;
220220
start = newCommand.Error.IndexOf("--", start, StringComparison.Ordinal) + "--".Length;
221-
var end = newCommand.Error.IndexOf('\n', start);
221+
var end = newCommand.Error.IndexOf(Environment.NewLine, start, StringComparison.Ordinal);
222222
return NotFound($"Switch '{newCommand.Error[start..end]}' not found.");
223223
}
224224

@@ -228,7 +228,7 @@ public async Task<ActionResult> GetTemplateProject(
228228
var start = newCommand.Error.IndexOf(invalidParameterError, StringComparison.Ordinal) +
229229
invalidParameterError.Length;
230230
start = newCommand.Error.IndexOf("--", start, StringComparison.Ordinal) + "--".Length;
231-
var end = newCommand.Error.IndexOf('\n', start);
231+
var end = newCommand.Error.IndexOf(Environment.NewLine, start, StringComparison.Ordinal);
232232
var nvp = newCommand.Error[start..end].Split(' ', 2);
233233
return NotFound($"Option '{nvp[0]}' parameter '{nvp[1]}' not found.");
234234
}

0 commit comments

Comments
 (0)