From 6d984079e23e928275914ceffbc3d14862671d8f Mon Sep 17 00:00:00 2001 From: peefy Date: Fri, 18 Oct 2024 11:57:36 +0800 Subject: [PATCH] chore: update release os and arch info Signed-off-by: peefy --- .../workflows/build-test-centos7-amd64.yaml | 12 ++++++--- .github/workflows/build-test-macos-arm64.yml | 16 +++++++---- .github/workflows/build-test-ubuntu-arm64.yml | 12 ++++++--- .github/workflows/macos_test.yaml | 20 +++++++++----- .github/workflows/mingw_test.yaml | 8 +++++- .github/workflows/ubuntu_test.yaml | 14 +++------- .github/workflows/windows_test.yaml | 13 ++++++++- run.sh | 3 ++- scripts/build.sh | 18 ++++++++----- scripts/release.sh | 27 ++++++++++++++----- 10 files changed, 99 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build-test-centos7-amd64.yaml b/.github/workflows/build-test-centos7-amd64.yaml index d5b1a48d1..d5eaadbad 100644 --- a/.github/workflows/build-test-centos7-amd64.yaml +++ b/.github/workflows/build-test-centos7-amd64.yaml @@ -37,11 +37,17 @@ jobs: /bin/bash -c "export KCL_BUILD_GIT_SHA=$(git rev-parse HEAD) && source ~/.bash_profile && export PATH=$PATH:/opt/build/bin/ && sed -i 's/llvm12/llvm7/g' kclvm/compiler/Cargo.toml && git config --global --add safe.directory /workspace && git config --global user.name 'GitHub Action' && git config --global user.email 'action@github.com' && git add . && git commit -m 'chore: bump llvm version to 7.0' && make && make release" - name: Show Artifact Version - run: _build/dist/centos/kclvm/bin/kclvm_cli version + run: _build/dist/linux/kclvm/bin/kclvm_cli version + + - name: Read VERSION file + id: read_version + run: | + VERSION=$(cat VERSION) + echo "VERSION=v${VERSION}" >> $GITHUB_ENV - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: kcl-centos7-amd64 + name: kcl-${{ env.VERSION }}-linux-amd64 if-no-files-found: error - path: _build/kclvm-centos-latest.tar.gz + path: _build/kclvm-${{ env.VERSION }}-linux-amd64.tar.gz diff --git a/.github/workflows/build-test-macos-arm64.yml b/.github/workflows/build-test-macos-arm64.yml index c51fff0ba..fc5b770ee 100644 --- a/.github/workflows/build-test-macos-arm64.yml +++ b/.github/workflows/build-test-macos-arm64.yml @@ -41,20 +41,26 @@ jobs: python-version: '3.11' - name: Grammar test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make && make test-grammar + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make && make test-grammar shell: bash - name: Evaluator Grammar test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make test-grammar-evaluator + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make test-grammar-evaluator shell: bash - name: Release - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make release + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make release shell: bash + - name: Read VERSION file + id: read_version + run: | + VERSION=$(cat VERSION) + echo "VERSION=v${VERSION}" >> $GITHUB_ENV + - uses: actions/upload-artifact@v4 if: "contains(matrix.os, 'macos-13-xlarge')" with: - name: kcl-darwin-arm64 + name: kcl-${{ env.VERSION }}-darwin-arm64 if-no-files-found: error - path: _build/kclvm-Darwin-latest.tar.gz + path: _build/kclvm-${{ env.VERSION }}-darwin-arm64.tar.gz diff --git a/.github/workflows/build-test-ubuntu-arm64.yml b/.github/workflows/build-test-ubuntu-arm64.yml index 89dec5af8..b084c711a 100644 --- a/.github/workflows/build-test-ubuntu-arm64.yml +++ b/.github/workflows/build-test-ubuntu-arm64.yml @@ -33,11 +33,17 @@ jobs: docker run --rm --platform linux/arm64 \ -v ${{ github.workspace }}:/workspace -w /workspace \ kcllang/kcl-builder-arm64 \ - /bin/bash -c "export KCL_BUILD_GIT_SHA=$(git rev-parse HEAD) && git config --global --add safe.directory /workspace && git config --global user.name 'GitHub Action' && git config --global user.email 'action@github.com' && make && make release && _build/dist/ubuntu/kclvm/bin/kclvm_cli version" + /bin/bash -c "export KCL_BUILD_GIT_SHA=$(git rev-parse HEAD) && git config --global --add safe.directory /workspace && git config --global user.name 'GitHub Action' && git config --global user.email 'action@github.com' && make && make release && _build/dist/linux/kclvm/bin/kclvm_cli version" + + - name: Read VERSION file + id: read_version + run: | + VERSION=$(cat VERSION) + echo "VERSION=v${VERSION}" >> $GITHUB_ENV - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: kcl-linux-arm64 + name: kcl-${{ env.VERSION }}-linux-arm64 if-no-files-found: error - path: _build/kclvm-ubuntu-latest.tar.gz + path: _build/kclvm-${{ env.VERSION }}-linux-arm64.tar.gz diff --git a/.github/workflows/macos_test.yaml b/.github/workflows/macos_test.yaml index 768dc0562..1fc23714f 100644 --- a/.github/workflows/macos_test.yaml +++ b/.github/workflows/macos_test.yaml @@ -56,20 +56,20 @@ jobs: shell: bash - name: Grammar test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make && make test-grammar + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make && make test-grammar shell: bash - name: Evaluator Grammar test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make test-grammar-evaluator + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make test-grammar-evaluator shell: bash - name: Runtime test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make test-runtime + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make test-runtime shell: bash - name: Unit test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make codecov-lcov + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make codecov-lcov shell: bash - name: Coveralls upload @@ -79,12 +79,18 @@ jobs: path-to-lcov: ./kclvm/.kclvm_cov/lcov.info - name: Release - run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin && make release + run: export PATH=$PATH:$PWD/../_build/dist/darwin/kclvm/bin && make release shell: bash + - name: Read VERSION file + id: read_version + run: | + VERSION=$(cat VERSION) + echo "VERSION=v${VERSION}" >> $GITHUB_ENV + - uses: actions/upload-artifact@v4 if: "contains(matrix.os, 'macos-12')" with: - name: kcl-darwin-amd64 + name: kcl-${{ env.VERSION }}-darwin-amd64 if-no-files-found: error - path: _build/kclvm-Darwin-latest.tar.gz + path: _build/kclvm-${{ env.VERSION }}-darwin-amd64.tar.gz diff --git a/.github/workflows/mingw_test.yaml b/.github/workflows/mingw_test.yaml index 5ad74bc4c..ace3e3f12 100644 --- a/.github/workflows/mingw_test.yaml +++ b/.github/workflows/mingw_test.yaml @@ -32,9 +32,15 @@ jobs: rustup target add x86_64-pc-windows-gnu cargo build -r --target x86_64-pc-windows-gnu + - name: Read VERSION file + id: read_version + run: | + VERSION=$(cat VERSION) + echo "VERSION=v${VERSION}" >> $GITHUB_ENV + - uses: actions/upload-artifact@v4 with: - name: kcl-windows-mingw + name: kcl-${{ env.VERSION }}-windows-mingw if-no-files-found: error path: | kclvm/target/x86_64-pc-windows-gnu/release/libkclvm_cli_cdylib.a diff --git a/.github/workflows/ubuntu_test.yaml b/.github/workflows/ubuntu_test.yaml index 61efd2205..911d68a6a 100644 --- a/.github/workflows/ubuntu_test.yaml +++ b/.github/workflows/ubuntu_test.yaml @@ -47,15 +47,15 @@ jobs: shell: bash - name: Grammar test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/ubuntu/kclvm/bin && make && make test-grammar + run: export PATH=$PATH:$PWD/../_build/dist/linux/kclvm/bin && make && make test-grammar shell: bash - name: Evaluator Grammar test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/ubuntu/kclvm/bin && make test-grammar-evaluator + run: export PATH=$PATH:$PWD/../_build/dist/linux/kclvm/bin && make test-grammar-evaluator shell: bash - name: Runtime test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/ubuntu/kclvm/bin && make test-runtime + run: export PATH=$PATH:$PWD/../_build/dist/linux/kclvm/bin && make test-runtime shell: bash - name: Install KCL CLI run: | @@ -65,11 +65,5 @@ jobs: - name: Unit test working-directory: ./kclvm - run: export PATH=$PATH:$PWD/../_build/dist/ubuntu/kclvm/bin && make test + run: export PATH=$PATH:$PWD/../_build/dist/linux/kclvm/bin && make test shell: bash - - - uses: actions/upload-artifact@v4 - with: - name: kcl-linux-amd64 - if-no-files-found: error - path: _build/dist/ubuntu/kclvm diff --git a/.github/workflows/windows_test.yaml b/.github/workflows/windows_test.yaml index f0ac20701..cd5f4f8f7 100644 --- a/.github/workflows/windows_test.yaml +++ b/.github/workflows/windows_test.yaml @@ -64,8 +64,19 @@ jobs: - run: cargo test --workspace -r -- --nocapture working-directory: ./kclvm + - name: Read VERSION file + id: read_version + run: | + VERSION=$(cat VERSION) + echo "VERSION=v${VERSION}" >> $GITHUB_ENV + + - name: Rename kclvm-windows folder + run: | + $version = "${{ env.VERSION }}" + Rename-Item -Path ".\scripts\build-windows\_output\kclvm-windows" -NewName "kclvm-$version-windows" + - uses: actions/upload-artifact@v4 with: - name: kcl-windows + name: kcl-${{ env.VERSION }}-windows if-no-files-found: error path: scripts/build-windows/_output/kclvm-windows diff --git a/run.sh b/run.sh index 2c73a4dbd..2be22de93 100755 --- a/run.sh +++ b/run.sh @@ -8,6 +8,7 @@ else os=$(uname) fi topdir=$PWD +version=v$(cat VERSION) # Options help_message=$(cat <<-END @@ -63,4 +64,4 @@ if [ "$action" == "" ]; then done fi -os=$os topdir=$topdir sslpath=$sslpath $topdir/scripts/$action.sh +os=$os topdir=$topdir version=$version sslpath=$sslpath $topdir/scripts/$action.sh diff --git a/scripts/build.sh b/scripts/build.sh index 867d462a3..31e714029 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,12 +5,18 @@ set -e # Environment -if [ -f "/etc/os-release" ]; then - source /etc/os-release - os=$ID -else - os=$(uname) -fi +getSystemInfo() { + arch=$(uname -m) + case $arch in + armv7*) arch="arm";; + aarch64) arch="arm64";; + x86_64) arch="amd64";; + esac + + os=$(echo `uname`|tr '[:upper:]' '[:lower:]') +} + +getSystemInfo prepare_dirs () { install_dir="$topdir/_build/dist/$os/kclvm" diff --git a/scripts/release.sh b/scripts/release.sh index f4614b3cd..ad660bd1e 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,16 +1,29 @@ #!/usr/bin/env bash -if [ -z "$os" ]; then - os=$1 -fi +getSystemInfo() { + arch=$(uname -m) + case $arch in + armv7*) arch="arm";; + aarch64) arch="arm64";; + x86_64) arch="amd64";; + esac + + os=$(echo `uname`|tr '[:upper:]' '[:lower:]') +} -if [ -z "$os" ]; then - echo "Error: The variable 'os' is not set. Please set the 'os' variable before running the script." - exit 1 +if [ -z "$version" ]; then + version=$1 fi +if [ -z "$version" ]; then + version='latest' +fi + +getSystemInfo echo "[info] os: $os" -release_file="kclvm-$os-latest.tar.gz" +echo "[info] arch: $arch" +echo "[info] version: $version" +release_file="kclvm-$version-$os-$arch.tar.gz" release_path="$topdir/_build" package_dir="$topdir/_build/dist/$os" install_dir="kclvm"