diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 261cc0b..147b379 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ on: - main jobs: - Test: + test: name: Unit tests with coverage runs-on: ubuntu-latest steps: @@ -41,7 +41,7 @@ jobs: with: path-to-profile: coverage.out - build_image: + build-image: name: build image runs-on: ubuntu-latest steps: diff --git a/.github/workflows/example-e2e-tests.yaml b/.github/workflows/example-e2e-tests.yaml index 1fd8ad3..4eaf326 100644 --- a/.github/workflows/example-e2e-tests.yaml +++ b/.github/workflows/example-e2e-tests.yaml @@ -69,3 +69,30 @@ jobs: scoop install kcl-lang/kcl kcl.exe .\examples\kubernetes.k .\examples\test.ps1 + + musl: + runs-on: ubuntu-latest + container: golang:1.24-alpine + steps: + - name: Git checkout + uses: actions/checkout@v6 + + - name: Install musl dependencies (Alpine container) + run: | + apk add --no-cache \ + musl-dev \ + gcc \ + git \ + make \ + linux-headers + + - name: KCL Installation + run: | + CGO_ENABLED=1 go build -tags="musl netgo static osusergo" -ldflags="-linkmode external -extldflags '-static'" ./cmd/kcl + mkdir -p $HOME/go/bin + cp -f ./kcl $HOME/go/bin + env: + CGO_LDFLAGS: '-static' + + - name: e2e tests + run: PATH=$PATH:$HOME/go/bin kcl ./examples/kubernetes.k diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index aa2e92f..f2ecd6a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -80,3 +80,67 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.DEPLOY_ACCESS_TOKEN }} + + musl-binary: + needs: binary + runs-on: ubuntu-latest + container: golang:1.24-alpine + steps: + - name: Git checkout + uses: actions/checkout@v6 + + - name: Install musl dependencies (Alpine container) + run: | + apk add --no-cache \ + musl-dev \ + gcc \ + git \ + make \ + linux-headers \ + tar + + - name: Compile KCL (musl static build) + run: | + CGO_ENABLED=1 go build -tags="musl netgo static osusergo" -ldflags="-linkmode external -extldflags '-static'" ./cmd/kcl + env: + CGO_LDFLAGS: '-static' + + - name: Package musl binary with docs + run: | + TAG_NAME=${{ github.ref_name }} + mkdir -p kcl-musl-package + cp -f ./kcl ./kcl-musl-package/ + cp -f ./README.md ./kcl-musl-package/ + cp -f ./LICENSE ./kcl-musl-package/ + tar -czf kcl-${TAG_NAME}-linux-musl-amd64.tar.gz -C kcl-musl-package . + ls -lh kcl-${TAG_NAME}-linux-musl-amd64.tar.gz + echo "PACKAGE_NAME=kcl-${TAG_NAME}-linux-musl-amd64.tar.gz" >> $GITHUB_ENV + + - name: Upload musl package to Artifact + uses: actions/upload-artifact@v4 + with: + name: kcl-musl-package + path: ./${{ env.PACKAGE_NAME }} + retention-days: 7 + + upload-musl-to-release: + needs: [binary, musl-binary] + runs-on: ubuntu-latest + steps: + - name: Download musl package from Artifact + uses: actions/download-artifact@v4 + with: + name: kcl-musl-package + path: ./ + + - name: Install GitHub CLI + run: | + sudo apt update && sudo apt install -y gh + + - name: Upload to GitHub Release + run: | + echo "${{ secrets.DEPLOY_ACCESS_TOKEN }}" | gh auth login --with-token + PACKAGE_NAME=$(ls ./kcl-*.tar.gz) + gh release upload "${{ github.ref_name }}" "${PACKAGE_NAME}" --clobber + env: + GITHUB_API_URL: https://api.github.com diff --git a/README-zh.md b/README-zh.md index 9438ce0..b33c28b 100644 --- a/README-zh.md +++ b/README-zh.md @@ -80,8 +80,11 @@ export PATH=$KCL_INSTALLATION_PATH:$PATH ### 从源代码构建 ```shell -git clone https://github.com/kcl-lang/cli -cd cli && go build ./cmd/kcl/main.go -o kcl +git clone https://github.com/kcl-lang/cli && cd cli +# On Windows, MacOS and Linux +go build ./cmd/kcl/ +# Build on Linux Musl +CGO_ENABLED=1 go build -tags="musl netgo static osusergo" -ldflags="-linkmode external -extldflags '-static'" ./cmd/kcl ``` 请使用以下命令以确保您成功安装了 `kcl`。 diff --git a/README.md b/README.md index 6e878f7..aa33a64 100644 --- a/README.md +++ b/README.md @@ -93,8 +93,11 @@ docker run -it kcllang/kcl-arm64 ### Build from Source Code ```shell -git clone https://github.com/kcl-lang/cli -cd cli && go build ./cmd/kcl/main.go -o kcl +git clone https://github.com/kcl-lang/cli && cd cli +# On Windows, MacOS and Linux +go build ./cmd/kcl/ +# Build on Linux Musl +CGO_ENABLED=1 go build -tags="musl netgo static osusergo" -ldflags="-linkmode external -extldflags '-static'" ./cmd/kcl ``` Use the following command to ensure that you install `kcl` successfully. diff --git a/VERSION b/VERSION index 34a8361..26acbf0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.12.1 +0.12.2 diff --git a/go.mod b/go.mod index aeede94..13ee806 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/onsi/gomega v1.38.2 github.com/spf13/cobra v1.10.1 github.com/stretchr/testify v1.11.1 - kcl-lang.io/kcl-go v0.12.1 + kcl-lang.io/kcl-go v0.12.2-rc.2 kcl-lang.io/kcl-openapi v0.10.0 kcl-lang.io/kcl-plugin v0.11.0 kcl-lang.io/kpm v0.12.1 @@ -95,7 +95,7 @@ require ( google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/api v0.0.0-20251022142026-3a174f9686a8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20251022142026-3a174f9686a8 // indirect - kcl-lang.io/lib v0.12.1 // indirect + kcl-lang.io/lib v0.12.2-rc.1 // indirect ) require ( diff --git a/go.sum b/go.sum index 9c11c56..8ac6a45 100644 --- a/go.sum +++ b/go.sum @@ -1407,16 +1407,16 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -kcl-lang.io/kcl-go v0.12.1 h1:yJsh7zxZj1sxfQ8GiGw0ROydzHDpHFsLjMK9R+cpsfM= -kcl-lang.io/kcl-go v0.12.1/go.mod h1:S9nodh+GW4Lu1IMomUTZhgN3sIoyotxOK3YsHf1+isI= +kcl-lang.io/kcl-go v0.12.2-rc.2 h1:b91SZsVTiSv6Nge7WtvJSIAmR/J6Bkjsn3PH3SWt6i4= +kcl-lang.io/kcl-go v0.12.2-rc.2/go.mod h1:XonsxHac93yVt5iZYrfVVQvCvzfYDDpPapsOuA9KS18= kcl-lang.io/kcl-openapi v0.10.0 h1:yetZMSnn/HHaMcfiLt1P2zhCF06O33jxkjtHrm08VR8= kcl-lang.io/kcl-openapi v0.10.0/go.mod h1:kGCf0AZygrZyB+xpmMtiC3FYoiV/1rCLXuAq2QtuLf8= kcl-lang.io/kcl-plugin v0.11.0 h1:Get9hvYhQDS180GOqhdhKwxRcZGKUGvPkQkqEOfcwtk= kcl-lang.io/kcl-plugin v0.11.0/go.mod h1:0H6hJEYMyPUm0zJQP0bgTuNrqktwgA21EcUvQTiZIb4= kcl-lang.io/kpm v0.12.1 h1:2KWm7w6U5kius7y7LO0ntGYrSDpEwHhCMI6Z/DeVMx4= kcl-lang.io/kpm v0.12.1/go.mod h1:UqA172uQzxJeDDuaVZ9VchmNzN8s6syPOngz7hRHE4A= -kcl-lang.io/lib v0.12.1 h1:wxEI4Hkgg6nFJHNHfNdqvPg5Zf7UMWUL7zBVsnudo/8= -kcl-lang.io/lib v0.12.1/go.mod h1:kK/P1DUXQD+HpdRuPMb4/f7U7Njr2q5VrihmDHjKtnw= +kcl-lang.io/lib v0.12.2-rc.1 h1:Y14N24knnzgPHsOFiFFonuAPjs+6BqkA0nwoSwmz69o= +kcl-lang.io/lib v0.12.2-rc.1/go.mod h1:kK/P1DUXQD+HpdRuPMb4/f7U7Njr2q5VrihmDHjKtnw= oras.land/oras-go v1.2.6 h1:z8cmxQXBU8yZ4mkytWqXfo6tZcamPwjsuxYU81xJ8Lk= oras.land/oras-go v1.2.6/go.mod h1:OVPc1PegSEe/K8YiLfosrlqlqTN9PUyFvOw5Y9gwrT8= oras.land/oras-go/v2 v2.5.0 h1:o8Me9kLY74Vp5uw07QXPiitjsw7qNXi8Twd+19Zf02c= diff --git a/pkg/version/version.go b/pkg/version/version.go index d5d337d..78de0cd 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -32,8 +32,9 @@ func getVersion(version string) string { } const ( - VersionTypeLatest = Version_0_12_1 + VersionTypeLatest = Version_0_12_2 + Version_0_12_2 VersionType = "0.12.2" Version_0_12_1 VersionType = "0.12.1" Version_0_12_0 VersionType = "0.12.0" Version_0_11_2 VersionType = "0.11.2"