Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(csharp): Update CI workflow inside C# SDK generator #5283

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions fern/pages/changelogs/csharp-sdk/2024-11-26.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 1.9.12
**`(feat):`** Optimize the GitHub Actions workflow and update its dependencies.
- Merge build, test, and publish into a single job to avoid redoing the same work three times.
- Break up the job into more steps to make it clearer where errors occur.
- Update GitHub Actions actions to the latest version.
- Using the .NET 9 SDK for building, testing, and publishing.
- Reduce irrelevant logs.


76 changes: 28 additions & 48 deletions generators/csharp/codegen/src/asIs/github-ci.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,50 @@
name: ci
name: CI

on: [push]

env:
CI: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
MSBUILDTERMINALLOGGER: off

jobs:
compile:
CI:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: actions/checkout@master
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x

- name: Install tools
run: |
dotnet tool restore

- name: Build Release
run: dotnet build src -c Release /p:ContinuousIntegrationBuild=true
dotnet-version: |
9.x
8.x

unit-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: actions/checkout@master

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.x
- name: List SDKs
run: dotnet --list-sdks

- name: Install tools
run: |
dotnet tool restore
run: dotnet tool restore

- name: Run Tests
run: |
dotnet test src
- name: Restore dependencies
run: dotnet restore src

<% if (shouldWritePublishBlock) { %>
publish:
needs: [compile]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.x
- name: Build release
id: build
run: dotnet build src -c Release /p:ContinuousIntegrationBuild=true

- name: Publish
- name: Run tests
run: dotnet test src --no-restore --no-build -c Release /p:ContinuousIntegrationBuild=true
continue-on-error: true
<% if (shouldWritePublishBlock) { %>
- name: Publish to nuget.org
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') && steps.build.outcome == 'success'
env:
NUGET_API_KEY: $\{{ secrets.<%= nugetTokenEnvvar%> }}
run: |
dotnet pack src -c Release
dotnet pack src/<%= projectName%> --no-build --no-restore -c Release
dotnet nuget push src/<%= projectName%>/bin/Release/*.nupkg --api-key $NUGET_API_KEY --source "nuget.org"
<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
Expand Down
13 changes: 13 additions & 0 deletions generators/csharp/sdk/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
# The C# SDK now uses forward-compatible enums which are not compatible with the previously generated enums.
# Set `enable-forward-compatible-enums` to `false` in the configuration to generate the old enums.
# irVersion: 53
- version: 1.9.12
createdAt: "2024-11-26"
changelogEntry:
- type: feat
summary: |
Optimize the GitHub Actions workflow and update its dependencies.
- Merge build, test, and publish into a single job to avoid redoing the same work three times.
- Break up the job into more steps to make it clearer where errors occur.
- Update GitHub Actions actions to the latest version.
- Using the .NET 9 SDK for building, testing, and publishing.
This won't affect the TFM outputs, and tests still execute on .NET 8 runtime.
- Reduce irrelevant logs.
irVersion: 53
- version: 1.9.11
createdAt: "2024-11-25"
changelogEntry:
Expand Down
74 changes: 27 additions & 47 deletions seed/csharp-model/alias-extends/.github/workflows/ci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions seed/csharp-model/alias-extends/src/SeedAliasExtends.sln

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 27 additions & 47 deletions seed/csharp-model/alias/.github/workflows/ci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading