Skip to content

Commit 04470bb

Browse files
Fix CI
1 parent 811a52f commit 04470bb

File tree

6 files changed

+52
-80
lines changed

6 files changed

+52
-80
lines changed

.github/workflows/build.yml

+25
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
arch:
1212
required: true
1313
type: string
14+
release:
15+
required: false
16+
type: string
1417

1518
jobs:
1619
build:
@@ -85,3 +88,25 @@ jobs:
8588
qemu-user
8689
8790
make CURRENT_TARGET=aarch64-unknown-linux-gnu test-ci
91+
- name: Build Linux binaries
92+
if: inputs.release && inputs.platform == 'linux'
93+
run: |
94+
make llrt-lambda-${{ inputs.release }}.zip
95+
make release-${{ inputs.release }}
96+
- name: Build Darwin binaries
97+
if: inputs.release && inputs.platform == 'darwin'
98+
run: |
99+
make llrt-darwin-${{ inputs.release }}.zip
100+
- name: Upload artifacts
101+
if: inputs.release
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: artifacts-${{ inputs.platform }}
105+
path: |
106+
*.zip
107+
- name: Upload changelog
108+
if: inputs.release && inputs.platform == 'linux' && inputs.arch == 'x86_64'
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: changelog
112+
path: CHANGELOG.md

.github/workflows/release.yml

+8-43
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,33 @@ on:
55
- "v*.*.*"
66

77
jobs:
8-
prebuild:
8+
build:
99
strategy:
1010
fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }}
1111
matrix:
1212
include:
1313
- os: ubuntu-latest
1414
platform: linux
1515
arch: x86_64
16+
release: x64
1617
- os: ubuntu-latest
1718
platform: linux
1819
arch: aarch64
20+
release: arm64
1921
- os: macos-latest
2022
platform: darwin
2123
arch: x86_64
24+
release: x64
2225
- os: macos-latest
2326
platform: darwin
2427
arch: aarch64
28+
release: arm64
2529
uses: ./.github/workflows/build.yml
2630
with:
2731
os: ${{ matrix.os }}
2832
platform: ${{ matrix.platform }}
2933
arch: ${{ matrix.arch }}
30-
build:
31-
needs:
32-
- prebuild
33-
strategy:
34-
fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }}
35-
matrix:
36-
include:
37-
- os: ubuntu-latest
38-
platform: linux
39-
arch: x86_64
40-
- os: ubuntu-latest
41-
platform: linux
42-
arch: aarch64
43-
- os: macos-latest
44-
platform: darwin
45-
arch: x86_64
46-
- os: macos-latest
47-
platform: darwin
48-
arch: aarch64
49-
runs-on: ${{ matrix.os }}
50-
steps:
51-
- name: Build binaries
52-
run: |
53-
make release
54-
- name: Build Lambda binaries
55-
if: matrix.platform == 'linux'
56-
run: |
57-
make release-lambda
58-
- name: Upload artifacts
59-
uses: actions/upload-artifact@v4
60-
with:
61-
name: artifacts-${{ matrix.platform }}
62-
path: |
63-
*.zip
64-
- name: Upload changelog
65-
if: matrix.platform == 'linux' && matrix.arch == 'x86_64'
66-
uses: actions/upload-artifact@v4
67-
with:
68-
name: changelog
69-
path: CHANGELOG.md
34+
release: ${{ matrix.release }}
7035
release:
7136
permissions:
7237
contents: write
@@ -87,5 +52,5 @@ jobs:
8752
./artifacts-linux/llrt-lambda-arm64.zip
8853
./artifacts-linux/llrt-linux-x64.zip
8954
./artifacts-linux/llrt-linux-arm64.zip
90-
./artifacts-darwin/llrt-macos-x64.zip
91-
./artifacts-darwin/llrt-macos-arm64.zip
55+
./artifacts-darwin/llrt-darwin-x64.zip
56+
./artifacts-darwin/llrt-darwin-arm64.zip

Makefile

+14-32
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TOOLCHAIN = +$(RUST_VERSION)
77
BUILD_ARG = $(TOOLCHAIN) build -r
88
BUILD_DIR = ./target/release
99
BUNDLE_DIR = bundle
10-
ZSTD_LIB_ARGS = -j lib-nomt CC="$(CURDIR)/zigcc -s -O3 -flto" UNAME=Linux ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0
10+
ZSTD_LIB_ARGS = -j lib-nomt CC="$(CURDIR)/zigcc -s -O3 -flto" AR="zig ar" UNAME=Linux ZSTD_LIB_COMPRESSION=0 ZSTD_LIB_DICTBUILDER=0
1111

