-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (121 loc) · 4.24 KB
/
Copy pathci.yml
File metadata and controls
147 lines (121 loc) · 4.24 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# CI — Unit Tests + NativeAOT Build
#
# Runs on every push and PR. Fast feedback loop (~2-3 min).
# - Node.js unit tests on Ubuntu + Windows
# - C# build + NativeAOT publish on Windows
# - Test report generation and artifact upload
#
# Integration tests (requiring M365 credentials) run separately
# via integration.yml on manual dispatch or nightly schedule.
name: CI
on:
push:
branches: [main, 'feature/**']
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── Node.js Unit Tests ────────────────────────────────────────────────
unit-tests:
name: Unit Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [22]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint (ESLint)
run: npm run lint
- name: Run unit tests
run: npm run test:ci
continue-on-error: true
id: tests
- name: Run coverage
if: matrix.os == 'ubuntu-latest'
run: npm run test:coverage -- --reporter=json --outputFile=test-results/coverage.json
continue-on-error: true
- name: Generate test report
if: always()
run: |
mkdir -p test-results 2>/dev/null || mkdir test-results 2>nul || true
node scripts/test-report.js --markdown > test-results/report.md 2>&1 || echo "Report generation failed"
shell: bash
- name: Fail if tests failed
if: steps.tests.outcome == 'failure'
run: exit 1
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: test-results/
retention-days: 30
- name: Post test summary to PR
if: always() && github.event_name == 'pull_request'
run: |
if [ -f test-results/report.md ]; then
echo "## 🧪 Test Results (${{ matrix.os }})" >> $GITHUB_STEP_SUMMARY
cat test-results/report.md >> $GITHUB_STEP_SUMMARY
fi
shell: bash
# ── C# Build ──────────────────────────────────────────────────────────
dotnet-build:
name: C# Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore src/dotnet/OutlookCli.csproj
- name: Build (Debug)
run: dotnet build src/dotnet/OutlookCli.csproj --no-restore /p:TreatWarningsAsErrors=false
- name: Verify CLI help
run: dotnet run --project src/dotnet -- --help
# ── NativeAOT Publish ─────────────────────────────────────────────────
nativeaot:
name: NativeAOT (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
needs: dotnet-build
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
rid: win-x64
ext: .exe
- os: ubuntu-latest
rid: linux-x64
ext: ""
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Publish NativeAOT
run: >
dotnet publish src/dotnet/OutlookCli.csproj
-r ${{ matrix.rid }}
--self-contained
/p:PublishAot=true
-o publish/${{ matrix.rid }}
- name: Verify binary runs
run: ./publish/${{ matrix.rid }}/outlook-cli${{ matrix.ext }} --help
shell: bash
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: outlook-cli-${{ matrix.rid }}
path: publish/${{ matrix.rid }}/
retention-days: 90