diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8a32cf8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Build and Upload Artifacts + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + feature: [lua54, lua53, lua52, lua51, luajit, luajit52] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + + - name: Build + run: cargo build --release --features ${{ matrix.feature }} + + - name: Prepare artifact + run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then + OS="linux" + EXT="so" + else + OS="macOS" + EXT="dylib" + fi + mkdir -p artifacts + cp target/release/libtiktoken_core.$EXT artifacts/tiktoken_core-$OS-${{ matrix.feature }}.$EXT + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: tiktoken_core-${{ matrix.os }}-${{ matrix.feature }} + path: artifacts/tiktoken_core-*.${{ matrix.os == 'ubuntu-latest' && 'so' || 'dylib' }} diff --git a/Cargo.lock b/Cargo.lock index 9cff548..16a6ab1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,9 +88,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mlua" -version = "0.9.5" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3561f79659ff3afad7b25e2bf2ec21507fe601ebecb7f81088669ec4bfd51e" +checksum = "d111deb18a9c9bd33e1541309f4742523bfab01d276bfa9a27519f6de9c11dc7" dependencies = [ "bstr", "erased-serde", @@ -98,16 +98,16 @@ dependencies = [ "mlua_derive", "num-traits", "once_cell", - "rustc-hash", + "rustc-hash 2.0.0", "serde", "serde-value", ] [[package]] name = "mlua-sys" -version = "0.5.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2847b42764435201d8cbee1f517edb79c4cca4181877b90047587c89e1b7bce4" +checksum = "3ab7a5b4756b8177a2dfa8e0bbcde63bd4000afbc4ab20cbb68d114a25470f29" dependencies = [ "cc", "cfg-if", @@ -116,9 +116,9 @@ dependencies = [ [[package]] name = "mlua_derive" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaade5f94e5829db58791664ba98f35fea6a3ffebc783becb51dc97c7a21abee" +checksum = "09697a6cec88e7f58a02c7ab5c18c611c6907c8654613df9cc0192658a4fb859" dependencies = [ "proc-macro2", "quote", @@ -208,6 +208,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "serde" version = "1.0.197" @@ -258,7 +264,7 @@ dependencies = [ "fancy-regex", "mlua", "regex", - "rustc-hash", + "rustc-hash 1.1.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 855426b..d1c7b96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ name = "tiktoken_core" crate-type = ["cdylib"] [dependencies] -mlua = { version = "0.9.1", features = ["serialize", "module"] } +mlua = { version = "0.9.7", features = ["serialize", "module"] } # tiktoken dependencies fancy-regex = "0.11.0" regex = "1.8.3"