Skip to content

Commit b54e1e2

Browse files
committed
Enhance GitHub Actions workflows and configurations
- Update dependabot configuration to include npm, nuget, and docker ecosystems with weekly update schedules. - Modify .NET publish command to specify project path for clarity. - Introduce new artifacts and caching workflow for Node.js with test result handling. - Adjust launch and task configurations for .NET to reflect new project structure. - Update Dockerfile to use a specific nginx version and add health check.
1 parent 7fbbeb0 commit b54e1e2

6 files changed

Lines changed: 82 additions & 8 deletions

File tree

.github/dependabot.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,22 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "github-actions" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "npm"
14+
directory: "/node-example"
15+
schedule:
16+
interval: "weekly"
17+
18+
- package-ecosystem: "nuget"
19+
directory: "/dotnet-sample"
20+
schedule:
21+
interval: "weekly"
22+
23+
- package-ecosystem: "docker"
24+
directory: "/container-example"
1025
schedule:
1126
interval: "weekly"

.github/workflows/10-dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
run: dotnet test --no-build --verbosity normal
4848

4949
- name: dotnet publish
50-
run: dotnet publish -c Release -o ./webapp
50+
run: dotnet publish src/dotnet-sample.csproj -c Release -o ./webapp
5151

5252
- name: Upload artifact for deployment job
5353
uses: actions/upload-artifact@v7
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: 11 Artifacts and Caching
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'node-example/**'
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- 'node-example/**'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: node-example
20+
21+
steps:
22+
- uses: actions/checkout@v6.0.2
23+
24+
- name: Setup Node.js with caching
25+
uses: actions/setup-node@v6
26+
with:
27+
node-version: 20
28+
cache: 'npm'
29+
cache-dependency-path: node-example/package-lock.json
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Run tests
35+
run: npm test
36+
37+
- name: Upload test results
38+
if: always()
39+
uses: actions/upload-artifact@v7
40+
with:
41+
name: test-results
42+
path: node-example/
43+
retention-days: 5
44+
45+
download:
46+
needs: build
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: Download test results
51+
uses: actions/download-artifact@v8
52+
with:
53+
name: test-results
54+
path: results
55+
56+
- name: Display retrieved artifact
57+
run: ls -la results/

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceFolder}/dotnet-sample/bin/Debug/net7.0/dotnet-sample.dll",
13+
"program": "${workspaceFolder}/dotnet-sample/src/bin/Debug/net10.0/dotnet-sample.dll",
1414
"args": [],
1515
"cwd": "${workspaceFolder}/dotnet-sample",
1616
"stopAtEntry": false,

.vscode/tasks.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "process",
88
"args": [
99
"build",
10-
"${workspaceFolder}/dotnet-sample/dotnet-sample.csproj",
10+
"${workspaceFolder}/dotnet-sample/src/dotnet-sample.csproj",
1111
"/property:GenerateFullPaths=true",
1212
"/consoleloggerparameters:NoSummary"
1313
],
@@ -19,7 +19,7 @@
1919
"type": "process",
2020
"args": [
2121
"publish",
22-
"${workspaceFolder}/dotnet-sample/dotnet-sample.csproj",
22+
"${workspaceFolder}/dotnet-sample/src/dotnet-sample.csproj",
2323
"/property:GenerateFullPaths=true",
2424
"/consoleloggerparameters:NoSummary"
2525
],
@@ -33,7 +33,7 @@
3333
"watch",
3434
"run",
3535
"--project",
36-
"${workspaceFolder}/dotnet-sample/dotnet-sample.csproj"
36+
"${workspaceFolder}/dotnet-sample/src/dotnet-sample.csproj"
3737
],
3838
"problemMatcher": "$msCompile"
3939
}

container-example/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
FROM nginx:alpine
1+
FROM nginx:1.27-alpine
2+
EXPOSE 80
3+
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost/ || exit 1
24
COPY src/. /usr/share/nginx/html/

0 commit comments

Comments
 (0)