From b96f62d9c5af686ea4063965beb63f4c2ed424ec Mon Sep 17 00:00:00 2001 From: ShellWen Date: Fri, 6 Oct 2023 19:25:59 +0800 Subject: [PATCH] :construction_worker: Add GitHub Actions support --- .github/workflows/build.yaml | 21 +++++++++++++++++++++ .github/workflows/clippy_check.yaml | 20 ++++++++++++++++++++ .github/workflows/rustfmt.yaml | 17 +++++++++++++++++ crates/core/src/v8_exports.rs | 6 ++++-- 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/clippy_check.yaml create mode 100644 .github/workflows/rustfmt.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..6596e0e --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,21 @@ +on: [ push, pull_request ] + +name: CI + +jobs: + build: + name: build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - name: Build + run: cargo build --release + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.os }}-release + path: target/release/ diff --git a/.github/workflows/clippy_check.yaml b/.github/workflows/clippy_check.yaml new file mode 100644 index 0000000..c5eb42c --- /dev/null +++ b/.github/workflows/clippy_check.yaml @@ -0,0 +1,20 @@ +on: [ push, pull_request ] + +name: Clippy check + +env: + RUSTFLAGS: "-Dwarnings" + +jobs: + clippy_check: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - name: Run Clippy + run: cargo clippy --all-targets --all-features \ No newline at end of file diff --git a/.github/workflows/rustfmt.yaml b/.github/workflows/rustfmt.yaml new file mode 100644 index 0000000..78713d3 --- /dev/null +++ b/.github/workflows/rustfmt.yaml @@ -0,0 +1,17 @@ +on: [ push, pull_request ] + +name: Rustfmt + +jobs: + rustfmt: + name: rustfmt + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest ] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - run: cargo fmt --all -- --check diff --git a/crates/core/src/v8_exports.rs b/crates/core/src/v8_exports.rs index 8445a6b..e1af6df 100644 --- a/crates/core/src/v8_exports.rs +++ b/crates/core/src/v8_exports.rs @@ -11,7 +11,8 @@ pub const V8_STRING_UTF8LENGTH_SYMBOL: &str = "?Utf8Length@String@v8@@QEBAHPEAVI #[cfg(any(target_os = "linux", target_os = "macos"))] pub const V8_STRING_WRITE_UTF8_SYMBOL: &str = "_ZNK2v86String9WriteUtf8EPNS_7IsolateEPciPii"; #[cfg(target_os = "windows")] -pub const V8_STRING_WRITE_UTF8_SYMBOL: &str = "?WriteUtf8@String@v8@@QEBAHPEAVIsolate@2@PEADHPEAHH@Z"; +pub const V8_STRING_WRITE_UTF8_SYMBOL: &str = + "?WriteUtf8@String@v8@@QEBAHPEAVIsolate@2@PEADHPEAHH@Z"; #[cfg(any(target_os = "linux", target_os = "macos"))] pub const V8_CONTEXT_GET_ISOLATE_SYMBOL: &str = "_ZN2v87Context10GetIsolateEv"; @@ -19,6 +20,7 @@ pub const V8_CONTEXT_GET_ISOLATE_SYMBOL: &str = "_ZN2v87Context10GetIsolateEv"; pub const V8_CONTEXT_GET_ISOLATE_SYMBOL: &str = "?GetIsolate@Context@v8@@QEAAPEAVIsolate@2@XZ"; #[cfg(any(target_os = "linux", target_os = "macos"))] -pub const V8_STRING_NEW_FROM_UTF8_PTR: &str = "_ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi"; +pub const V8_STRING_NEW_FROM_UTF8_PTR: &str = + "_ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi"; #[cfg(target_os = "windows")] pub const V8_STRING_NEW_FROM_UTF8_PTR: &str = "?NewFromUtf8@String@v8@@SA?AV?$MaybeLocal@VString@v8@@@2@PEAVIsolate@2@PEBDW4NewStringType@2@H@Z";