-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (109 loc) · 4.14 KB
/
Copy pathcodegen-tests.yml
File metadata and controls
127 lines (109 loc) · 4.14 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
name: Codegen Tool Tests
# Builds the codegen tool and runs the unit-test suite (xUnit).
# Runs on Linux (fast, cheap) and can be extended to macOS/Windows.
on:
push:
paths:
- 'tools/codegen/**'
- 'src/Framework/**'
- 'src/Framework.Tests/**'
- 'native/test_stub/**'
- 'native/dsp_fixture/**'
- '.github/workflows/codegen-tests.yml'
- 'Directory.Build.props'
pull_request:
paths:
- 'tools/codegen/**'
- 'src/Framework/**'
- 'src/Framework.Tests/**'
- 'native/test_stub/**'
- 'native/dsp_fixture/**'
- '.github/workflows/codegen-tests.yml'
- 'Directory.Build.props'
permissions:
contents: read
jobs:
test:
name: Test (.NET ${{ matrix.dotnet }})
runs-on: ubuntu-24.04
strategy:
matrix:
dotnet: ['9.0.x']
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Restore
run: |
FerrumSkipMobile=true dotnet restore tools/codegen/Ferrum.Codegen.csproj
FerrumSkipMobile=true dotnet restore src/Framework/Ferrum.Framework.csproj
FerrumSkipMobile=true dotnet restore src/Framework.Tests/Ferrum.Framework.Tests.csproj
- name: Build
run: |
FerrumSkipMobile=true dotnet build tools/codegen/Ferrum.Codegen.csproj --no-restore -c Release
FerrumSkipMobile=true dotnet build src/Framework/Ferrum.Framework.csproj --no-restore -c Release
FerrumSkipMobile=true dotnet build src/Framework.Tests/Ferrum.Framework.Tests.csproj --no-restore -c Release
- name: Test
run: |
FerrumSkipMobile=true dotnet test src/Framework.Tests/Ferrum.Framework.Tests.csproj \
--no-build -c Release \
--logger "trx;LogFileName=test-results.trx" \
--logger "console;verbosity=normal"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.dotnet }}
path: '**/*.trx'
# Smoke-test the CLI: parse the in-tree add.h and verify zero exit code
codegen-smoke:
name: Codegen smoke test
runs-on: ubuntu-24.04
needs: test
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Build codegen
run: FerrumSkipMobile=true dotnet build tools/codegen/Ferrum.Codegen.csproj -c Release
- name: Run codegen on test stub header (ferrum_add)
run: |
FerrumSkipMobile=true dotnet run --project tools/codegen/Ferrum.Codegen.csproj \
--configuration Release \
-- \
--input native/test_stub/include/add.h \
--output /tmp/AddBindings.cs \
--ns Ferrum.Generated \
--class AddBindings \
--lib __Internal
- name: Verify add.h output
run: |
echo "=== Generated bindings (add.h) ==="
cat /tmp/AddBindings.cs
grep -q "\[LibraryImport" /tmp/AddBindings.cs
grep -q "ferrum_add" /tmp/AddBindings.cs
echo "==> add.h smoke test passed"
- name: Run codegen on DSP fixture header (ferrum_dsp)
run: |
FerrumSkipMobile=true dotnet run --project tools/codegen/Ferrum.Codegen.csproj \
--configuration Release \
-- \
--input native/dsp_fixture/include/ferrum_dsp.h \
--output /tmp/DspBindings.cs \
--ns Ferrum.Generated \
--class DspBindings \
--lib __Internal
- name: Verify ferrum_dsp.h output
run: |
echo "=== Generated bindings (ferrum_dsp.h) ==="
cat /tmp/DspBindings.cs
grep -q "\[LibraryImport" /tmp/DspBindings.cs
grep -q "ferrum_dsp_scale" /tmp/DspBindings.cs
grep -q "ferrum_dsp_stats" /tmp/DspBindings.cs
grep -q "FerrumDspStats" /tmp/DspBindings.cs
grep -q "StructLayout" /tmp/DspBindings.cs
echo "==> ferrum_dsp.h smoke test passed"