Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add macos build and test github actions and refine windows … #124

Merged
merged 1 commit into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/macos_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: build-and-test-macos
on: ["push", "pull_request"]
jobs:
build-and-test:
# Ref: https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md
runs-on: macos-11
steps:
- name: Git checkout
uses: actions/checkout@v2
with:
submodules: 'true'

- run: clang --version
- run: cargo --version
- run: rustc --print sysroot

- name: Build KCLVM
run: make build
shell: bash
- name: Grammar test
run: |
brew install coreutils
chmod +x ./internal/kclvm_py/scripts/test_grammar.sh
./internal/kclvm_py/scripts/test_grammar.sh
shell: bash
- name: Internal python unit test
run: |
chmod +x ./internal/kclvm_py/scripts/test_unit.sh
./internal/kclvm_py/scripts/test_unit.sh
shell: bash
- name: Delete rust cargo
run: rm -rf /root/.cargo/bin
shell: bash
- name: Install LLVM 12
run: brew install llvm@12
shell: bash
- name: Install rust nightly toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.61
override: true
components: clippy, rustfmt
- name: Rust grammar test
working-directory: ./kclvm
run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin:/usr/local/opt/llvm@12/bin && make install-rustc-wasm && make && make test-grammar
shell: bash
- name: Rust runtime test
working-directory: ./kclvm
run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin:/usr/local/opt/llvm@12/bin && make install-rustc-wasm && make && make test-runtime
shell: bash
- name: Rust unit test
working-directory: ./kclvm
run: export PATH=$PATH:$PWD/../_build/dist/Darwin/kclvm/bin:/usr/local/opt/llvm@12/bin && make install-rustc-wasm && make && make codecov-lcov
shell: bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: KCLVM-actions
name: build-and-test-ubuntu
on: ["push", "pull_request"]
jobs:
test-unit:
build-and-test:
name: Test
runs-on: ubuntu-latest
container:
Expand All @@ -17,7 +17,7 @@ jobs:
- name: Grammar test
run: |
chmod +x ./internal/kclvm_py/scripts/test_grammar.sh
topdir=$(realpath $(dirname $0)) ./internal/kclvm_py/scripts/test_grammar.sh
./internal/kclvm_py/scripts/test_grammar.sh
shell: bash
- name: Internal python unit test
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build-and-test-windows
on: push
on: ["push", "pull_request"]
jobs:
build-and-test:
runs-on: windows-2019
Expand All @@ -15,8 +15,6 @@ jobs:
- run: clang --version
- run: cargo --version

- run: rustc --print sysroot

- run: Rename-Item "C:/Program Files/LLVM" "C:/Program Files/LLVM-old"

# Install LLVM-12
Expand Down
8 changes: 3 additions & 5 deletions internal/kclvm_py/scripts/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ do
sslpath=$(brew --prefix openssl@1.1)
fi

if [ x"$(uname -m)" == x"arm64" ]; then
py_ver_major="3"
py_ver_minor="9"
py_ver_micro="12"
fi
py_ver_major="3"
py_ver_minor="9"
py_ver_micro="12"

config_envs="LANG=C.UTF-8"
config_options="--enable-optimizations --with-openssl=$sslpath --with-ssl-default-suites=python"
Expand Down
12 changes: 10 additions & 2 deletions internal/kclvm_py/scripts/test_grammar.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/usr/bin/env bash

# Environment
if [ -f "/etc/os-release" ]; then
source /etc/os-release
os=$ID
else
os=$(uname)
fi
topdir=$(realpath $(dirname $0)/../../../)
kclvm_install_dir="$topdir/_build/dist/$os/kclvm"
kclvm_source_dir="$topdir"

echo PATH=$PATH:$kclvm_source_dir/_build/dist/ubuntu/kclvm/bin >> ~/.bash_profile
echo PATH=$PATH:$kclvm_source_dir/_build/dist/$os/kclvm/bin >> ~/.bash_profile
source ~/.bash_profile

export PATH=$PATH:$topdir/_build/dist/$os/kclvm/bin

# Grammar test
cd $kclvm_source_dir/test/grammar
kclvm -m pytest -v -n 10
12 changes: 10 additions & 2 deletions internal/kclvm_py/scripts/test_unit.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/usr/bin/env bash

# Environment
if [ -f "/etc/os-release" ]; then
source /etc/os-release
os=$ID
else
os=$(uname)
fi
topdir=$(realpath $(dirname $0)/../../../)
kclvm_install_dir="$topdir/_build/dist/$os/kclvm"
kclvm_source_dir="$topdir"

echo PATH=$PATH:$kclvm_source_dir/_build/dist/ubuntu/kclvm/bin >> ~/.bash_profile
echo PATH=$PATH:$kclvm_source_dir/_build/dist/$os/kclvm/bin >> ~/.bash_profile
source ~/.bash_profile

export PATH=$PATH:$topdir/_build/dist/$os/kclvm/bin

# Install the dependency
kclvm -m pip install nose==1.3.7

Expand Down