Skip to content

Commit

Permalink
ci: refactor artifact upload scripts
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Jul 16, 2024
1 parent 4e43775 commit 33bb450
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-test-centos7-amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
/bin/bash -c "source ~/.bash_profile && export PATH=$PATH:/opt/build/bin/ && sed -i 's/llvm12/llvm7/g' kclvm/compiler/Cargo.toml && make && make release"
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: kcl-centos7-amd64
if-no-files-found: error
path: _build/kclvm-centos-latest.tar.gz
6 changes: 4 additions & 2 deletions .github/workflows/build-test-macos-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: ["push", "pull_request"]
jobs:
build-and-test:
# Ref: https://github.com/actions/runner-images/tree/main/images/macos
# Note: The arch of macos-14 is arm64
# Note: The arch of macos-13-xlarge and macos-14 is arm64
strategy:
matrix:
os: [macos-13-xlarge, macos-14]
Expand Down Expand Up @@ -49,7 +49,9 @@ jobs:
run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin:/opt/homebrew/opt/llvm@12/bin/ && make test-grammar-evaluator
shell: bash

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: "contains(matrix.os, 'macos-13-xlarge')"
with:
name: kcl-darwin-arm64
if-no-files-found: error
path: _build/dist/Darwin/kclvm
11 changes: 8 additions & 3 deletions .github/workflows/build-test-ubuntu-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ jobs:
run: |
docker pull --platform linux/arm64 kcllang/kcl-builder-arm64
- name: Run custom ARM64 Docker image
- name: Build in Docker
run: |
docker run --rm --platform linux/arm64 \
-v ${{ github.workspace }}:/workspace -w /workspace \
kcllang/kcl-builder-arm64 \
make && make release
/bin/bash -c "make && make release"
- name: Release
shell: bash
run: os=ubuntu topdir=$PWD ./scripts/release.sh

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: kcl-linux-arm64
if-no-files-found: error
path: _build/kclvm-ubuntu-latest.tar.gz
6 changes: 4 additions & 2 deletions .github/workflows/macos_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
# Ref: https://github.com/actions/runner-images/tree/main/images/macos
strategy:
matrix:
os: [macos-11, macos-12, macos-13]
os: [macos-12, macos-13]
runs-on: ${{ matrix.os }}
steps:
- name: Git checkout
Expand Down Expand Up @@ -74,7 +74,9 @@ jobs:
run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin:/usr/local/opt/llvm@12/bin && make release
shell: bash

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: "contains(matrix.os, 'macos-12')"
with:
name: kcl-darwin-amd64
if-no-files-found: error
path: _build/kclvm-Darwin-latest.tar.gz
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
run: export PATH=$PATH:$PWD/../_build/dist/ubuntu/kclvm/bin && make test
shell: bash

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: kcl-linux-amd64
if-no-files-found: error
path: _build/dist/ubuntu/kclvm
1 change: 1 addition & 0 deletions .github/workflows/wasm_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: kcl-wasm
if-no-files-found: error
path: kclvm/target/wasm32-wasi/release/kclvm_cli_cdylib.wasm
3 changes: 2 additions & 1 deletion .github/workflows/windows_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ jobs:
- run: cargo test -p kclvm-* --features llvm
working-directory: ./kclvm

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: kcl-windows
if-no-files-found: error
path: scripts/build-windows/_output/kclvm-windows
10 changes: 10 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
#!/usr/bin/env bash

if [ -z "$os" ]; then
os=$1
fi

if [ -z "$os" ]; then
echo "Error: The variable 'os' is not set. Please set the 'os' variable before running the script."
exit 1
fi

echo "[info] os: $os"
release_file="kclvm-$os-latest.tar.gz"
release_path="$topdir/_build"
package_dir="$topdir/_build/dist/$os"
Expand Down

0 comments on commit 33bb450

Please sign in to comment.