Skip to content

Commit f92bde2

Browse files
authored
Merge branch 'master' into feat/gen_flow_chart
2 parents b081b74 + 4e80afd commit f92bde2

File tree

26 files changed

+819
-165
lines changed

26 files changed

+819
-165
lines changed

.config/nextest.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[profile.ci]
2+
# Don't fail fast in CI to run the full test suite.
3+
fail-fast = false

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
time: "04:00" # UTC
8+
labels:
9+
- "dependencies"
10+
commit-message:
11+
prefix: "bump"
12+
open-pull-requests-limit: 10
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "daily"
17+
labels:
18+
- "dependencies"
19+
commit-message:
20+
prefix: "chore(ci)"

.github/workflows/brew_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333

3434
# Custom dependencies in case other formulas are needed to build the current one.
3535
# Optional - multiline string.
36-
depends_on: |
37-
"llvm@14"
36+
# depends_on: |
37+
# "llvm@14"
3838
# Custom install command for your formula.
3939
# Required - string.
4040
install: |

.github/workflows/release.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,8 @@ jobs:
5050
target/
5151
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
5252

53-
- name: Cache LLVM and Clang
54-
id: cache-llvm
55-
uses: actions/cache@v2
56-
with:
57-
path: ${{ runner.temp }}/llvm
58-
key: llvm-14
59-
- name: Install LLVM and Clang
60-
if: ${{ matrix.config.os != 'windows-latest' }}
61-
uses: KyleMayes/install-llvm-action@v1
62-
with:
63-
version: "14"
64-
directory: ${{ runner.temp }}/llvm
65-
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
53+
- name: Install LLVM
54+
uses: Pivot-Studio/setup-llvm@main
6655

6756
- name: set up win scoop
6857
if: ${{ matrix.config.os == 'windows-latest' }}
@@ -91,21 +80,18 @@ jobs:
9180
if: ${{ matrix.config.os == 'windows-latest' }}
9281
env:
9382
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
94-
LLVM_SYS_140_PREFIX: ${{ runner.temp }}\llvm
9583
run: cargo build --release --verbose
9684

9785
- name: Cargo build
9886
if: ${{ matrix.config.os != 'windows-latest' }}
9987
env:
10088
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
101-
LLVM_SYS_140_PREFIX: ${{ runner.temp }}/llvm
10289
run: cargo build --release
10390

10491
- name: Cargo build vm
10592
if: ${{ matrix.config.os != 'windows-latest' }}
10693
env:
10794
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
108-
LLVM_SYS_140_PREFIX: ${{ runner.temp }}/llvm
10995
run: cd vm && cargo build --release
11096

11197
- run: mkdir -p ${{ matrix.config.dir }}

.github/workflows/test.yml

Lines changed: 121 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,136 @@ on:
77
- '.github/workflows/**.yml'
88
- '**.pi'
99
- '**/Kagari.*'
10+
- 'codecov.yml'
1011
push:
1112
branches:
1213
- "master"
1314
- "release/*"
1415
- "staging"
1516
- "trying"
1617

