mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2025-04-20 17:29:57 +08:00
Compare commits
No commits in common. "d246913b4cbd3fae2e1acc4a45004b3ab108c1dc" and "0ef4aeb4f3a1f00346c6bf47edf5fbd02babadcd" have entirely different histories.
d246913b4c
...
0ef4aeb4f3
43
.github/workflows/builds.yml
vendored
43
.github/workflows/builds.yml
vendored
|
@ -1,43 +0,0 @@
|
||||||
name: build and test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 获取版本号
|
|
||||||
id: get_version
|
|
||||||
uses: sravinet/toml-select@v1.0.1
|
|
||||||
with:
|
|
||||||
file: ./ica-rs/Cargo.toml
|
|
||||||
field: "package.version"
|
|
||||||
|
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5.0.0
|
|
||||||
with:
|
|
||||||
# Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset.
|
|
||||||
python-version: 3.8
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: cargo test --verbose
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build --release
|
|
||||||
|
|
||||||
- name: 上传
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ica-rs-b${{ github.run_number }}-${{ steps.get_version.outputs.value }}-py38-win-x64
|
|
||||||
path: ./target/release/ica-rs.exe
|
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -6,8 +6,3 @@ config.toml
|
||||||
*.pyc
|
*.pyc
|
||||||
*__pycache__/
|
*__pycache__/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Added by cargo
|
|
||||||
|
|
||||||
/target
|
|
||||||
|
|
2146
Cargo.lock
generated
2146
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +0,0 @@
|
||||||
[workspace]
|
|
||||||
members = [
|
|
||||||
"ica-rs"
|
|
||||||
]
|
|
||||||
resolver = "2"
|
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
rust_socketio = { git = "https://github.com/shenjackyuanjie/rust-socketio.git", branch = "mult_payload" }
|
|
||||||
# pyo3 = { git = "https://github.com/PyO3/pyo3.git", branch = "main" }
|
|
|
@ -25,3 +25,7 @@ pyo3-asyncio = { version = "0.20.0", features = ["attributes", "tokio-runtime"]
|
||||||
|
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
tracing-subscriber = { version = "0.3.18", features = ["time"] }
|
tracing-subscriber = { version = "0.3.18", features = ["time"] }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
rust_socketio = { git = "https://github.com/shenjackyuanjie/rust-socketio.git", branch = "mult_payload" }
|
||||||
|
# pyo3 = { git = "https://github.com/PyO3/pyo3.git", branch = "main" }
|
||||||
|
|
|
@ -141,20 +141,6 @@ pub fn get_change_time(path: &PathBuf) -> Option<SystemTime> {
|
||||||
path.metadata().ok()?.modified().ok()
|
path.metadata().ok()?.modified().ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn py_module_from_code(content: &str, path: &str) -> PyResult<Py<PyAny>> {
|
|
||||||
Python::with_gil(|py| -> PyResult<Py<PyAny>> {
|
|
||||||
let module: PyResult<Py<PyAny>> = PyModule::from_code(
|
|
||||||
py,
|
|
||||||
&content,
|
|
||||||
&path,
|
|
||||||
&path,
|
|
||||||
// !!!! 请注意, 一定要给他一个名字, cpython 会自动把后面的重名模块覆盖掉前面的
|
|
||||||
)
|
|
||||||
.map(|module| module.into());
|
|
||||||
module
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 传入文件路径
|
/// 传入文件路径
|
||||||
/// 返回 hash 和 文件内容
|
/// 返回 hash 和 文件内容
|
||||||
pub fn load_py_file(path: &PathBuf) -> std::io::Result<(Option<SystemTime>, String)> {
|
pub fn load_py_file(path: &PathBuf) -> std::io::Result<(Option<SystemTime>, String)> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user