Skip to content

Commit 3bd0595

Browse files
Merge pull request #130 from godaddy/use-go-warmup-library
Add Bun runtime support via Go warmup library
2 parents 1c60761 + 778360a commit 3bd0595

File tree

3 files changed

+61
-5
lines changed

3 files changed

+61
-5
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,39 @@ jobs:
1313
options: --ulimit core=-1 --ulimit memlock=-1:-1
1414
steps:
1515
- uses: actions/checkout@v4
16+
- name: Install Bun
17+
run: |
18+
set -e # Exit on error
19+
# GitHub Actions containers set HOME=/github/home
20+
export BUN_INSTALL="/github/home/.bun"
21+
echo "Installing Bun to $BUN_INSTALL..."
22+
curl -fsSL https://bun.sh/install | bash
23+
echo "Checking if Bun was installed..."
24+
ls -la /github/home/.bun/bin/ || echo "Bun directory not found at /github/home/.bun/bin/"
25+
# Try alternative location if primary fails
26+
if [ ! -f "/github/home/.bun/bin/bun" ]; then
27+
echo "Bun not at /github/home/.bun/bin/bun, checking $HOME/.bun/bin/bun..."
28+
ls -la $HOME/.bun/bin/ || echo "Bun not at $HOME/.bun/bin/ either"
29+
if [ -f "$HOME/.bun/bin/bun" ]; then
30+
cp $HOME/.bun/bin/bun /usr/local/bin/bun
31+
else
32+
echo "ERROR: Could not find Bun binary after installation"
33+
exit 1
34+
fi
35+
else
36+
cp /github/home/.bun/bin/bun /usr/local/bin/bun
37+
fi
38+
chmod +x /usr/local/bin/bun
39+
/usr/local/bin/bun --version
1640
- name: Install packages
1741
run: npm install
42+
- name: Verify Bun is available
43+
run: |
44+
echo "Checking Bun availability..."
45+
ls -la /usr/local/bin/bun || echo "/usr/local/bin/bun not found"
46+
which bun || echo "bun not in PATH"
47+
/usr/local/bin/bun --version || echo "Cannot run /usr/local/bin/bun"
48+
bun --version || echo "Cannot run bun directly"
1849
- name: Test
1950
run: npm test
2051
- name: Set version to match tag

.github/workflows/test.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,28 @@ jobs:
3232
- uses: actions/checkout@v4
3333
- name: Install Bun
3434
run: |
35+
set -e # Exit on error
36+
# GitHub Actions containers set HOME=/github/home
37+
export BUN_INSTALL="/github/home/.bun"
38+
echo "Installing Bun to $BUN_INSTALL..."
3539
curl -fsSL https://bun.sh/install | bash
36-
export PATH="$HOME/.bun/bin:$PATH"
37-
echo "PATH=$HOME/.bun/bin:$PATH" >> $GITHUB_ENV
38-
bun --version
40+
echo "Checking if Bun was installed..."
41+
ls -la /github/home/.bun/bin/ || echo "Bun directory not found at /github/home/.bun/bin/"
42+
# Try alternative location if primary fails
43+
if [ ! -f "/github/home/.bun/bin/bun" ]; then
44+
echo "Bun not at /github/home/.bun/bin/bun, checking $HOME/.bun/bin/bun..."
45+
ls -la $HOME/.bun/bin/ || echo "Bun not at $HOME/.bun/bin/ either"
46+
if [ -f "$HOME/.bun/bin/bun" ]; then
47+
cp $HOME/.bun/bin/bun /usr/local/bin/bun
48+
else
49+
echo "ERROR: Could not find Bun binary after installation"
50+
exit 1
51+
fi
52+
else
53+
cp /github/home/.bun/bin/bun /usr/local/bin/bun
54+
fi
55+
chmod +x /usr/local/bin/bun
56+
/usr/local/bin/bun --version
3957
- name: Install npm packages
4058
run: npm install
4159
- name: Unit Test (includes Bun test via posttest)

scripts/runs-on-emulated.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ cd /build || exit 1
33

44
# Install Bun for multi-arch testing
55
echo "Installing Bun..."
6+
# In Docker containers, HOME is usually /root
7+
export BUN_INSTALL="/root/.bun"
68
curl -fsSL https://bun.sh/install | bash
7-
export PATH="$HOME/.bun/bin:$PATH"
8-
bun --version
9+
10+
# Make Bun available for npm scripts
11+
mkdir -p /usr/local/bin
12+
cp /root/.bun/bin/bun /usr/local/bin/bun
13+
chmod +x /usr/local/bin/bun
14+
echo "Bun installed and copied to /usr/local/bin"
15+
/usr/local/bin/bun --version
916

1017
# Run npm install and tests
1118
npm install

0 commit comments

Comments
 (0)