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 9559c00
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 69 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 = Get-Content VERSION
echo "VERSION=v$version" >> $env: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
18 changes: 5 additions & 13 deletions .github/workflows/ubuntu_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ jobs:

# Prerequisite

- name: Install Python3 and LLVM
- name: Install Python3 (for Grammar test)
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y git wget curl make
sudo apt-get install python3 python3-pip -y
sudo apt-get install -y clang-12 lld-12
sudo ln -sf /usr/bin/clang-12 /usr/bin/clang
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
Expand All @@ -47,15 +45,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 +63,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 = Get-Content VERSION
echo "VERSION=v$version" >> $env: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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ lark_parser.pickle
/scripts/docker/kclvm-builder-ubuntu/crates.io-index
*.tar.gz

# KCLVM cache and temp output
# KCL cache and temp output
.kclvm
.kclvm_cov
*.dylib
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright The KCL Authors. All rights reserved.

PROJECT_NAME = KCLVM
PROJECT_NAME = kcl

PWD:=$(shell pwd)

Expand All @@ -18,7 +18,7 @@ RUN_IN_DOCKER+=-v ${PWD}:/root/kclvm
RUN_IN_DOCKER+=-w /root/kclvm ${BUILD_IMAGE}

# ----------------
# KCLVM build
# Build
# ----------------

.PHONY: build
Expand Down
21 changes: 14 additions & 7 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/usr/bin/env bash

# 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
topdir=$PWD
version=v$(cat VERSION)

# Options
help_message=$(cat <<-END
Expand Down Expand Up @@ -63,4 +70,4 @@ if [ "$action" == "" ]; then
done
fi

os=$os topdir=$topdir sslpath=$sslpath $topdir/scripts/$action.sh
topdir=$topdir version=$version sslpath=$sslpath $topdir/scripts/$action.sh
5 changes: 0 additions & 5 deletions scripts/build-windows/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Set-Location $PSScriptRoot
New-Item -ErrorAction Ignore -Path ".\_output" -ItemType "directory"
New-Item -ErrorAction Ignore -Path ".\_output\kclvm-windows" -ItemType "directory"
New-Item -ErrorAction Ignore -Path ".\_output\kclvm-windows\bin" -ItemType "directory"
New-Item -ErrorAction Ignore -Path ".\_output\kclvm-windows\include" -ItemType "directory"

Copy-Item -Path "..\..\kclvm\target\release\kclvm_cli_cdylib.dll" -Destination ".\_output\kclvm-windows\bin\kclvm_cli_cdylib.dll" -Force
Copy-Item -Path "..\..\kclvm\target\release\kclvm_cli_cdylib.dll.lib" -Destination ".\_output\kclvm-windows\bin\kclvm_cli_cdylib.lib" -Force
Expand All @@ -30,10 +29,6 @@ cargo build --release
Set-Location $PSScriptRoot
Copy-Item -Path "..\..\kclvm\target\release\kcl-language-server.exe" -Destination ".\_output\kclvm-windows\bin\"

Set-Location $PSScriptRoot
# 4. Copy KCLVM C API header
Copy-Item -Path "..\..\kclvm\runtime\src\_kclvm.h" -Destination ".\_output\kclvm-windows\include\kclvm.h" -Force

Set-Location $PSScriptRoot
# Install hello.k
Copy-Item -Path "..\..\samples\hello.k" -Destination ".\_output\kclvm-windows" -Force
Expand Down
28 changes: 14 additions & 14 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ 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"
mkdir -p "$install_dir/bin"
mkdir -p "$install_dir/include"
}

prepare_dirs
Expand All @@ -32,7 +37,7 @@ cargo build --release
## Switch dll file extension according to os.
dll_extension="so"
case $os in
"Default" | "default" | "centos" | "ubuntu" | "debian" | "Ubuntu" |"Debian" | "Static-Debian" | "Cood1-Debian" | "Cood1Shared-Debian")
"Linux" | "linux" | "Default" | "default" | "centos" | "ubuntu" | "debian" | "Ubuntu" | "Debian" | "Static-Debian" | "Cood1-Debian" | "Cood1Shared-Debian")
dll_extension="so"
;;
"Darwin" | "darwin" | "ios" | "macos")
Expand All @@ -42,11 +47,6 @@ case $os in
;;
esac

## Copy C API header

cd $topdir/kclvm/runtime
cp src/_kclvm.h $install_dir/include/kclvm.h

## Copy libkclvm_cli lib to the build folder

if [ -e $topdir/kclvm/target/release/libkclvm_cli_cdylib.$dll_extension ]; then
Expand Down Expand Up @@ -77,4 +77,4 @@ cd $topdir

# Print the summary.
echo "================ Summary ================"
echo " KCLVM is updated into $install_dir"
echo " KCL is updated into $install_dir"
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 9559c00

Please sign in to comment.