Skip to content

Commit 52f41a9

Browse files
committed
feat: riir
1 parent 467ba37 commit 52f41a9

File tree

359 files changed

+71778
-11741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+71778
-11741
lines changed

.github/workflows/check.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Rust Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
name: ci checks
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions-rust-lang/setup-rust-toolchain@v1
18+
with:
19+
toolchain-file: rust-toolchain.toml
20+
- uses: Swatinem/rust-cache@v2
21+
- name: cargo test
22+
run: cargo test --workspace --all-features
23+
# - name: cargo fmt
24+
# run: cargo fmt --all -- --check
25+
# - name: cargo clippy
26+
# run: cargo clippy --workspace --all-features -D warnings

.github/workflows/goreleaser.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Perf Dashboard
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
schedule:
9+
- cron: "0 6 * * 1"
10+
11+
jobs:
12+
perf-bench:
13+
runs-on: ubuntu-latest
14+
env:
15+
CARGO_TERM_COLOR: always
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust toolchain
20+
uses: actions-rust-lang/setup-rust-toolchain@v1
21+
with:
22+
toolchain-file: rust-toolchain.toml
23+
24+
- uses: Swatinem/rust-cache@v2
25+
26+
- name: Run scripts bench
27+
run: cargo bench -p lkr-core --bench scripts_bench -- --noplot
28+
29+
- name: Generate dashboard snapshot
30+
run: cargo run -p lkr-core --bin perf_dashboard -- --memory-iters 5 --notes "CI run ${{ github.run_id }} on ${{ github.ref }}"
31+
32+
- name: Upload dashboard artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: perf-dashboard
36+
path: docs/perf/dashboard
37+
38+
- name: Publish perf_dashboard branch
39+
if: github.event_name != 'pull_request'
40+
uses: peaceiris/actions-gh-pages@v3
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_branch: perf_dashboard
44+
publish_dir: docs/perf/dashboard
45+
keep_files: true

.github/workflows/release.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
tag_name:
10+
description: 'Tag name to release (for example v0.1.3)'
11+
required: true
12+
13+
jobs:
14+
build:
15+
name: build ${{ matrix.target }}
16+
runs-on: ${{ matrix.runner }}
17+
env:
18+
CARGO_TERM_COLOR: always
19+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- runner: ubuntu-latest
25+
target: x86_64-unknown-linux-gnu
26+
os: linux
27+
arch: x86_64
28+
archive_ext: tar.gz
29+
bin_ext: ''
30+
- runner: ubuntu-24.04-arm64
31+
target: aarch64-unknown-linux-gnu
32+
os: linux
33+
arch: aarch64
34+
archive_ext: tar.gz
35+
bin_ext: ''
36+
- runner: macos-13
37+
target: x86_64-apple-darwin
38+
os: macos
39+
arch: x86_64
40+
archive_ext: tar.gz
41+
bin_ext: ''
42+
- runner: macos-14
43+
target: aarch64-apple-darwin
44+
os: macos
45+
arch: aarch64
46+
archive_ext: tar.gz
47+
bin_ext: ''
48+
- runner: windows-latest
49+
target: x86_64-pc-windows-msvc
50+
os: windows
51+
arch: x86_64
52+
archive_ext: zip
53+
bin_ext: '.exe'
54+
- runner: windows-latest
55+
target: aarch64-pc-windows-msvc
56+
os: windows
57+
arch: aarch64
58+
archive_ext: zip
59+
bin_ext: '.exe'
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: actions-rust-lang/setup-rust-toolchain@v1
63+
with:
64+
toolchain-file: rust-toolchain.toml
65+
target: ${{ matrix.target }}
66+
- uses: Swatinem/rust-cache@v2
67+
with:
68+
shared-key: ${{ matrix.target }}
69+
- name: Build binaries
70+
run: cargo build --release --target ${{ matrix.target }} -p lkr-cli -p lkr-lsp --all-features
71+
shell: bash
72+
- name: Package archive (unix)
73+
if: ${{ runner.os != 'Windows' }}
74+
shell: bash
75+
run: |
76+
set -euo pipefail
77+
archive_name="lkr-${RELEASE_TAG}-${{ matrix.os }}-${{ matrix.arch }}"
78+
staging="artifacts/$archive_name"
79+
mkdir -p "$staging"
80+
cp "target/${{ matrix.target }}/release/lkr${{ matrix.bin_ext }}" "$staging/"
81+
cp "target/${{ matrix.target }}/release/lkr-lsp${{ matrix.bin_ext }}" "$staging/"
82+
cp LICENSE "$staging/"
83+
tar -C artifacts -czf "${archive_name}.tar.gz" "$archive_name"
84+
rm -rf "$staging"
85+
- name: Package archive (windows)
86+
if: ${{ runner.os == 'Windows' }}
87+
shell: pwsh
88+
run: |
89+
$ErrorActionPreference = 'Stop'
90+
$archiveName = "lkr-$env:RELEASE_TAG-${{ matrix.os }}-${{ matrix.arch }}"
91+
$staging = Join-Path "artifacts" $archiveName
92+
New-Item -ItemType Directory -Path $staging | Out-Null
93+
Copy-Item "target\${{ matrix.target }}\release\lkr${{ matrix.bin_ext }}" -Destination $staging
94+
Copy-Item "target\${{ matrix.target }}\release\lkr-lsp${{ matrix.bin_ext }}" -Destination $staging
95+
Copy-Item "LICENSE" -Destination $staging
96+
Compress-Archive -Path "$staging\*" -DestinationPath "artifacts\$archiveName.zip"
97+
Remove-Item $staging -Recurse -Force
98+
- name: Upload artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: lkr-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}
102+
path: artifacts/lkr-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }}
103+
104+
publish:
105+
name: publish release
106+
runs-on: ubuntu-latest
107+
needs: build
108+
env:
109+
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name || github.ref_name }}
110+
steps:
111+
- uses: actions/download-artifact@v4
112+
with:
113+
path: release
114+
- name: List packaged assets
115+
run: ls -R release
116+
- name: Publish assets
117+
uses: softprops/action-gh-release@v2
118+
with:
119+
tag_name: ${{ env.RELEASE_TAG }}
120+
name: ${{ env.RELEASE_TAG }}
121+
files: |
122+
release/**/*
123+
fail_on_unmatched_files: true
124+
generate_release_notes: false
125+
env:
126+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
lk
2-
releases
3-
*/*.lkc
4-
*.lkc
5-
*/*.ast.json
6-
test/test.lk
1+
target
2+
3+
flamegraph.svg
4+
5+
*.lkrb
6+
*.ll
7+
*.o
8+
*.elf

