Skip to content

Commit 813817b

Browse files
authored
Merge pull request #1 from Apibim-com/feature/nuget_and_ci
Main Fixes
2 parents e4f0cde + 17a3f03 commit 813817b

20 files changed

Lines changed: 310 additions & 179 deletions

.claude/settings.local.json

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

.github/workflows/cd.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CD
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
6+
- "v*.*.*"
77

88
jobs:
99
pack-and-publish:
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
configuration: [R2021, R2022, R2023, R2024, R2025, R2026]
15+
configuration: [R2020, R2021, R2022, R2023, R2024, R2025, R2026, R2027]
1616

1717
steps:
1818
- name: Checkout
@@ -21,18 +21,16 @@ jobs:
2121
- name: Setup .NET
2222
uses: actions/setup-dotnet@v4
2323
with:
24-
dotnet-version: |
25-
8.0.x
26-
4.8.x
24+
dotnet-version: 8.0.x
2725

2826
- name: Restore
29-
run: dotnet restore source/Apibim.Revit.Extensions/Apibim.Revit.Extensions.csproj -c ${{ matrix.configuration }}
27+
run: dotnet restore Revit.Extensions/Revit.Extensions.csproj -p:Configuration=${{ matrix.configuration }}
3028

3129
- name: Build
32-
run: dotnet build source/Apibim.Revit.Extensions/Apibim.Revit.Extensions.csproj -c ${{ matrix.configuration }} --no-restore
30+
run: dotnet build Revit.Extensions/Revit.Extensions.csproj -p:Configuration=${{ matrix.configuration }} --no-restore
3331

3432
- name: Pack
35-
run: dotnet pack source/Apibim.Revit.Extensions/Apibim.Revit.Extensions.csproj -c ${{ matrix.configuration }} --no-build --output ./nupkgs
33+
run: dotnet pack Revit.Extensions/Revit.Extensions.csproj -p:Configuration=${{ matrix.configuration }} --no-build --output ./nupkgs
3634

3735
- name: Push to NuGet
3836
run: dotnet nuget push "./nupkgs/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

.github/workflows/ci.yml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
10-
build:
10+
build-and-test:
11+
name: Revit ${{ matrix.revit }}
1112
runs-on: windows-latest
1213

14+
permissions:
15+
checks: write
16+
contents: read
17+
1318
strategy:
1419
fail-fast: false
1520
matrix:
16-
configuration: [R2021, R2022, R2023, R2024, R2025, R2026]
21+
revit: [2020, 2021, 2022, 2023, 2024, 2025, 2026]
1722

1823
steps:
1924
- name: Checkout
@@ -22,38 +27,32 @@ jobs:
2227
- name: Setup .NET
2328
uses: actions/setup-dotnet@v4
2429
with:
25-
dotnet-version: |
26-
8.0.x
27-
4.8.x
30+
dotnet-version: 8.0.x
2831

2932
- name: Restore
30-
run: dotnet restore source/Apibim.Revit.Extensions/Apibim.Revit.Extensions.csproj -c ${{ matrix.configuration }}
33+
run: dotnet restore Revit.Extensions.Tests/Revit.Extensions.Tests.csproj -p:Configuration=R${{ matrix.revit }}
3134

3235
- name: Build
33-
run: dotnet build source/Apibim.Revit.Extensions/Apibim.Revit.Extensions.csproj -c ${{ matrix.configuration }} --no-restore
34-
35-
test:
36-
runs-on: windows-latest
37-
needs: build
36+
run: dotnet build Revit.Extensions.Tests/Revit.Extensions.Tests.csproj -p:Configuration=R${{ matrix.revit }} --no-restore
3837

