Skip to content

chore(deps): bump actions/setup-dotnet from 5 to 6 #567

chore(deps): bump actions/setup-dotnet from 5 to 6

chore(deps): bump actions/setup-dotnet from 5 to 6 #567

Workflow file for this run

name: dotnet-test
on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
branches:
- main
paths:
- "dotnet/**"
# The consistency runner reads this shared manifest, so a golden-only
# change must re-run this workflow.
- "tests/consistency/**"
- ".github/workflows/dotnet-test.yaml"
workflow_dispatch:
jobs:
build-and-test:
name: "Test .NET Library of KCL on ${{ matrix.os }} for the classifier ${{ matrix.classifier }}"
defaults:
run:
working-directory: "dotnet"
strategy:
fail-fast: false
matrix:
include:
- build: linux-x64-release
os: ubuntu-latest
config: release
classifier: linux-x64
target: x86_64-unknown-linux-gnu
dotnet-version: '8.0.x'
lib-name: libkcl_lib_dotnet.so
- build: linux-arm64-release
os: ubuntu-latest
config: release
classifier: linux-arm64
target: aarch64-unknown-linux-gnu
dotnet-version: '8.0.x'
lib-name: libkcl_lib_dotnet.so
- build: macos-x64-release
os: macos-latest
config: release
classifier: osx-x64
target: x86_64-apple-darwin
dotnet-version: '8.0.x'
lib-name: libkcl_lib_dotnet.dylib
- build: macos-arm64-release
os: macos-latest
config: release
classifier: osx-arm64
target: aarch64-apple-darwin
dotnet-version: '8.0.x'
lib-name: libkcl_lib_dotnet.dylib
- build: windows-release
os: windows-latest
config: release
classifier: win-x64
target: x86_64-pc-windows-msvc
dotnet-version: '8.0.x'
lib-name: kcl_lib_dotnet.dll
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.91
override: true
components: clippy, rustfmt
- name: Setup linux-aarch_64 rust target
if: "contains(matrix.classifier, 'linux-arm64')"
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# Setup for cargo
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build KCL Library
run: |
cargo build --release
- name: Clear package cache
run: dotnet clean KclLib.sln && dotnet nuget locals all --clear
# KclTool is intentionally excluded here: it PackageReferences the
# KclTool.runtime.* packages, which only exist on NuGet.org after a
# publish-kcltool release, so restoring the full solution fails on PRs.
# KclLib.Tests references KclLib, so restoring/building it covers the lib.
- name: Restore packages
run: |
dotnet restore KclLib/KclLib.csproj
dotnet restore KclLib.Tests/KclLib.Tests.csproj
- name: Build
run: dotnet build KclLib.Tests/KclLib.Tests.csproj -c ${{ matrix.config }} --no-restore
- name: Test
run: dotnet test KclLib.Tests/KclLib.Tests.csproj -c ${{ matrix.config }} --no-restore
- name: Create package
run: |
cd KclLib
dotnet pack -c ${{ matrix.config }}
- name: Build Native Release Library
run: |
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
- name: 'Upload artifact'
uses: actions/upload-artifact@v7
with:
name: kcl-lib-${{ matrix.classifier }}
if-no-files-found: error
path: ${{ github.workspace }}/dotnet/target/${{ matrix.target }}/release/${{ matrix.lib-name }}
deploy:
name: Deploy KCL .NET Library to Nuget
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [ build-and-test ]
steps:
- name: Checkout
uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: '8.0.x'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.91
override: true
components: clippy, rustfmt
- name: Download windows x86_64 lib
uses: actions/download-artifact@v8
with:
name: kcl-lib-win-x64
path: dotnet/KclLib/runtimes/win-x64/native
- name: Download linux aarch_64 lib
uses: actions/download-artifact@v8
with:
name: kcl-lib-linux-arm64
path: dotnet/KclLib/runtimes/linux-arm64/native
- name: Download linux x86_64 lib
uses: actions/download-artifact@v8
with:
name: kcl-lib-linux-x64
path: dotnet/KclLib/runtimes/linux-x64/native
- name: Download darwin x86_64 lib
uses: actions/download-artifact@v8
with:
name: kcl-lib-osx-x64
path: dotnet/KclLib/runtimes/osx-x64/native
- name: Download darwin aarch_64 lib
uses: actions/download-artifact@v8
with:
name: kcl-lib-osx-arm64
path: dotnet/KclLib/runtimes/osx-arm64/native
- name: Create package
run: |
cd dotnet/KclLib
tree runtimes
dotnet build
dotnet pack
- uses: actions/upload-artifact@v7
with:
name: KCL .NET Nuget Package
path: |
dotnet/KclLib/bin/Release/*.nupkg
dotnet/KclLib/bin/Release/*.snupkg
- name: Release to Nuget
if: "startsWith(github.ref, 'refs/tags/')"
run: |
cd dotnet/KclLib/bin/Release
dotnet nuget push KclLib.0.13.0.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json