18+
env:
19+
RUSTFLAGS: -Dwarnings
20+
CARGO_TERM_COLOR: always
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
1726
jobs:
18-
container-test-job:
27+
check:
28+
name: Check
1929
runs-on: ubuntu-latest
20-
container:
21-
image: registry.cn-hangzhou.aliyuncs.com/pivotstudio/rust-pl:latest
22-
options: --security-opt seccomp=unconfined
2330
steps:
24-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v3
2532
with:
26-
fetch-depth: 0
27-
- name: auto test
33+
submodules: true
34+
35+
- name: Install packages
2836
run: |
29-
export KAGARI_LIB_ROOT=$(pwd)/planglib
30-
cargo test --all
31-
bash -c 'for file in target/debug/deps/plc-*; do [ -x "$file" ] || continue; mkdir -p "target/cov/$(basename $file)"; /kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done'
32-
bash -c 'for file in target/debug/deps/vm-*; do [ -x "$file" ] || continue; mkdir -p "target/cov/$(basename $file)"; /kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done'
33-
ls target/cov/
34-
- uses: codecov/codecov-action@v3
35-
with:
36-
token: ${{ secrets.CODE_COV }} # not required for public repos
37-
name: codecov-umbrella # optional
38-
fail_ci_if_error: true # optional (default = false)
39-
verbose: true # optional (default = false)
37+
sudo apt-get update
38+
sudo apt-get install libasound2-dev libudev-dev
39+
40+
- name: Install Rust (stable)
41+
uses: actions-rs/toolchain@v1
42+
with:
43+
profile: minimal
44+
override: true
45+
46+
- name: Install LLVM
47+
uses: Pivot-Studio/setup-llvm@main
48+
49+
- uses: Swatinem/rust-cache@v2
50+
51+
- name: Cargo check
52+
uses: actions-rs/cargo@v1
53+
with:
54+
command: check
55+
args: --all-targets
56+
57+
test:
58+
name: Test Rust
59+
runs-on: ${{ matrix.os }}
60+
needs: check
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
os: ["ubuntu-latest", "windows-latest", "macOS-latest"]
65+
include:
66+
- RUSTFLAGS: "-Dwarnings"
67+
CARGO_INCREMENTAL: 1
68+
CARGO_TARGET_DIR: "target"
69+
KAGARI_LIB_ROOT: /planglib
70+
PL_ROOT: /target/release/
71+
- os: "windows-latest"
72+
RUSTFLAGS: "-Dwarnings -Ctarget-feature=+crt-static"
73+
CARGO_INCREMENTAL: 0
74+
CARGO_TARGET_DIR: "C:\\cargo-target-dir"
75+
KAGARI_LIB_ROOT: \planglib
76+
PL_ROOT: \target\release
77+
env:
78+
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
79+
CARGO_INCREMENTAL: ${{ matrix.CARGO_INCREMENTAL }}
80+
# Disable generating debug info, we don't need it here anyway and its only using disk space
81+
CARGO_PROFILE_DEV_DEBUG: 0
82+
CARGO_TARGET_DIR: ${{ matrix.CARGO_TARGET_DIR }}
83+
KAGARI_LIB_ROOT: ${{ github.workspace }}${{ matrix.KAGARI_LIB_ROOT }}
84+
PL_ROOT: ${{ github.workspace }}${{ matrix.PL_ROOT }}
85+
steps:
86+
- uses: actions/checkout@v3
87+
with:
88+
submodules: true
89+
90+
- name: Install LLVM
91+
uses: Pivot-Studio/setup-llvm@main
92+
93+
- name: Install packages
94+
if: matrix.os == 'ubuntu-latest'
95+
run: |
96+
sudo apt-get update
97+
sudo apt-get install libasound2-dev libudev-dev
98+
99+
- name: Install toolchain
100+
uses: actions-rs/toolchain@v1
101+
with:
102+
profile: minimal
103+
override: true
104+
components: rustfmt, llvm-tools-preview
105+
106+
- uses: actions/cache@v3
107+
name: Cache Cargo
108+
with:
109+
path: |
110+
~/.cargo/bin/
111+
~/.cargo/registry/index/
112+
~/.cargo/registry/cache/
113+
~/.cargo/git/db/
114+
target/
115+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
116+
117+
- name: Install latest llvm-cov release
118+
uses: taiki-e/install-action@cargo-llvm-cov
119+
120+
- name: Install latest nextest release
121+
uses: taiki-e/install-action@nextest
122+
123+
- name: build vm release
124+
uses: actions-rs/cargo@v1
125+
with:
126+
command: build
127+
args: --manifest-path vm/Cargo.toml --release --target-dir target
128+
129+
- name: Test with latest nextest release
130+
uses: actions-rs/cargo@v1
131+
with:
132+
command: llvm-cov
133+
args: nextest --all-features --workspace --lcov --output-path lcov.info --profile ci
134+
135+
- name: Upload coverage to Codecov
136+
uses: codecov/codecov-action@v3
137+
with:
138+
token: ${{ secrets.CODE_COV }}
139+
files: lcov.info
140+
name: ${{ matrix.os }}
141+
fail_ci_if_error: true
142+
verbose: true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ out.*
1919
*out
2020
*.dSYM
2121
*.dot
22-
dots
22+
dots
23+
.DS_Store
24+
!7zr.exe
25+
*.info

Cargo.lock

Lines changed: 56 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ authors = ["The pivot-lang Authors"]
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm14-0"] }
10+
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm14-0", "no-libffi-linking"] }
1111
indexmap = "1.9.2"
1212
lazy_static = "1.4.0"
1313
paste = "1.0"
1414
llvm-sys = "140"
1515
internal_macro = { path = "./internal_macro" }
16+
pl_linker = { path = "./pl_linker" }
1617
vm = { path = "./vm", optional = true, features = ["jit"] }
1718
nom_locate = "4.0.0"
1819
rowan = "0.15.10"
@@ -52,5 +53,6 @@ path = "src/main.rs"
5253
members = [
5354
"internal_macro",
5455
"vm",
56+
"pl_linker",
5557
]
5658

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.PHONY: devlinux devmac vm install fmt test clean
22
devlinux:
3-
@echo "KAGARI_LIB_ROOT=$(pwd)/planglib">>~/.bashrc
4-
@echo "PL_ROOT=$(pwd)/target/release/">>~/.bashrc
3+
@echo "export KAGARI_LIB_ROOT=$(pwd)/planglib">>~/.bashrc
4+
@echo "export PL_ROOT=$(pwd)/target/release/">>~/.bashrc
55
@echo "请重启终端和vsc应用更改"
66

77
devmac:
8-
@echo "KAGARI_LIB_ROOT=$(pwd)/planglib">>~/.bash_profile
9-
@echo "PL_ROOT=$(pwd)/target/release/">>~/.bash_profile
8+
@echo "export KAGARI_LIB_ROOT=$(pwd)/planglib">>~/.bash_profile
9+
@echo "export PL_ROOT=$(pwd)/target/release/">>~/.bash_profile
1010
@echo "请重启终端和vsc应用更改"
1111

1212
vm:

0 commit comments

Comments
 (0)