39-
steps:
40-
- name: Checkout
41-
uses: actions/checkout@v4
38+
- name: Run tests
39+
run: >
40+
dotnet test "Revit.Extensions.Tests/bin/R${{ matrix.revit }}/Revit.Extensions.Tests.dll"
41+
--logger "trx;LogFileName=results.trx"
42+
--results-directory "${{ github.workspace }}/TestResults/${{ matrix.revit }}"
4243
43-
- name: Setup .NET
44-
uses: actions/setup-dotnet@v4
44+
- name: Publish test results
45+
uses: dorny/test-reporter@v1
46+
if: always()
4547
with:
46-
dotnet-version: 8.0.x
47-
48-
- name: Restore
49-
run: dotnet restore tests/Apibim.Revit.Extensions.Tests/Apibim.Revit.Extensions.Tests.csproj -c R2025
50-
51-
- name: Test
52-
run: dotnet test tests/Apibim.Revit.Extensions.Tests/Apibim.Revit.Extensions.Tests.csproj -c R2025 --no-restore --logger "trx;LogFileName=test-results.trx"
48+
name: Tests – Revit ${{ matrix.revit }}
49+
path: "TestResults/${{ matrix.revit }}/results.trx"
50+
reporter: dotnet-trx
5351

54-
- name: Upload test results
52+
- name: Upload test artifact
5553
uses: actions/upload-artifact@v4
5654
if: always()
5755
with:
58-
name: test-results
59-
path: "**/TestResults/*.trx"
56+
name: test-results-${{ matrix.revit }}
57+
path: "TestResults/${{ matrix.revit }}/results.trx"
58+
if-no-files-found: warn

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ packages/
2222
.DS_Store
2323
Thumbs.db
2424

25+
## Claude Code
26+
.claude/
27+
2528
## Test results
2629
TestResults/
2730
*.trx

Apibim.Revit.Extensions.sln

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

Build.props

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
3-
<!-- Определение всех конфигураций Revit -->
43
<PropertyGroup>
5-
<Configurations>R2019;R2020;R2021;R2022;R2023;R2024;R2025;R2026;R2027</Configurations>
4+
<Configurations>R2020;R2021;R2022;R2023;R2024;R2025;R2026;R2027</Configurations>
65
<Platforms>AnyCPU</Platforms>
76
</PropertyGroup>
8-
<!-- Определение версии Revit и TargetFramework -->
9-
<PropertyGroup Condition="'$(Configuration)' == 'R2019'">
10-
<RevitVersion>2019</RevitVersion>
11-
<TargetFramework>net47</TargetFramework>
12-
</PropertyGroup>
137
<PropertyGroup Condition="'$(Configuration)' == 'R2020'">
148
<RevitVersion>2020</RevitVersion>
159
<TargetFramework>net47</TargetFramework>
@@ -43,13 +37,11 @@
4337
<TargetFramework>net8.0-windows</TargetFramework>
4438
</PropertyGroup>
4539

46-
<!-- OutputPath и DefineConstants -->
4740
<PropertyGroup Condition="'$(RevitVersion)' != ''">
4841
<OutputPath>bin\$(Configuration)\</OutputPath>
4942
<DefineConstants>DEBUG;$(Configuration);REVIT_$(RevitVersion)</DefineConstants>
5043
</PropertyGroup>
5144

52-
<!-- Общие свойства -->
5345
<PropertyGroup>
5446
<PlatformTarget>x64</PlatformTarget>
5547
<LangVersion>default</LangVersion>
@@ -65,14 +57,9 @@
6557
</PropertyGroup>
6658

6759
<ItemGroup>
68-
<PackageReference
69-
Condition="'$(Configuration)' == 'R$(RevitVersion)'"
70-
Include="Revit_All_Main_Versions_API_x64"
71-
Version="$(RevitVersion).*"
72-
IncludeAssets="build; compile"/>
60+
<PackageReference Condition="'$(Configuration)' == 'R$(RevitVersion)'" Include="Revit_All_Main_Versions_API_x64" Version="$(RevitVersion).*" IncludeAssets="build; compile"/>
7361
</ItemGroup>
7462

75-
<!-- Общие ссылки .NET -->
7663
<ItemGroup>
7764
<Reference Include="PresentationCore"/>
7865
<Reference Include="PresentationFramework"/>

CLAUDE.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
# Apibim.Revit.Extensions — Developer Guide
1+
# Revit.Extensions — Developer Guide
22

33
## Project overview
44

55
Open-source library of Revit API extension methods, designed to support all Revit versions from 2019 to 2027.
6-
Published as a NuGet package: `Apibim.Revit.Extensions`.
6+
Published as a NuGet package: `Revit.Extensions`.
77

