Skip to content

Commit

Permalink
chore: update release os and arch info
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Oct 18, 2024
1 parent cb01607 commit 6d98407
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 44 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build-test-centos7-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 11 additions & 5 deletions .github/workflows/build-test-macos-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 9 additions & 3 deletions .github/workflows/build-test-ubuntu-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 13 additions & 7 deletions .github/workflows/macos_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 7 additions & 1 deletion .github/workflows/mingw_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/ubuntu_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
13 changes: 12 additions & 1 deletion .github/workflows/windows_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ else
os=$(uname)
fi
topdir=$PWD
version=v$(cat VERSION)

# Options
help_message=$(cat <<-END
Expand Down Expand Up @@ -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
18 changes: 12 additions & 6 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 20 additions & 7 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 6d98407

Please sign in to comment.