Skip to content

Commit ffee9d9

Browse files
committed
Consolidate SDK CI and harden release flow
1 parent 68b2123 commit ffee9d9

28 files changed

+227
-594
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: SDK CI
22

33
env:
44
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
@@ -10,29 +10,55 @@ on:
1010
- master
1111
- "codex/**"
1212
pull_request:
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: sdk-ci-${{ github.ref }}
17+
cancel-in-progress: true
1318

1419
jobs:
15-
runtime-matrix:
16-
name: Runtime Matrix
20+
prepare:
21+
name: Prepare Matrices
1722
runs-on: ubuntu-latest
1823
outputs:
19-
matrix: ${{ steps.matrix.outputs.matrix }}
24+
runtime_matrix: ${{ steps.runtime-matrix.outputs.matrix }}
25+
coverage_matrix: ${{ steps.coverage-matrix.outputs.matrix }}
2026
steps:
2127
- uses: actions/checkout@v6
2228
- uses: actions/setup-node@v6
2329
with:
2430
node-version: 22
25-
- id: matrix
31+
- id: runtime-matrix
2632
run: echo "matrix=$(node SDK/scripts/runtime-matrix.mjs --compact)" >> "$GITHUB_OUTPUT"
33+
- id: coverage-matrix
34+
run: echo "matrix=$(node SDK/scripts/runtime-matrix.mjs --coverage --compact)" >> "$GITHUB_OUTPUT"
35+
36+
quality:
37+
name: Quality Gates
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v6
41+
- uses: actions/setup-node@v6
42+
with:
43+
node-version: 22
44+
- uses: actions/setup-dotnet@v5
45+
with:
46+
dotnet-version: 10.0.x
47+
- run: npm ci
48+
- run: npm ci --prefix SDK/js
49+
- run: dotnet restore SDK/dotnet/ManagedCode.Tps.slnx
50+
- run: npm run build:site
51+
- run: dotnet format SDK/dotnet/ManagedCode.Tps.slnx --verify-no-changes
52+
- run: dotnet build SDK/dotnet/ManagedCode.Tps.slnx -c Release -warnaserror --no-restore
2753

2854
runtimes:
2955
name: Runtime ${{ matrix.runtime.language }}
30-
needs: runtime-matrix
56+
needs: prepare
3157
runs-on: ${{ matrix.runtime.runner }}
3258
strategy:
3359
fail-fast: false
3460
matrix:
35-
runtime: ${{ fromJson(needs.runtime-matrix.outputs.matrix) }}
61+
runtime: ${{ fromJson(needs.prepare.outputs.runtime_matrix) }}
3662
steps:
3763
- uses: actions/checkout@v6
3864
- if: matrix.runtime.setup == 'node' || matrix.runtime.setup == 'dotnet'
@@ -57,21 +83,46 @@ jobs:
5783
- run: ${{ matrix.runtime.build }}
5884
- run: ${{ matrix.runtime.test }}
5985

60-
quality:
61-
name: Quality
62-
runs-on: ubuntu-latest
86+
coverage:
87+
name: Coverage ${{ matrix.runtime.language }}
88+
needs: prepare
89+
runs-on: ${{ matrix.runtime.runner }}
90+
strategy:
91+
fail-fast: false
92+
matrix:
93+
runtime: ${{ fromJson(needs.prepare.outputs.coverage_matrix) }}
6394
steps:
6495
- uses: actions/checkout@v6
65-
- uses: actions/setup-node@v6
96+
- if: matrix.runtime.setup == 'node' || matrix.runtime.setup == 'dotnet'
97+
uses: actions/setup-node@v6
6698
with:
6799
node-version: 22
68-
- uses: actions/setup-dotnet@v5
100+
- if: matrix.runtime.setup == 'dotnet'
101+
uses: actions/setup-dotnet@v5
69102
with:
70103
dotnet-version: 10.0.x
71-
- run: npm ci
72-
- run: npm ci --prefix SDK/js
73-
- run: dotnet restore SDK/dotnet/ManagedCode.Tps.slnx
74-
- run: npm run build:site
75-
- run: dotnet format SDK/dotnet/ManagedCode.Tps.slnx --verify-no-changes
76-
- run: dotnet build SDK/dotnet/ManagedCode.Tps.slnx -warnaserror --no-restore
77-
- run: dotnet test SDK/dotnet/ManagedCode.Tps.slnx --no-build --no-restore
104+
- if: matrix.runtime.setup == 'dart'
105+
uses: dart-lang/setup-dart@v1
106+
- if: matrix.runtime.setup == 'java'
107+
uses: actions/setup-java@v4
108+
with:
109+
distribution: temurin
110+
java-version: "17"
111+
- if: matrix.runtime.setup == 'node'
112+
run: npm ci --prefix SDK/js
113+
- if: matrix.runtime.setup == 'dotnet'
114+
run: dotnet restore SDK/dotnet/ManagedCode.Tps.slnx
115+
- run: ${{ matrix.runtime.build }}
116+
- run: ${{ matrix.runtime.coverage }}
117+
- name: Coverage Policy
118+
run: |
119+
{
120+
echo "## Coverage Policy"
121+
echo ""
122+
echo "- TypeScript: minimum 90% statements, branches, functions, and lines"
123+
echo "- JavaScript: minimum 90% statements, branches, functions, and lines"
124+
echo "- C#: minimum 90% line, branch, and method coverage"
125+
echo "- Flutter: minimum 90% line coverage for SDK source files"
126+
echo "- Swift: minimum 90% line coverage for SDK source files"
127+
echo "- Java: minimum 90% line coverage for SDK source files"
128+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/coverage.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
push:
88
branches:
99
- main
10-
paths:
11-
- VERSION
1210
workflow_dispatch:
1311

1412
permissions:
1513
contents: write
1614

15+
concurrency:
16+
group: release-${{ github.ref }}
17+
cancel-in-progress: true
18+
1719
jobs:
1820
release:
1921
runs-on: ubuntu-latest
@@ -48,6 +50,23 @@ jobs:
4850
echo "exists=false" >> "$GITHUB_OUTPUT"
4951
fi
5052
53+
- name: Check whether the tag already exists
54+
id: tag
55+
run: |
56+
if git ls-remote --exit-code --tags origin "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
57+
echo "exists=true" >> "$GITHUB_OUTPUT"
58+
else
59+
echo "exists=false" >> "$GITHUB_OUTPUT"
60+
fi
61+
62+
- name: Create and push version tag
63+
if: steps.tag.outputs.exists != 'true'
64+
run: |
65+
git config user.name "github-actions[bot]"
66+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
67+
git tag "${{ steps.version.outputs.tag }}" "$GITHUB_SHA"
68+
git push origin "refs/tags/${{ steps.version.outputs.tag }}"
69+
5170
- name: Create GitHub release
5271
if: steps.existing.outputs.exists != 'true'
5372
env:
@@ -56,8 +75,8 @@ jobs:
5675
for attempt in 1 2 3; do
5776
if gh release create "${{ steps.version.outputs.tag }}" \
5877
--repo "$GITHUB_REPOSITORY" \
59-
--target "$GITHUB_SHA" \
6078
--title "TPS ${{ steps.version.outputs.tag }}" \
79+
--verify-tag \
6180
--generate-notes; then
6281
exit 0
6382
fi

.github/workflows/sdk-dotnet-coverage.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/sdk-dotnet.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/sdk-flutter-coverage.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/sdk-flutter.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)