.goreleaser.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.markdownlint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"MD013": false,
3+
"MD033": false,
4+
"MD040": false,
5+
"MD041": false
6+
}

.vscode/launch.json

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,57 @@
11
{
2-
// 使用 IntelliSense 了解相关属性。
3-
// 悬停以查看现有属性的描述。
4-
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "test",
9-
"type": "go",
8+
"type": "lldb",
109
"request": "launch",
11-
"mode": "test",
12-
"program": "${workspaceFolder}",
13-
"args": [
14-
"-test.run",
15-
]
10+
"name": "Debug unit tests in library 'lkr-core'",
11+
"cargo": {
12+
"args": [
13+
"test",
14+
"--no-run",
15+
"--lib",
16+
"--package=lkr-core"
17+
],
18+
"filter": {
19+
"name": "lkr-core",
20+
"kind": "lib"
21+
}
22+
},
23+
"args": [],
24+
"cwd": "${workspaceFolder}"
1625
},
1726
{
18-
"name": "debug",
19-
"type": "go",
27+
"name": "Run VS Code Extension",
28+
"type": "extensionHost",
2029
"request": "launch",
21-
"mode": "debug",
22-
"program": ".",
23-
"args": ["test/object.lk"]
30+
"args": [
31+
"--extensionDevelopmentPath=${workspaceFolder}/vsc-ext"
32+
],
33+
"outFiles": [
34+
"${workspaceFolder}/vsc-ext/out/**/*.js"
35+
],
36+
"preLaunchTask": "Build All"
2437
},
25-
38+
{
39+
"name": "Debug LKR LSP Server",
40+
"type": "lldb",
41+
"request": "launch",
42+
"cargo": {
43+
"args": [
44+
"build",
45+
"--package=lkr-lsp"
46+
],
47+
"filter": {
48+
"name": "lkr-lsp",
49+
"kind": "bin"
50+
}
51+
},
52+
"program": "${workspaceFolder}/target/debug/lkr-lsp",
53+
"args": [],
54+
"cwd": "${workspaceFolder}"
55+
}
2656
]
2757
}

.vscode/setings.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)