-
Notifications
You must be signed in to change notification settings - Fork 15
113 lines (86 loc) · 2.79 KB
/
test_and_build.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Test & Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
# Edit this values to match your environment
env:
API_URL: "localhost:8080"
AZURE_TENANT_ID: "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa"
AZURE_CLIENT_ID: "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa"
VITE_AZURE_CLIENT_ID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa
VITE_AZURE_AUTHORITY: https://login.microsoftonline.com/{your_tenant_id}
VITE_TODO_API_ENDPOINT_URL: http://localhost:8080
VITE_TODO_API_SCOPES_READ: "[\"api://aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa/ToDoList.Read\"]"
VITE_TODO_API_SCOPES_WRITE: "[\"api://aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa/ToDoList.ReadWrite\"]"
jobs:
build-service:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
- name: Restore dependencies
run: dotnet restore
- name: Restore tool dependencies
run: dotnet tool restore
- name: Test
run: dotnet test --verbosity normal
- name: Publish
run: dotnet publish --configuration Release --output ./publish
- name: Upload Open API Definiton
uses: actions/upload-artifact@v3
with:
name: openapi.json
path: ./src/Api/bin/Release/net8.0/openapi.json
- name: Upload .NET artifacts
uses: actions/upload-artifact@v3
with:
name: dotnet-artifacts
path: ./publish
build-client:
needs: build-service
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Open API artifacts for generating the api types
uses: actions/download-artifact@v3
with:
name: openapi.json
- run: corepack enable
- name: Setup Node.js environment
uses: actions/setup-node@v4.0.2
with:
node-version: 20.x
- name: Restore dependencies
working-directory: ./src/Client
run: npm ci
- name: Generate API
working-directory: ./src/Client
run: npm run api:generate ../../openapi.json
- name: Generate Router
working-directory: ./src/Client
run: npm run router:generate
- name: Type check
working-directory: ./src/Client
run: npm run type-check
- name: Check lint
working-directory: ./src/Client
run: npm run lint
- name: Run tests
working-directory: ./src/Client
run: npm run test --run
- name: Build
working-directory: ./src/Client
run: npm run build