Skip to content

Commit 72cc8fa

Browse files
committed
windows build
1 parent 20a6e9c commit 72cc8fa

File tree

3 files changed

+30
-9
lines changed

3 files changed

+30
-9
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
os: [ubuntu-latest, macos-latest]
13+
os: [ubuntu-latest, macos-latest, windows-latest]
1414
feature: [lua54, lua53, lua52, lua51, luajit]
1515
runs-on: ${{ matrix.os }}
1616

@@ -24,19 +24,27 @@ jobs:
2424
run: cargo build --release --features ${{ matrix.feature }}
2525

2626
- name: Prepare artifact
27+
shell: bash
2728
run: |
2829
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
2930
OS="linux"
3031
EXT="so"
31-
else
32+
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
3233
OS="macOS"
3334
EXT="dylib"
35+
else
36+
OS="windows"
37+
EXT="dll"
3438
fi
3539
mkdir -p artifacts
36-
cp target/release/libtiktoken_core.$EXT artifacts/tiktoken_core-$OS-${{ matrix.feature }}.$EXT
40+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
41+
cp target/release/tiktoken_core.$EXT artifacts/tiktoken_core-$OS-${{ matrix.feature }}.$EXT
42+
else
43+
cp target/release/libtiktoken_core.$EXT artifacts/tiktoken_core-$OS-${{ matrix.feature }}.$EXT
44+
fi
3745
3846
- name: Upload artifact
3947
uses: actions/upload-artifact@v4
4048
with:
4149
name: tiktoken_core-${{ matrix.os }}-${{ matrix.feature }}
42-
path: artifacts/tiktoken_core-*.${{ matrix.os == 'ubuntu-latest' && 'so' || 'dylib' }}
50+
path: artifacts/tiktoken_core-*.${{ matrix.os == 'ubuntu-latest' && 'so' || matrix.os == 'macos-latest' && 'dylib' || 'dll' }}

.github/workflows/release.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ jobs:
99
build_and_release:
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest, macos-latest]
12+
os: [ubuntu-latest, macos-latest, windows-latest]
1313
feature: [lua54, lua53, lua52, lua51, luajit]
1414
arch: [x86_64, aarch64]
15+
exclude:
16+
- os: windows-latest
17+
arch: aarch64
18+
1519
runs-on: ${{ matrix.os }}
1620

1721
steps:
@@ -20,7 +24,7 @@ jobs:
2024
- name: Install Rust
2125
uses: dtolnay/rust-toolchain@stable
2226
with:
23-
targets: ${{ matrix.arch }}-${{ matrix.os == 'ubuntu-latest' && 'unknown-linux-gnu' || 'apple-darwin' }}
27+
targets: ${{ matrix.arch }}-${{ matrix.os == 'ubuntu-latest' && 'unknown-linux-gnu' || matrix.os == 'macos-latest' && 'apple-darwin' || 'pc-windows-msvc' }}
2428

2529
- name: Install cross-compilation tools (Linux ARM64)
2630
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'aarch64'
@@ -29,6 +33,7 @@ jobs:
2933
sudo apt-get install -y gcc-aarch64-linux-gnu
3034
3135
- name: Build
36+
shell: bash
3237
run: |
3338
if [ "${{ matrix.arch }}" == "aarch64" ]; then
3439
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
@@ -41,13 +46,17 @@ jobs:
4146
fi
4247
4348
- name: Prepare artifact
49+
shell: bash
4450
run: |
4551
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
4652
OS="linux"
4753
EXT="so"
48-
else
54+
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
4955
OS="macOS"
5056
EXT="dylib"
57+
else
58+
OS="windows"
59+
EXT="dll"
5160
fi
5261
ARCH="${{ matrix.arch == 'x86_64' && 'x86_64' || 'arm64' }}"
5362
mkdir -p artifacts
@@ -58,7 +67,11 @@ jobs:
5867
cp target/aarch64-apple-darwin/release/libtiktoken_core.$EXT artifacts/tiktoken_core-$OS-$ARCH-${{ matrix.feature }}.$EXT
5968
fi
6069
else
61-
cp target/release/libtiktoken_core.$EXT artifacts/tiktoken_core-$OS-$ARCH-${{ matrix.feature }}.$EXT
70+
if [ "${{ matrix.os }}" == "windows-latest" ]; then
71+
cp target/release/tiktoken_core.$EXT artifacts/tiktoken_core-$OS-$ARCH-${{ matrix.feature }}.$EXT
72+
else
73+
cp target/release/libtiktoken_core.$EXT artifacts/tiktoken_core-$OS-$ARCH-${{ matrix.feature }}.$EXT
74+
fi
6275
fi
6376
6477
- name: Upload artifacts

tiktoken_core-0.2.2-1.rockspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version = "0.2.2-1"
33

44
source = {
55
url = "git+https://github.com/gptlang/lua-tiktoken",
6-
tag = "0.2.2",
6+
tag = "v0.2.2",
77
}
88

99
description = {

0 commit comments

Comments
 (0)