Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/setup-node-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Setup Node.js Project'
description: 'Composite action that checks out code, sets up Node.js with caching, and installs dependencies'
inputs:
node-version:
description: 'Node.js version to use'
required: false
default: '20'
working-directory:
description: 'Directory containing the Node.js project'
required: false
default: '.'

runs:
using: 'composite'
steps:
- uses: actions/checkout@v6.0.2

- name: Setup Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
cache: 'npm'
cache-dependency-path: ${{ inputs.working-directory }}/package-lock.json

- name: Install dependencies
run: npm ci
shell: bash
working-directory: ${{ inputs.working-directory }}
19 changes: 17 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,22 @@

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "/node-example"
schedule:
interval: "weekly"

- package-ecosystem: "nuget"
directory: "/dotnet-sample"
schedule:
interval: "weekly"

- package-ecosystem: "docker"
directory: "/container-example"
schedule:
interval: "weekly"
5 changes: 3 additions & 2 deletions .github/workflows/03-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ jobs:
print %ENV
shell: perl {0}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Reference a specific commit
# Reference a specific commit (most secure — immutable)
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
# Reference the major version of a release
- uses: actions/checkout@v6.0.2
# Reference a specific version
- uses: actions/checkout@v6.0.2
# Reference a branch
# ⚠️ INSECURE — branch refs are mutable and vulnerable to supply chain attacks
# Reference a branch (demo only — do NOT use in production workflows)
- uses: actions/checkout@main
2 changes: 1 addition & 1 deletion .github/workflows/09-node.js-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
build-node:
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/10-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ on:
push:
branches: [main]
paths:
- '!**'
- 'dotnet-sample/**'
pull_request:
branches: [main]
paths:
- '!**'
- 'dotnet-sample/**'

permissions:
Expand All @@ -30,7 +28,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
dotnet-version: 10.0.x
- name: Set up dependency caching for faster builds
uses: actions/cache@v5
with:
Expand All @@ -42,12 +40,12 @@ jobs:
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal

- name: dotnet publish
run: dotnet publish -c Release -o ./webapp
run: dotnet publish src/dotnet-sample.csproj -c Release -o ./webapp

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v7
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/11-artifacts-caching.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 11 Artifacts and Caching

on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'node-example/**'
pull_request:
branches: [main]
paths:
- 'node-example/**'

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: node-example

steps:
- uses: actions/checkout@v6.0.2

- name: Setup Node.js with caching
uses: actions/setup-node@v6
with:
node-version: 20
cache: 'npm'
cache-dependency-path: node-example/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: node-example/
retention-days: 5

download:
needs: build
runs-on: ubuntu-latest

steps:
- name: Download test results
uses: actions/download-artifact@v8
with:
name: test-results
path: results

- name: Display retrieved artifact
run: ls -la results/
4 changes: 1 addition & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ on:
push:
branches: [main]
paths:
- '!**'
- 'container-example/**'
pull_request:
branches: [main]
paths:
- '!**'
- 'container-example/**'

defaults:
run:
working-directory: containers-example
working-directory: container-example

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
uses: ./.github/workflows/lint.yml

deploy:
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,19 @@ jobs:
env:
# To report GitHub Actions status checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Only lint changed files, not the entire codebase
VALIDATE_ALL_CODEBASE: 'false'
# Disable redundant Prettier linters (formatting-only, not catching bugs)
VALIDATE_CSS_PRETTIER: 'false'
VALIDATE_HTML_PRETTIER: 'false'
VALIDATE_JAVASCRIPT_PRETTIER: 'false'
VALIDATE_JSON_PRETTIER: 'false'
VALIDATE_MARKDOWN_PRETTIER: 'false'
VALIDATE_YAML_PRETTIER: 'false'
# Disable linters not useful for a demo repo
VALIDATE_NATURAL_LANGUAGE: 'false'
VALIDATE_JSCPD: 'false'
VALIDATE_BIOME_FORMAT: 'false'
VALIDATE_BIOME_LINT: 'false'
VALIDATE_CHECKOV: 'false'
VALIDATE_TRIVY: 'false'
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# Marp slide exports (generated temp files)
slides/slide-*.png
slides/*.html

# User-specific files
*.rsuser
*.suo
Expand Down Expand Up @@ -348,3 +352,11 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
.playwright-cli/
# Squad: ignore runtime state (logs, inbox, sessions)
.squad/orchestration-log/
.squad/log/
.squad/decisions/inbox/
.squad/sessions/
# Squad: SubSquad activation file (local to this machine)
.squad-workstream
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/dotnet-sample/bin/Debug/net7.0/dotnet-sample.dll",
"program": "${workspaceFolder}/dotnet-sample/src/bin/Debug/net10.0/dotnet-sample.dll",
"args": [],
"cwd": "${workspaceFolder}/dotnet-sample",
"stopAtEntry": false,
Expand Down
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@
"marp",
"nektos",
"yzhang"
],
"markdown.marp.themes": [
"./slides/themes/custom-github.css",
"./slides/themes/custom-github-dark.css",
"./slides/themes/custom-default.css"
],
"markdown.styles": [
".slides\\\\themes\\\\custom-github.css"
]
}
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/dotnet-sample/dotnet-sample.csproj",
"${workspaceFolder}/dotnet-sample/src/dotnet-sample.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/dotnet-sample/dotnet-sample.csproj",
"${workspaceFolder}/dotnet-sample/src/dotnet-sample.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/dotnet-sample/dotnet-sample.csproj"
"${workspaceFolder}/dotnet-sample/src/dotnet-sample.csproj"
],
"problemMatcher": "$msCompile"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Aspire.AppHost.Sdk/13.2.3">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
Expand All @@ -14,8 +13,4 @@
<ProjectReference Include="..\aspire-sample.Web\aspire-sample.Web.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
Expand All @@ -10,13 +10,13 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.8.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.2.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.5.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="10.5.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.2" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion aspire-sample/aspire-sample.Web/aspire-sample.Web.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions aspire-sample/aspire.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"appHost": {
"path": "aspire-sample.AppHost/aspire-sample.AppHost.csproj"
}
}
4 changes: 3 additions & 1 deletion container-example/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
FROM nginx:alpine
FROM nginx:1.27-alpine
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost/ || exit 1
COPY src/. /usr/share/nginx/html/
Loading
Loading