diff --git a/.github/workflows/daily-release.yaml b/.github/workflows/daily-release.yaml deleted file mode 100644 index 1320471bc..000000000 --- a/.github/workflows/daily-release.yaml +++ /dev/null @@ -1,134 +0,0 @@ -name: Daily Release CI - -on: - schedule: - - cron: '0 0 * * *' - -permissions: - contents: write - -jobs: - macos-release: - name: Build and release on macos - runs-on: macos-11 - steps: - - name: Git checkout - uses: actions/checkout@v2 - with: - submodules: "true" - - - run: clang --version - - run: cargo --version - - run: rustc --print sysroot - - - name: Delete rust cargo - run: rm -rf /root/.cargo/bin - shell: bash - - name: Install LLVM 12 - run: brew install llvm@12 - shell: bash - - name: Install rust nightly toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.76 - override: true - components: clippy, rustfmt - - - name: Build KCL - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin:/usr/local/opt/llvm@12/bin && make build - shell: bash - - - uses: actions/upload-artifact@v3 - with: - name: kcl-darwin-amd64-nightly - path: _build/dist/Darwin/kclvm - - linux-release: - name: Build and release on linux - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 - with: - submodules: "true" - - # Prerequisite - - - name: Install LLVM - shell: bash - run: | - sudo apt-get update - sudo apt-get install -y git wget curl make - sudo apt-get install -y clang-12 lld-12 - sudo ln -sf /usr/bin/clang-12 /usr/bin/clang - - name: Install Rust Toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.76 - override: true - components: clippy, rustfmt - - - name: Build KCL - run: make build - shell: bash - - - uses: actions/upload-artifact@v3 - with: - name: kcl-linux-amd64-nightly - path: _build/dist/ubuntu/kclvm - - - name: Copy Dockerfile to the current work directory - run: cp scripts/docker/kcl/Dockerfile . - shell: bash - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: kcllang/kclvm - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - windows-release: - name: Build and release on windows - runs-on: windows-latest - env: - LLVM_SYS_120_PREFIX: "C:/LLVM" - KCLVM_CLANG: "C:/LLVM/bin/clang.exe" - steps: - - name: Git checkout - uses: actions/checkout@v2 - with: - submodules: "true" - - - uses: ilammy/msvc-dev-cmd@v1 - - - run: clang --version - - run: cargo --version - - # Install LLVM-12 - - run: Invoke-WebRequest -Uri https://github.com/kcl-lang/llvm-package-windows/releases/download/v12.0.1/LLVM-12.0.1-win64.7z -OutFile C:/LLVM-12.0.1-win64.7z - - run: Get-FileHash -Algorithm MD5 C:/LLVM-12.0.1-win64.7z # md5: 3fcf77f82c6c3ee650711439b20aebe5 - - run: 7z x -y C:/LLVM-12.0.1-win64.7z -o"C:/LLVM" - - run: Remove-Item C:/LLVM-12.0.1-win64.7z - - - run: echo "C:/LLVM/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - run: .\scripts\build-windows\build.ps1 - - - run: echo ";$(pwd)\scripts\build-windows\_output\kclvm-windows\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - working-directory: . - - - uses: actions/upload-artifact@v3 - with: - name: kcl-windows-nightly - path: scripts/build-windows/_output/kclvm-windows diff --git a/kclvm/runtime/src/value/val_plan.rs b/kclvm/runtime/src/value/val_plan.rs index 6d6f3d90d..b743586af 100644 --- a/kclvm/runtime/src/value/val_plan.rs +++ b/kclvm/runtime/src/value/val_plan.rs @@ -352,43 +352,65 @@ mod test_value_plan { config.dict_update_key_value("_hidden", ValueRef::int(1)); config.dict_update_key_value("vec", ValueRef::list(None)); config.dict_update_key_value("empty", ValueRef::none()); - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!(json_string, "{\"data\": {}, \"vec\": [], \"empty\": null}"); assert_eq!(yaml_string, "data: {}\nvec: []\nempty: null"); ctx.plan_opts.include_schema_type_path = true; - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!( + json_string, + "{\"data\": {\"_type\": \"__main__.Data\"}, \"vec\": [], \"empty\": null}" + ); assert_eq!( yaml_string, "data:\n _type: __main__.Data\nvec: []\nempty: null" ); ctx.plan_opts.show_hidden = true; - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!( + json_string, + "{\"data\": {\"_type\": \"__main__.Data\"}, \"_hidden\": 1, \"vec\": [], \"empty\": null}" + ); assert_eq!( yaml_string, "data:\n _type: __main__.Data\n_hidden: 1\nvec: []\nempty: null" ); ctx.plan_opts.sort_keys = true; - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!( + json_string, + "{\"_hidden\": 1, \"data\": {\"_type\": \"__main__.Data\"}, \"empty\": null, \"vec\": []}" + ); assert_eq!( yaml_string, "_hidden: 1\ndata:\n _type: __main__.Data\nempty: null\nvec: []" ); ctx.plan_opts.disable_none = true; - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!( + json_string, + "{\"_hidden\": 1, \"data\": {\"_type\": \"__main__.Data\"}, \"vec\": []}" + ); assert_eq!( yaml_string, "_hidden: 1\ndata:\n _type: __main__.Data\nvec: []" ); ctx.plan_opts.disable_empty_list = true; - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!( + json_string, + "{\"_hidden\": 1, \"data\": {\"_type\": \"__main__.Data\"}}" + ); assert_eq!(yaml_string, "_hidden: 1\ndata:\n _type: __main__.Data"); ctx.plan_opts.query_paths = vec!["data".to_string()]; - let (_, yaml_string) = config.plan(&ctx); + let (json_string, yaml_string) = config.plan(&ctx); + assert_eq!(json_string, "{}"); assert_eq!(yaml_string, "{}"); } }