From a2e27f07f44895b7218461a76d408ae1d427257b Mon Sep 17 00:00:00 2001 From: peefy Date: Tue, 9 Jul 2024 20:56:12 +0800 Subject: [PATCH] fix: dotnet lib build folder Signed-off-by: peefy --- .github/workflows/cla.yml | 38 ------------------------------ .github/workflows/dotnet-test.yaml | 18 +++++++------- .github/workflows/java-test.yaml | 2 +- README.md | 24 +++++++++---------- dotnet/README.md | 19 +++++++++++++++ 5 files changed, 41 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/cla.yml diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml deleted file mode 100644 index dd691550..00000000 --- a/.github/workflows/cla.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: "CLA Assistant" -on: - issue_comment: - types: [created] - pull_request_target: - types: [opened,closed,synchronize] -jobs: - CLAssistant: - runs-on: ubuntu-latest - steps: - - name: "CLA Assistant" - if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@v2.3.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # the below token should have repo scope and must be manually added by you in the repository's secret - PERSONAL_ACCESS_TOKEN : ${{ secrets.DEPLOY_ACCESS_TOKEN }} - with: - path-to-document: 'https://github.com/kcl-lang/.github/blob/main/CLA.md' # e.g. a CLA or a DCO document - - # branch should not be protected - lock-pullrequest-aftermerge: True - path-to-signatures: 'signatures/version1/cla.json' - remote-organization-name: kcl-lang - remote-repository-name: cla.db - branch: 'main' - allowlist: bot* - - #below are the optional inputs - If the optional inputs are not given, then default values will be taken - #remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository) - #remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository) - #create-file-commit-message: 'For example: Creating file for storing CLA Signatures' - #signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo' - #custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign' - #custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA' - #custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.' - #lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) - #use-dco-flag: true - If you are using DCO instead of CLA diff --git a/.github/workflows/dotnet-test.yaml b/.github/workflows/dotnet-test.yaml index 2dcc7db5..6fe76488 100644 --- a/.github/workflows/dotnet-test.yaml +++ b/.github/workflows/dotnet-test.yaml @@ -100,13 +100,14 @@ jobs: cargo build --release --target ${{ matrix.target }} - name: 'Upload artifact' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: kcl-lib-${{ matrix.classifier }} - path: | - target/release/${{ matrix.target }}/${{ matrix.lib-name }} + 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: @@ -127,31 +128,31 @@ jobs: components: clippy, rustfmt - name: Download windows x86_64 lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: kcl-lib-win-x64 path: KclLib/runtimes/win-x64/native - name: Download linux aarch_64 lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: kcl-lib-linux-arm64 path: KclLib/runtimes/linux-arm64/native - name: Download linux x86_64 lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: kcl-lib-linux-x64 path: KclLib/runtimes/linux-x64/native - name: Download darwin x86_64 lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: kcl-lib-osx-x64 path: KclLib/runtimes/osx-x64/native - name: Download darwin aarch_64 lib - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: kcl-lib-osx-arm64 path: KclLib/runtimes/osx-arm64/native @@ -160,6 +161,7 @@ jobs: # if: "startsWith(github.ref, 'refs/tags/')" run: | cd KclLib + tree runtimes dotnet build dotnet pack cd bin/Release diff --git a/.github/workflows/java-test.yaml b/.github/workflows/java-test.yaml index fc8e2b8f..1f4b39e6 100644 --- a/.github/workflows/java-test.yaml +++ b/.github/workflows/java-test.yaml @@ -92,7 +92,7 @@ jobs: runs-on: ubuntu-latest container: image: "kcllang/kcl-java-builder-centos7:0.1.0" - + permissions: contents: read packages: write diff --git a/README.md b/README.md index 70c13828..e47809d9 100644 --- a/README.md +++ b/README.md @@ -108,23 +108,21 @@ public class ExecProgramTest { ### .NET -This library is currently under development [here](https://github.com/kcl-lang/lib/tree/main/dotnet) +```shell +dotnet add package KclLib +``` -```csharp -namespace KclLib.Tests; +Write the code +```cs using KclLib.API; -public class KclLibAPITest -{ - public static void Main() - { - var execArgs = new ExecProgram_Args(); - execArgs.KFilenameList.Add("path/to/kcl.k"); - var result = new API().ExecProgram(execArgs); - Console.WriteLine(result.YamlResult); - } -} +var api = new API(); +var execArgs = new ExecProgram_Args(); +var path = Path.Combine("test_data", "schema.k"); +execArgs.KFilenameList.Add(path); +var result = api.ExecProgram(execArgs); +Console.WriteLine(result.YamlResult); ``` ### Python diff --git a/dotnet/README.md b/dotnet/README.md index 30f34a9e..86673735 100644 --- a/dotnet/README.md +++ b/dotnet/README.md @@ -2,6 +2,25 @@ This library is currently under development. Please check back later. +## Quick Start + +```shell +dotnet add package KclLib +``` + +Write the code + +```cs +using KclLib.API; + +var api = new API(); +var execArgs = new ExecProgram_Args(); +var path = Path.Combine("test_data", "schema.k"); +execArgs.KFilenameList.Add(path); +var result = api.ExecProgram(execArgs); +Console.WriteLine(result.YamlResult); +``` + ## Developing and Testing - Install `cargo`