1212
TS_SOURCES = $(wildcard src/js/*.ts) $(wildcard src/js/@llrt/*.ts) $(wildcard tests/*.ts)
1313
STD_JS_FILE = $(BUNDLE_DIR)/@llrt/std.js
@@ -50,28 +50,25 @@ CURRENT_TARGET ?= $(TARGET_$(DETECTED_OS)_$(ARCH))
5050

5151
export COMPILE_TARGET = $(CURRENT_TARGET)
5252

53-
lambda-all: clean-js | libs $(RELEASE_ZIPS)
54-
release-all: clean-js | lambda-all llrt-linux-x64.zip llrt-linux-arm64.zip llrt-darwin-x64.zip llrt-darwin-arm64.zip
53+
lambda-all: libs $(RELEASE_ZIPS)
54+
release-all: | lambda-all llrt-linux-x64.zip llrt-linux-arm64.zip llrt-darwin-x64.zip llrt-darwin-arm64.zip
55+
release: llrt-$(DETECTED_OS)-$(ARCH).zip
56+
release-linux: | lambda-all llrt-linux-x64.zip llrt-linux-arm64.zip
57+
release-darwin: | llrt-darwin-x64.zip llrt-darwin-arm64.zip
5558

56-
release-lambda: clean-js | libs-$(ARCH) $(LAMBDA_PREFIX)-$(DETECTED_OS)-$(ARCH).zip
57-
release: clean-js | llrt-$(DETECTED_OS)-$(ARCH).zip
58-
59-
release-linux: clean-js | lambda-all llrt-linux-x64.zip llrt-linux-arm64.zip
60-
release-darwin: clean-js | llrt-darwin-x64.zip llrt-darwin-arm64.zip
61-
62-
llrt-darwin-x64.zip: js
59+
llrt-darwin-x64.zip: | clean-js js
6360
cargo $(BUILD_ARG) --target $(TARGET_darwin_x86_64)
6461
zip -j $@ target/$(TARGET_darwin_x86_64)/release/llrt
6562

66-
llrt-darwin-arm64.zip: js
63+
llrt-darwin-arm64.zip: | clean-js js
6764
cargo $(BUILD_ARG) --target $(TARGET_darwin_arm64)
6865
zip -j $@ target/$(TARGET_darwin_arm64)/release/llrt
6966

70-
llrt-linux-x64.zip: js
67+
llrt-linux-x64.zip: | clean-js js
7168
cargo $(BUILD_ARG) --target $(TARGET_linux_x86_64)
7269
zip -j $@ target/$(TARGET_linux_x86_64)/release/llrt
7370

74-
llrt-linux-arm64.zip: js
71+
llrt-linux-arm64.zip: | clean-js js
7572
cargo $(BUILD_ARG) --target $(TARGET_linux_arm64)
7673
zip -j $@ target/$(TARGET_linux_arm64)/release/llrt
7774

@@ -80,7 +77,7 @@ release-${1}: js
8077
COMPILE_TARGET=$$(TARGET_linux_$$(RELEASE_ARCH_NAME_${1})) cargo $$(BUILD_ARG) --target $$(TARGET_linux_$$(RELEASE_ARCH_NAME_${1})) --features lambda -vv
8178
./pack target/$$(TARGET_linux_$$(RELEASE_ARCH_NAME_${1}))/release/llrt target/$$(TARGET_linux_$$(RELEASE_ARCH_NAME_${1}))/release/bootstrap
8279
@rm -rf llrt-lambda-${1}.zip
83-
zip -j llrt-lambda-${1}.zip target/$$(TARGET_linux_$$(RELEASE_ARCH_NAME_${1}))/release/bootstrap index.mjs
80+
zip -j llrt-lambda-${1}.zip target/$$(TARGET_linux_$$(RELEASE_ARCH_NAME_${1}))/release/bootstrap
8481

8582
llrt-lambda-${1}: release-${1}
8683
endef
@@ -115,18 +112,11 @@ js: $(STD_JS_FILE)
115112
bundle/%.js: $(TS_SOURCES)
116113
node build.mjs
117114

118-
patch:
119-
cargo clean -p rquickjs-sys
120-
cargo patch
121-
122115
fix:
123116
cargo fix --allow-dirty
124117
cargo clippy --fix --allow-dirty
125118
cargo fmt
126119

127-
linux-flame: js
128-
cargo build --profile=flame --target $(TARGET_linux_x86_64)
129-
130120
bloat: js
131121
cargo build --profile=flame --target $(TARGET_linux_x86_64)
132122
cargo bloat --profile=flame --crates
@@ -136,20 +126,12 @@ run: export AWS_LAMBDA_FUNCTION_MEMORY_SIZE = 1
136126
run: export AWS_LAMBDA_FUNCTION_VERSION = 1
137127
run: export AWS_LAMBDA_RUNTIME_API = localhost:3000
138128
run: export _EXIT_ITERATIONS = 1
139-
run: export AWS_REGION=eu-north-1
140-
run: export TABLE_NAME=quickjs-table
141-
run: export BUCKET_NAME=llrt-demo-bucket2
142129
run: export JS_MINIFY = 0
143130
run: export RUST_LOG = llrt=trace
144131
run: export _HANDLER = index.handler
145-
run: js
132+
run: | clean-js js
146133
cargo run -r -vv
147134

148-
run-js: export _HANDLER = index.handler
149-
run-js:
150-
touch build.rs
151-
cargo run
152-
153135
run-release: export _HANDLER = fixtures/local.handler
154136
run-release: js
155137
cargo build
@@ -193,13 +175,13 @@ lib/zstd.h:
193175
lib/arm64/libzstd.a:
194176
mkdir -p $(dir $@)
195177
rm -f zstd/lib/-.o
196-
cd zstd/lib && make clean && COMPILE_TARGET=$(TARGET_linux_arm64) make $(ZSTD_LIB_ARGS)
178+
cd zstd/lib && make clean && COMPILE_TARGET="aarch64-unknown-linux-musl" make $(ZSTD_LIB_ARGS)
197179
cp zstd/lib/libzstd.a $@
198180

199181
lib/x64/libzstd.a:
200182
mkdir -p $(dir $@)
201183
rm -f zstd/lib/-.o
202-
cd zstd/lib && make clean && COMPILE_TARGET=$(TARGET_linux_x86_64) make $(ZSTD_LIB_ARGS)
184+
cd zstd/lib && make clean && COMPILE_TARGET="x86_64-unknown-linux-musl" make $(ZSTD_LIB_ARGS)
203185
cp zstd/lib/libzstd.a $@
204186

205187
bench:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Install dependencies
188188
# MacOS
189189
brew install zig make zstd node corepack
190190

191-
# Ubuntu x
191+
# Ubuntu
192192
sudo apt -y install make zstd gcc \
193193
libc6-arm64-cross \
194194
libc6-dev-arm64-cross \

pack

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ fi
2424
arch_hex=$(hexdump -s 18 -n 1 -e '"%02x"' $srcfile)
2525

2626
if [[ "$arch_hex" == "3e" ]]; then
27-
target="x86_64-linux-gnu"
27+
target="x86_64-linux-musl"
2828
arch="x64"
2929
elif [[ "$arch_hex" == "b7" ]]; then
30-
target="aarch64-linux-gnu"
30+
target="aarch64-linux-musl"
3131
arch="arm64"
3232
else
3333
echo "The binary is not an ARM64 or X86_64 ELF executable"
@@ -97,7 +97,7 @@ echo "Compiling..."
9797

9898
original_size=$(du -h $srcfile | cut -f1)
9999

100-
zig cc -target $target -Wno-null-character -std=c99 -Wall -O3 -flto -s ${temp_folder}/main.c -o $dstfile -Ilib -Llib/${arch} -Wl,-Bstatic -lzstd -Wl,-Bdynamic -lpthread -lrt -lc
100+
zig cc -target $target -Wno-null-character -std=c99 -Wall -O3 -flto -s ${temp_folder}/main.c -o $dstfile -Ilib -Llib/${arch} -static -lzstd
101101

102102
new_size=$(du -h $dstfile | cut -f1)
103103

tests/compile.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe("llrt compile", async () => {
6666
assert.strictEqual(runResult.status, 0);
6767
});
6868

69-
it.only("can compile and run throws", async () => {
69+
it("can compile and run throws", async () => {
7070
const tmpOutput = `${tmpDir}/throws.lrt`;
7171

7272
const compileResult = await compile("fixtures/throw.js", tmpOutput);

0 commit comments

Comments
 (0)