Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 36 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI Build

concurrency:
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
push:
branches:
Expand All @@ -14,23 +18,50 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Linter
run: >
DOCKER_BUILDKIT=1 docker build
--target=linter
--progress=plain
.
test:

test_and_coverage:
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Test
uses: actions/checkout@v4
- name: Test and collect coverage
continue-on-error: true
run: >
DOCKER_BUILDKIT=1 docker build
--target=test
--target=coverage_export
--output type=local,dest=coverage
--build-arg KEY=${{ secrets.KEY }}
--build-arg SECRET=${{ secrets.SECRET }}
--build-arg CONDUCTOR_SERVER_URL=${{ secrets.CONDUCTOR_SERVER_URL }}
.

- name: Upload Cobertura artifact
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v4
with:
name: cobertura
path: coverage/out/coverage.cobertura.xml

- name: Ensure coverage file exists
run: |
mkdir -p coverage
if [ ! -f coverage/out/coverage.cobertura.xml ]; then
echo '<coverage></coverage>' > coverage/out/coverage.cobertura.xml
fi

- name: Codecov upload
if: ${{ !env.ACT }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/out/coverage.cobertura.xml
flags: unittests
name: ${{ github.workflow }}-${{ github.job }}-${{ github.run_number }}
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,37 @@ RUN dotnet format --verify-no-changes *.csproj
FROM csharp-sdk AS build
RUN dotnet build *.csproj

FROM build as test
FROM build AS test
ARG KEY
ARG SECRET
ARG CONDUCTOR_SERVER_URL
ENV CONDUCTOR_AUTH_KEY=${KEY}
ENV CONDUCTOR_AUTH_SECRET=${SECRET}
ENV CONDUCTOR_SERVER_URL=${CONDUCTOR_SERVER_URL}

COPY /csharp-examples /package/csharp-examples
COPY /Tests /package/Tests
COPY /Tests /package/Tests
WORKDIR /package/Tests
RUN dotnet test -p:DefineConstants=EXCLUDE_EXAMPLE_WORKERS -l "console;verbosity=normal"
RUN dotnet test -p:DefineConstants=EXCLUDE_EXAMPLE_WORKERS \
--collect:"XPlat Code Coverage" \
-l "console;verbosity=normal" \
|| true

FROM test AS coverage_export
RUN mkdir /out \
&& cp $(find /package/Tests/TestResults -name 'coverage.cobertura.xml' | head -n 1) \
/out/coverage.cobertura.xml

FROM build as pack_release
FROM build AS pack_release
ARG SDK_VERSION
RUN dotnet pack "conductor-csharp.csproj" \
RUN dotnet pack conductor-csharp.csproj \
-o /build \
--include-symbols \
--include-source \
-c Release "/p:Version=${SDK_VERSION}"
-c Release \
"/p:Version=${SDK_VERSION}"

FROM pack_release as publish_release
FROM pack_release AS publish_release
ARG NUGET_SRC
ARG NUGET_API_KEY
RUN dotnet nuget push "/build/*.symbols.nupkg" \
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Conductor OSS C# SDK

[![CI](https://github.com/conductor-oss/csharp-sdk/actions/workflows/pull_request.yml/badge.svg)](https://github.com/conductor-oss/csharp-sdk/actions)
[![Coverage](https://codecov.io/gh/conductor-oss/csharp-sdk/branch/main/graph/badge.svg?token=AXNN6NU99Y)](https://codecov.io/gh/conductor-oss/csharp-sdk)

The conductor-csharp repository provides the client SDKs to build task workers in C#.

Building the task workers in C# mainly consists of the following steps:
Expand Down
4 changes: 4 additions & 0 deletions Tests/conductor-csharp.test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="xunit" Version="2.4.2" />
Expand Down