Repository navigation
50 lines (41 loc) · 1.74 KB
/
Copy pathtemplate-ci.yml
File metadata and controls
50 lines (41 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: template-ci
# Proves the template still works: install it, create a project, build and test that project.
# Automatic triggers are disabled; run it manually from the Actions tab.
# Uncomment push/pull_request to run on every push and PR again.
on:
workflow_dispatch:
# push:
# branches: [main]
# pull_request:
# branches: [main]
jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
auto-discovery: [false, true] # both feature wiring modes
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Install template from source
run: dotnet new install ./templates/DotnetApiTemplate
- name: Create a sample project
run: dotnet new dotnet-api-template -n Sample.Project -o "$RUNNER_TEMP/sample" --auto-discovery ${{ matrix.auto-discovery }}
- name: Build and test the sample project
working-directory: ${{ runner.temp }}/sample
run: |
# The template must ship its lock files (locked mode would silently create missing ones).
test "$(find . -name packages.lock.json -not -path '*/obj/*' | wc -l)" -eq 3
dotnet restore --locked-mode
dotnet build --configuration Release --no-restore
dotnet test --configuration Release --no-build
- name: Check that no placeholder names are left
working-directory: ${{ runner.temp }}/sample
run: |
if grep -rIi --exclude-dir=bin --exclude-dir=obj "dotnetapitemplate" .; then
echo "Found leftover DotnetApiTemplate placeholder"; exit 1
fi
- name: Pack the template
run: dotnet pack TemplatePack.csproj --configuration Release --output artifacts