Skip to content

Commit d88f27f

Browse files
committed
Merge branch 'master' of https://github.com/tadodev/EtabSharp
2 parents 846bc8d + 860ee03 commit d88f27f

76 files changed

Lines changed: 5272 additions & 236 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Trigger on version tags like v1.0.0, v0.1.0-beta
7+
8+
jobs:
9+
publish:
10+
runs-on: windows-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '10.0.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build
25+
run: dotnet build --configuration Release --no-restore
26+
27+
- name: Run tests
28+
run: dotnet test --configuration Release --no-build
29+
30+
- name: Extract version from tag
31+
id: version
32+
run: |
33+
$tag = "${{ github.ref }}" -replace "refs/tags/v", ""
34+
echo "version=$tag" >> $env:GITHUB_OUTPUT
35+
36+
# Check if it's a prerelease
37+
if ($tag -match "-") {
38+
echo "is_prerelease=true" >> $env:GITHUB_OUTPUT
39+
} else {
40+
echo "is_prerelease=false" >> $env:GITHUB_OUTPUT
41+
}
42+
43+
- name: Update project version
44+
run: |
45+
$version = "${{ steps.version.outputs.version }}"
46+
$csprojPath = "src\EtabSharp\EtabSharp.csproj"
47+
$xml = [xml](Get-Content $csprojPath)
48+
$xml.Project.PropertyGroup[0].Version = $version
49+
$xml.Save($csprojPath)
50+
51+
- name: Pack NuGet package
52+
run: dotnet pack src/EtabSharp/EtabSharp.csproj --configuration Release --output nuget
53+
54+
- name: Publish to NuGet
55+
run: dotnet nuget push "nuget\EtabSharp.${{ steps.version.outputs.version }}.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
56+
57+
- name: Create GitHub Release
58+
uses: ncipollo/release-action@v1
59+
with:
60+
artifacts: nuget/EtabSharp.${{ steps.version.outputs.version }}.nupkg
61+
token: ${{ secrets.GITHUB_TOKEN }}
62+
draft: false
63+
prerelease: ${{ steps.version.outputs.is_prerelease == 'true' }}

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master, main, develop ]
6+
pull_request:
7+
branches: [ master, main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '10.0.x'
21+
22+
- name: Restore dependencies
23+
run: dotnet restore
24+
25+
- name: Build
26+
run: dotnet build --configuration Release --no-restore
27+
28+
- name: Run tests
29+
run: dotnet test --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx"
30+
31+
- name: Upload test results
32+
if: always()
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: test-results
36+
path: '**/test-results.trx'

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
1212
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.0-rc.2.25502.107" />
1313
<PackageVersion Include="ModelContextProtocol" Version="0.4.0-preview.1" />
14+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
1415
</ItemGroup>
1516
<ItemGroup>
1617
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />

PUBLISH_GUIDE.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Publishing EtabSharp to NuGet
2+
3+
This guide explains how to publish the EtabSharp NuGet package and the CI/CD setup.
4+
5+
## Prerequisites
6+
7+
- GitHub repository with admin access
8+
- NuGet.org account (create at https://www.nuget.org/users/account/LogOn)
9+
10+
## Step 1: Create NuGet API Key
11+
12+
1. Go to https://www.nuget.org/account/apikeys
13+
2. Click **Create** to generate a new API key
14+
3. Give it a name like "EtabSharp-CI-CD" and set expiration (optional)
15+
4. Copy the generated key (you won't see it again)
16+
17+
## Step 2: Add GitHub Secret
18+
19+
1. Go to your GitHub repository: https://github.com/tadodev/EtabSharp
20+
2. Navigate to **Settings** ? **Secrets and variables** ? **Actions**
21+
3. Click **New repository secret**
22+
4. Name: `NUGET_API_KEY`
23+
5. Value: Paste the API key from Step 1
24+
6. Click **Add secret**
25+
26+
## Step 3: Create a Release
27+
28+
The CI/CD pipeline is triggered when you create a Git tag in the format `v*` (e.g., `v0.1.0-beta`, `v1.0.0`).
29+
30+
### Option A: Using Git Command Line
31+
32+
For the first beta release:
33+
```bash
34+
git tag v0.1.0-beta
35+
git push origin v0.1.0-beta
36+
```
37+
38+
For future releases:
39+
```bash
40+
git tag v1.0.0
41+
git push origin v1.0.0
42+
```
43+
44+
### Option B: Using GitHub Web Interface
45+
46+
1. Go to your repository's **Releases** page
47+
2. Click **Draft a new release**
48+
3. Tag version: Enter `v0.1.0-beta` (for first release) or `v1.0.0` for stable versions
49+
4. Release title: Enter `Release v0.1.0-beta`
50+
5. Check "Set as a pre-release" for beta/rc versions
51+
6. Add release notes describing changes
52+
7. Click **Publish release**
53+
54+
## What Happens Automatically
55+
56+
When you create a tag matching `v*`:
57+
58+
1. ? GitHub Actions checks out your code
59+
2. ? Builds the project in Release mode
60+
3. ? Runs all tests
61+
4. ? Extracts version from tag
62+
5. ? Updates the project version in `.csproj`
63+
6. ? Packs the NuGet package
64+
7. ? Publishes to NuGet.org
65+
8. ? Creates a GitHub Release (marked as prerelease for beta versions)
66+
67+
## Monitoring the Build
68+
69+
1. Go to your repository's **Actions** tab
70+
2. Select the **Publish NuGet Package** workflow
71+
3. Monitor the build progress in real-time
72+
4. View detailed logs if any step fails
73+
74+
## Versioning Strategy
75+
76+
### Semantic Versioning with Prerelease Indicators
77+
78+
- `v0.1.0-beta` - Beta release (current)
79+
- `v0.1.0-rc.1` - Release candidate
80+
- `v1.0.0` - Major version 1.0 (stable)
81+
- `v1.0.1` - Patch version (bug fixes)
82+
- `v1.1.0` - Minor version (new features)
83+
- `v2.0.0` - Major version (breaking changes)
84+
85+
The workflow automatically detects prerelease versions (containing `-`) and marks the GitHub release appropriately.
86+
87+
### Updating Release Notes
88+
89+
Update your package release notes in `src/EtabSharp/EtabSharp.csproj` before each release:
90+
91+
```xml
92+
<PackageReleaseNotes>
93+
v0.1.0-beta - Initial beta release
94+
- Added feature X
95+
- Fixed bug Y
96+
</PackageReleaseNotes>
97+
```
98+
99+
## Continuous Integration (Tests)
100+
101+
The `Tests` workflow automatically runs on:
102+
- Every push to `master`, `main`, or `develop` branches
103+
- Every pull request to these branches
104+
105+
This ensures code quality before merging or publishing.
106+
107+
## Manual Local Testing Before Publishing
108+
109+
```bash
110+
# Build the project
111+
dotnet build -c Release
112+
113+
# Run tests
114+
dotnet test -c Release
115+
116+
# Pack the NuGet package
117+
dotnet pack src/EtabSharp/EtabSharp.csproj -c Release -o ./nuget
118+
119+
# Verify the package (optional)
120+
dotnet nuget locals all --list
121+
```
122+
123+
## Troubleshooting
124+
125+
### Workflow Failed?
126+
127+
1. Check the **Actions** tab for error logs
128+
2. Common issues:
129+
- API key expired ? Generate a new one and update the secret
130+
- Tests failed ? Fix the issues and push new code
131+
- ETABSv1.dll not found ? This is expected in CI (mock it in tests)
132+
133+
### Package Not on NuGet?
134+
135+
- Check https://www.nuget.org/packages/EtabSharp/
136+
- It may take a few minutes to appear after publishing
137+
- Beta versions will show under "Pre-release versions"
138+
- Verify via: `dotnet package search EtabSharp --prerelease`
139+
140+
## Using Your Published Package
141+
142+
Once published, install the beta version:
143+
144+
```bash
145+
dotnet add package EtabSharp --version 0.1.0-beta
146+
```
147+
148+
Or in `.csproj`:
149+
150+
```xml
151+
<PackageReference Include="EtabSharp" Version="0.1.0-beta" />
152+
```
153+
154+
For future stable releases:
155+
```bash
156+
dotnet add package EtabSharp --version 1.0.0
157+
```
158+
159+
## Additional Resources
160+
161+
- [NuGet.org Policies](https://learn.microsoft.com/en-us/nuget/policies/policy-faq)
162+
- [Semantic Versioning](https://semver.org/)
163+
- [GitHub Actions Documentation](https://docs.github.com/actions)
164+
- [NuGet Package Best Practices](https://learn.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices)

PUBLISH_QUICK_START.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Quick Start: Publishing Your Package
2+
3+
## One-Time Setup (5 minutes)
4+
5+
1. **Create NuGet API key**: https://www.nuget.org/account/apikeys
6+
2. **Add GitHub Secret**:
7+
- Go to: Settings ? Secrets and variables ? Actions
8+
- Add secret `NUGET_API_KEY` with your NuGet API key
9+
10+
## First Release: v0.1.0-beta (30 seconds)
11+
12+
### Using GitHub Web UI
13+
1. Go to Releases ? Draft a new release
14+
2. Tag: `v0.1.0-beta`
15+
3. Title: `Release v0.1.0-beta`
16+
4. Check "Set as a pre-release"
17+
5. Click "Publish release"
18+
19+
### Using Command Line
20+
```bash
21+
git tag v0.1.0-beta
22+
git push origin v0.1.0-beta
23+
```
24+
25+
That's it! The CI/CD pipeline will:
26+
- ? Build your project
27+
- ? Run tests
28+
- ? Publish to NuGet.org automatically
29+
- ? Mark as prerelease on GitHub
30+
31+
## Future Releases
32+
33+
After beta testing, increment the version:
34+
- `v1.0.0` for stable release
35+
- `v1.0.1` for patch fixes
36+
- `v1.1.0` for new features
37+
38+
Update the version in `src/EtabSharp/EtabSharp.csproj` before creating the tag.
39+
40+
## Check Status
41+
- Actions tab ? Publish NuGet Package workflow ? View logs
42+
43+
---
44+
45+
**Full Guide**: See `PUBLISH_GUIDE.md` for detailed instructions

src/EtabSharp/AnalysisResults/AnalysisResultsManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace EtabSharp.AnalysisResults;
1010
/// Implements the IAnalysisResults interface by wrapping cSapModel.Results operations.
1111
/// This is a partial class with implementations split across multiple files by result type.
1212
/// </summary>
13-
public partial class AnalysisResultsManager: IAnalysisResults
13+
public partial class AnalysisResultsManager : IAnalysisResults
1414
{
1515
private readonly cSapModel _sapModel;
1616
private readonly ILogger _logger;

src/EtabSharp/Analyzes/AnalyzeManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace EtabSharp.Analyzes;
1010
/// Manages analysis operations in the ETABS model.
1111
/// Implements the IAnalyze interface by wrapping cSapModel.Analyze operations.
1212
/// </summary>
13-
public class AnalyzeManager: IAnalyze
13+
public class AnalyzeManager : IAnalyze
1414
{
1515
private readonly cSapModel _sapModel;
1616
private readonly ILogger _logger;

src/EtabSharp/Analyzes/Models/SolverType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ public enum SolverType
1111
Advanced = 1,
1212
/// <summary>Multi-threaded solver</summary>
1313
MultiThreaded = 2
14-
}
14+
}

0 commit comments

Comments
 (0)