Skip to content

Commit f765f67

Browse files
v2 nightly support
1 parent e9eb5e8 commit f765f67

1 file changed

Lines changed: 59 additions & 8 deletions

File tree

‎action.yml‎

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,86 @@
11
name: setup-hacklang
22
description: Install HHVM and set up the Hack programming language environment
33
author: CodeWithSushil
4+
45
inputs:
56
hhvm-version:
67
description: The version of HHVM/Hack to install
7-
required: true
8+
required: false
89
default: latest
910

1011
branding:
11-
icon: 'code'
12+
icon: code
1213
color: purple
1314

1415
runs:
1516
using: composite
1617
steps:
17-
- name: Install HHVM
18+
- name: Install HHVM / Hack
19+
shell: bash
1820
run: |
1921
set -euxo pipefail
2022
2123
sudo apt-get update
22-
sudo apt-get install -y curl gnupg lsb-release ca-certificates composer php
24+
sudo apt-get install -y \
25+
curl \
26+
gnupg \
27+
ca-certificates \
28+
lsb-release
2329
2430
sudo mkdir -p /usr/share/keyrings
2531
32+
# Add HHVM GPG key
2633
curl -fsSL https://dl.hhvm.com/conf/hhvm.gpg.key | \
27-
gpg --dearmor | sudo tee /usr/share/keyrings/hhvm.gpg > /dev/null
34+
gpg --dearmor | \
35+
sudo tee /usr/share/keyrings/hhvm.gpg > /dev/null
36+
37+
# Detect distro
38+
if command -v lsb_release >/dev/null 2>&1; then
39+
DISTRO=$(lsb_release -cs)
40+
else
41+
DISTRO=$(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)
42+
fi
43+
44+
echo "Detected distro: $DISTRO"
2845
29-
DISTRO=$(lsb_release -cs)
46+
# Add HHVM repo
3047
echo "deb [signed-by=/usr/share/keyrings/hhvm.gpg] https://dl.hhvm.com/ubuntu ${DISTRO} main" | \
31-
sudo tee /etc/apt/sources.list.d/hhvm.list
48+
sudo tee /etc/apt/sources.list.d/hhvm.list
49+
3250
sudo apt-get update
33-
sudo apt-get install -y hhvm
3451
52+
INSTALL_SUCCESS=false
53+
54+
echo "➡️ Trying to install HHVM (stable)..."
55+
if [ "${{ inputs.hhvm-version }}" = "latest" ]; then
56+
if sudo apt-get install -y hhvm; then
57+
INSTALL_SUCCESS=true
58+
fi
59+
else
60+
if sudo apt-get install -y hhvm=${{ inputs.hhvm-version }}; then
61+
INSTALL_SUCCESS=true
62+
fi
63+
fi
64+
65+
# Fallback to nightly
66+
if [ "$INSTALL_SUCCESS" = false ]; then
67+
echo "⚠️ Stable HHVM install failed. Trying hhvm-nightly..."
68+
69+
sudo apt-get update
70+
if sudo apt-get install -y hhvm-nightly; then
71+
INSTALL_SUCCESS=true
72+
fi
73+
fi
74+
75+
# Final failure check
76+
if [ "$INSTALL_SUCCESS" = false ]; then
77+
echo "❌ Both hhvm and hhvm-nightly installation failed"
78+
exit 1
79+
fi
80+
81+
# Verify installation
3582
hhvm --version
83+
84+
# Runtime test
85+
echo '<?hh echo "Hack runtime OK\n";' > test.hack
86+
hhvm test.hack

0 commit comments

Comments
 (0)