Skip to content

Commit 14b68b8

Browse files
committed
Update CI and compatibility policy
1 parent 0b4efb9 commit 14b68b8

5 files changed

Lines changed: 79 additions & 79 deletions

File tree

.github/workflows/dotnetcore.yml

Lines changed: 41 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,50 @@
11
name: .NET Core
22

3-
on:
3+
on:
44
push:
55
branches: [ "develop", "release/*", "master" ]
66
pull_request:
77
branches: [ "develop", "release/*", "master" ]
88

99
jobs:
10-
ubuntu-latest:
11-
name: ubuntu-latest
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/setup-dotnet@v2.1.0
15-
with:
16-
dotnet-version: '5.0.x'
17-
- uses: actions/setup-dotnet@v1
18-
with:
19-
dotnet-version: '6.0.x'
20-
- uses: actions/checkout@v2
21-
- name: 🔨 Use .NET 7.X SDK
22-
uses: actions/setup-dotnet@v2.1.0
23-
with:
24-
dotnet-version: '7.x'
25-
- name: Install libgdiplus
26-
run: sudo apt-get update && sudo apt-get install -y libgdiplus libc6-dev
27-
# - name: t
28-
# run: sudo ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
29-
# - name: t1
30-
# run: sudo apt-get update && sudo apt-get install -y fontconfig
31-
- name: Install libjpeg62
32-
run: sudo apt-get install libjpeg62
33-
- name: Restore with dotnet
34-
run: dotnet restore
35-
- name: Build with dotnet
36-
run: dotnet build -c Release --no-restore
37-
- name: Test with .NET 6.0.x
38-
run: dotnet test src/Magicodes.ExporterAndImporter.Tests -f net6.0
39-
- name: Test with .NET 7.0.x
40-
run: dotnet test src/Magicodes.ExporterAndImporter.Tests -f net7.0
41-
windows-latest:
42-
name: windows-latest
43-
runs-on: windows-latest
44-
steps:
45-
- uses: actions/setup-dotnet@v2.1.0
46-
with:
47-
dotnet-version: '5.0.x'
48-
- uses: actions/setup-dotnet@v1
49-
with:
50-
dotnet-version: '6.0.x'
51-
- uses: actions/checkout@v2
52-
- name: 🔨 Use .NET 7.X SDK
53-
uses: actions/setup-dotnet@v2.1.0
54-
with:
55-
dotnet-version: '7.x'
56-
- name: Restore with dotnet
57-
run: dotnet restore
58-
- name: Build with dotnet
59-
run: dotnet build -c Release --no-restore
60-
- name: Test with dotnet
61-
run: dotnet test src/Magicodes.ExporterAndImporter.Tests
62-
macOS-latest:
63-
name: macOS-latest
64-
runs-on: macos-latest
10+
build-and-test:
11+
name: ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
6518
steps:
66-
- uses: actions/setup-dotnet@v2.1.0
67-
with:
68-
dotnet-version: '5.0.x'
69-
- uses: actions/setup-dotnet@v1
70-
with:
71-
dotnet-version: '6.0.x'
72-
- uses: actions/checkout@v2
73-
- name: 🔨 Use .NET 7.X SDK
74-
uses: actions/setup-dotnet@v2.1.0
75-
with:
76-
dotnet-version: '7.x'
77-
- name: Restore with dotnet
78-
run: dotnet restore
79-
- name: Build with dotnet
80-
run: dotnet build -c Release --no-restore
81-
- name: Test with .NET 6.0.x
82-
run: dotnet test src/Magicodes.ExporterAndImporter.Tests -f net6.0
83-
- name: Test with .NET 7.0.x
84-
run: dotnet test src/Magicodes.ExporterAndImporter.Tests -f net7.0
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v4
23+
with:
24+
dotnet-version: 10.0.x
25+
cache: true
26+
cache-dependency-path: |
27+
Magicodes.IE.sln
28+
src/**/*.csproj
29+
30+
- name: Install Linux dependencies
31+
if: runner.os == 'Linux'
32+
run: sudo apt-get update && sudo apt-get install -y libgdiplus libc6-dev libjpeg62
33+
34+
- name: Restore
35+
run: dotnet restore Magicodes.IE.sln
36+
37+
- name: Build
38+
run: dotnet build Magicodes.IE.sln -c Release --no-restore
39+
40+
- name: Test on Windows
41+
if: runner.os == 'Windows'
42+
run: dotnet test src/Magicodes.ExporterAndImporter.Tests/Magicodes.IE.Tests.csproj -c Release --no-build
43+
44+
- name: Test on Linux and macOS - net8.0
45+
if: runner.os != 'Windows'
46+
run: dotnet test src/Magicodes.ExporterAndImporter.Tests/Magicodes.IE.Tests.csproj -c Release --no-build -f net8.0
47+
48+
- name: Test on Linux and macOS - net10.0
49+
if: runner.os != 'Windows'
50+
run: dotnet test src/Magicodes.ExporterAndImporter.Tests/Magicodes.IE.Tests.csproj -c Release --no-build -f net10.0

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,5 @@ __pycache__/
261261
*.pyc
262262
/src/Magicodes.ExporterAndImporter.Excel/Properties/PublishProfiles/FolderProfile.pubxml
263263
/global.json
264+
!/global.json
265+
/.omo/

docs/compatibility-policy.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Compatibility Policy
2+
3+
This repository keeps public API compatibility as a release constraint for the `2.x` line.
4+
5+
## Stable surface
6+
7+
- Public package names stay unchanged.
8+
- Public namespaces stay unchanged.
9+
- Public interfaces stay source-compatible unless a release note explicitly marks a major version change.
10+
- Existing overloads remain available; new behavior should be added through new overloads or new types.
11+
12+
## Allowed changes in `2.x`
13+
14+
- Internal refactoring.
15+
- Dependency upgrades that do not change the public contract.
16+
- Build and CI improvements.
17+
- New APIs that are additive.
18+
- Bug fixes behind the existing contract.
19+
20+
## Breaking changes
21+
22+
- Breaking changes are reserved for the next major version.
23+
- If a public API must change, keep a compatibility wrapper in `2.x` first and mark it obsolete before removal.
24+
25+
## Test rule
26+
27+
- Any change touching public behavior must add or update behavior tests.
28+
- CI should fail if public API drift is introduced accidentally.

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "10.0.103",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": false
6+
}
7+
}

src/Magicodes.ExporterAndImporter.Tests/Magicodes.IE.Tests.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2424
</PackageReference>
25-
<!--修复Ubuntu下dotnet test的问题,参考:https://github.com/microsoft/vstest/issues/2469 -->
26-
<!--<PackageReference Include="Microsoft.TestPlatform.ObjectModel"/>-->
27-
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
2825
<PackageReference Include="Shouldly" Version="4.0.3" />
2926
</ItemGroup>
3027

@@ -57,4 +54,4 @@
5754
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5855
</None>
5956
</ItemGroup>
60-
</Project>
57+
</Project>

0 commit comments

Comments
 (0)