88
## Repository structure
99

1010
```
11-
Apibim.Revit.Extensions/
11+
Revit.Extensions/
1212
├── .github/workflows/
1313
│ ├── ci.yml ← Build + test on every push / PR
1414
│ └── cd.yml ← Pack + publish NuGet on tag v*.*.*
15-
├── source/
16-
│ └── Apibim.Revit.Extensions/
17-
│ ├── Apibim.Revit.Extensions.csproj
15+
├── Revit.Extensions/
16+
│ ├── Revit.Extensions.csproj
1817
│ └── Extensions/
1918
│ ├── ElementExtensions.cs
2019
│ ├── GeometryExtensions.cs
2120
│ ├── PointExtensions.cs
2221
│ ├── DocumentExtensions.cs
2322
│ └── AsyncTasksExecutor.cs
24-
├── tests/
25-
│ └── Apibim.Revit.Extensions.Tests/
26-
│ ├── Apibim.Revit.Extensions.Tests.csproj
23+
├── Revit.Extensions.Tests/
24+
│ ├── Revit.Extensions.Tests.csproj
2725
│ └── Extensions/
2826
│ ├── GeometryExtensionsTests.cs
2927
│ ├── AsyncTasksExecutorTests.cs
@@ -32,14 +30,13 @@ Apibim.Revit.Extensions/
3230
├── Directory.Build.props ← Imports Build.props; sets Nullable/ImplicitUsings/LangVersion
3331
├── nuget.config
3432
├── .gitignore
35-
└── Apibim.Revit.Extensions.sln
33+
└── Revit.Extensions.sln
3634
```
3735

3836
## Build configurations
3937

4038
| Configuration | Revit | TargetFramework |
4139
|---------------|-------|-----------------|
42-
| R2019 | 2019 | net47 |
4340
| R2020 | 2020 | net47 |
4441
| R2021 | 2021 | net48 |
4542
| R2022 | 2022 | net48 |
@@ -55,23 +52,20 @@ Each configuration sets `REVIT_<year>` as a compile-time constant (e.g. `REVIT_2
5552

5653
```bash
5754
# Build for a specific Revit version
58-
dotnet build source/Apibim.Revit.Extensions -c R2026
55+
dotnet build source/Revit.Extensions -c R2026
5956

6057
# Build all versions (PowerShell)
6158
foreach ($c in @("R2021","R2022","R2023","R2024","R2025","R2026")) {
62-
dotnet build source/Apibim.Revit.Extensions -c $c
59+
dotnet build source/Revit.Extensions -c $c
6360
}
6461

65-
# Run tests (always with R2025 — only version that works headless)
66-
dotnet test tests/Apibim.Revit.Extensions.Tests -c R2025
67-
6862
# Create NuGet package
69-
dotnet pack source/Apibim.Revit.Extensions -c R2026 --output ./nupkgs
63+
dotnet pack source/Revit.Extensions -c R2026 --output ./nupkgs
7064
```
7165

7266
## NuGet package
7367

74-
- **PackageId:** `Apibim.Revit.Extensions`
68+
- **PackageId:** `Revit.Extensions`
7569
- **Version scheme:** `{RevitYear}.0.{patch}` → e.g. `2026.0.1`
7670
- **Trigger CD:** push a tag matching `v*.*.*``git tag v2026.0.1 && git push --tags`
7771
- **Secret required:** `NUGET_API_KEY` in GitHub repository secrets
@@ -91,10 +85,10 @@ Example in `PointExtensions.cs`:
9185

9286
## Adding new extensions
9387

94-
1. Create `source/Apibim.Revit.Extensions/Extensions/MyExtensions.cs`
95-
2. Use `namespace Apibim.Revit.Extensions;`
88+
1. Create `Revit.Extensions/Extensions/MyExtensions.cs`
89+
2. Use `namespace Revit.Extensions;`
9690
3. Mark class `public static`
97-
4. Add unit tests in `tests/.../Extensions/MyExtensionsTests.cs`
91+
4. Add unit tests in `Revit.Extensions.Tests/Extensions/MyExtensionsTests.cs`
9892

9993
## Notes
10094

0 commit comments

Comments
 (0)