Skip to content

Commit 71fac53

Browse files
committed
CASSNODEJS-12: Deno and Bun support
patch by Jane He; reviewed by Jorge Bay
1 parent 6f563cc commit 71fac53

5 files changed

Lines changed: 174 additions & 242 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Set up Bun
2+
description: Install Bun from the official install script
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install Bun
8+
shell: bash
9+
run: |
10+
export BUN_INSTALL="$HOME/.bun"
11+
curl -fsSL https://bun.com/install | bash
12+
echo "BUN_INSTALL=$BUN_INSTALL" >> "$GITHUB_ENV"
13+
echo "$BUN_INSTALL/bin" >> "$GITHUB_PATH"
14+
"$BUN_INSTALL/bin/bun" --version
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Set up CCM for integration tests
2+
description: >
3+
Install ccm and its Python toolchain, the Zulu JDKs Cassandra needs,
4+
SSL certificates, Simulacron, and pre-download the Cassandra distribution.
5+
6+
inputs:
7+
server-version:
8+
description: 'Cassandra minor version (e.g. "4.1"); resolved to the latest patch release.'
9+
required: true
10+
11+
runs:
12+
using: composite
13+
steps:
14+
# ---- Python for ccm ----
15+
- name: Set up Python 3.9.16
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.9.16"
19+
20+
- name: Install ccm
21+
shell: bash
22+
run: |
23+
python -m pip install --upgrade pip
24+
git clone --depth 1 --single-branch -b cassandra-test https://github.com/apache/cassandra-ccm.git
25+
cd cassandra-ccm
26+
pip install -r requirements.txt
27+
./setup.py install
28+
29+
# ---- Install required Zulu JDKs (8/11/17) and capture their homes ----
30+
- name: Install Zulu 11
31+
id: z11
32+
uses: actions/setup-java@v5
33+
with:
34+
distribution: zulu
35+
java-version: "11"
36+
37+
- name: Install Zulu 17
38+
id: z17
39+
uses: actions/setup-java@v5
40+
with:
41+
distribution: zulu
42+
java-version: "17"
43+
44+
- name: Install Zulu 8
45+
id: z8
46+
uses: actions/setup-java@v5
47+
with:
48+
distribution: zulu
49+
java-version: "8"
50+
51+
- name: Export JAVA*_HOME variables
52+
shell: bash
53+
run: |
54+
echo "JAVA8_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
55+
echo "JAVA11_HOME=${{ steps.z11.outputs.path }}" >> "$GITHUB_ENV"
56+
echo "JAVA17_HOME=${{ steps.z17.outputs.path }}" >> "$GITHUB_ENV"
57+
echo "JAVA_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
58+
echo "CCM_UPDATE_PID_DEFAULT_TIMEOUT=120" >> "$GITHUB_ENV"
59+
60+
- name: Generate SSL certificates
61+
shell: bash
62+
run: |
63+
mkdir -p /home/runner/workspace/tools/ccm/ssl/
64+
cd /home/runner/workspace/tools/ccm/ssl/
65+
keytool -genkey \
66+
-keyalg RSA \
67+
-alias cassandra \
68+
-keystore keystore.jks \
69+
-storepass cassandra \
70+
-keypass cassandra \
71+
-validity 364635 \
72+
-dname "CN=Jane He, OU=TE, O=ASF, L=Santa Clara, ST=CA, C=TE"
73+
keytool -export \
74+
-alias cassandra \
75+
-file cassandra.crt \
76+
-keystore keystore.jks \
77+
-storepass cassandra
78+
openssl x509 \
79+
-inform der \
80+
-in cassandra.crt \
81+
-out cassandra.pem
82+
keytool -genkeypair \
83+
-keyalg RSA \
84+
-alias client \
85+
-keystore truststore.jks \
86+
-storepass cassandra \
87+
-keypass cassandra \
88+
-validity 364635 \
89+
-dname "CN=Philip Thompson, OU=TE, O=DataStax, L=Santa Clara, ST=CA, C=TE"
90+
keytool -importkeystore \
91+
-srckeystore truststore.jks \
92+
-destkeystore client.p12 \
93+
-srcstorepass cassandra \
94+
-deststorepass cassandra \
95+
-deststoretype PKCS12
96+
openssl pkcs12 \
97+
-in client.p12 \
98+
-passin pass:cassandra \
99+
-nokeys \
100+
-out client_cert.pem -legacy
101+
openssl pkcs12 \
102+
-in client.p12 \
103+
-passin pass:cassandra \
104+
-nodes \
105+
-nocerts \
106+
-out client_key.pem -legacy
107+
108+
- name: Install Simulacron
109+
shell: bash
110+
run: |
111+
wget https://github.com/datastax/simulacron/releases/download/0.12.0/simulacron-standalone-0.12.0.jar -O /home/runner/simulacron.jar
112+
113+
- name: Resolve Cassandra latest patch version
114+
shell: bash
115+
env:
116+
SERVER_VERSION: ${{ inputs.server-version }}
117+
run: |
118+
PATCH_SERVER_VERSION=$(
119+
curl -s https://downloads.apache.org/cassandra/ \
120+
| grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=)' \
121+
| sort -rV \
122+
| uniq -w 3 \
123+
| grep "^${SERVER_VERSION}\."
124+
)
125+
echo "Resolved Cassandra ${SERVER_VERSION}.x -> ${PATCH_SERVER_VERSION}"
126+
echo "CCM_VERSION=$PATCH_SERVER_VERSION" >> "$GITHUB_ENV"
127+
128+
- name: Print environment
129+
shell: bash
130+
run: printenv | sort
131+
132+
- name: Pre-download Cassandra distribution
133+
shell: bash
134+
run: |
135+
ccm create predownload -v $CCM_VERSION
136+
ccm remove
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Set up Deno
2+
description: Install Deno from the official install script (no third-party actions)
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install Deno
8+
shell: bash
9+
run: |
10+
export DENO_INSTALL="$HOME/.deno"
11+
curl -fsSL https://deno.land/install.sh | sh
12+
echo "DENO_INSTALL=$DENO_INSTALL" >> "$GITHUB_ENV"
13+
echo "$DENO_INSTALL/bin" >> "$GITHUB_PATH"
14+
"$DENO_INSTALL/bin/deno" --version

.github/workflows/integration-bun-deno.yml

Lines changed: 5 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -24,135 +24,19 @@ jobs:
2424
- name: Checkout
2525
uses: actions/checkout@v4
2626

27-
# ---- Python for ccm ----
28-
- name: Set up Python 3.9.16
29-
uses: actions/setup-python@v5
27+
- name: Set up CCM
28+
uses: ./.github/actions/setup-ccm
3029
with:
31-
python-version: "3.9.16"
32-
33-
- name: Install ccm
34-
run: |
35-
python -m pip install --upgrade pip
36-
git clone --depth 1 --single-branch -b cassandra-test https://github.com/apache/cassandra-ccm.git
37-
cd cassandra-ccm
38-
pip install -r requirements.txt
39-
./setup.py install
40-
41-
# ---- Install required Zulu JDKs (8/11/17) and capture their homes ----
42-
- name: Install Zulu 11
43-
id: z11
44-
uses: actions/setup-java@v5
45-
with:
46-
distribution: zulu
47-
java-version: "11"
48-
49-
- name: Install Zulu 17
50-
id: z17
51-
uses: actions/setup-java@v5
52-
with:
53-
distribution: zulu
54-
java-version: "17"
55-
56-
- name: Install Zulu 8
57-
id: z8
58-
uses: actions/setup-java@v5
59-
with:
60-
distribution: zulu
61-
java-version: "8"
62-
63-
- name: Export JAVA*_HOME variables
64-
run: |
65-
echo "JAVA8_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
66-
echo "JAVA11_HOME=${{ steps.z11.outputs.path }}" >> "$GITHUB_ENV"
67-
echo "JAVA17_HOME=${{ steps.z17.outputs.path }}" >> "$GITHUB_ENV"
68-
echo "JAVA_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
69-
echo "CCM_UPDATE_PID_DEFAULT_TIMEOUT=120" >> "$GITHUB_ENV"
70-
71-
- name: Generate SSL certificates
72-
run: |
73-
mkdir -p /home/runner/workspace/tools/ccm/ssl/
74-
cd /home/runner/workspace/tools/ccm/ssl/
75-
keytool -genkey \
76-
-keyalg RSA \
77-
-alias cassandra \
78-
-keystore keystore.jks \
79-
-storepass cassandra \
80-
-keypass cassandra \
81-
-validity 364635 \
82-
-dname "CN=Jane He, OU=TE, O=ASF, L=Santa Clara, ST=CA, C=TE"
83-
keytool -export \
84-
-alias cassandra \
85-
-file cassandra.crt \
86-
-keystore keystore.jks \
87-
-storepass cassandra
88-
openssl x509 \
89-
-inform der \
90-
-in cassandra.crt \
91-
-out cassandra.pem
92-
keytool -genkeypair \
93-
-keyalg RSA \
94-
-alias client \
95-
-keystore truststore.jks \
96-
-storepass cassandra \
97-
-keypass cassandra \
98-
-validity 364635 \
99-
-dname "CN=Philip Thompson, OU=TE, O=DataStax, L=Santa Clara, ST=CA, C=TE"
100-
keytool -importkeystore \
101-
-srckeystore truststore.jks \
102-
-destkeystore client.p12 \
103-
-srcstorepass cassandra \
104-
-deststorepass cassandra \
105-
-deststoretype PKCS12
106-
openssl pkcs12 \
107-
-in client.p12 \
108-
-passin pass:cassandra \
109-
-nokeys \
110-
-out client_cert.pem -legacy
111-
openssl pkcs12 \
112-
-in client.p12 \
113-
-passin pass:cassandra \
114-
-nodes \
115-
-nocerts \
116-
-out client_key.pem -legacy
117-
118-
- name: Install Simulacron
119-
run: |
120-
wget https://github.com/datastax/simulacron/releases/download/0.12.0/simulacron-standalone-0.12.0.jar -O /home/runner/simulacron.jar
30+
server-version: ${{ matrix.SERVER_VERSION }}
12131

12232
# ---- Set up the runtime under test ----
12333
- name: Set up Bun
12434
if: matrix.RUNTIME == 'bun'
125-
uses: oven-sh/setup-bun@v2
126-
with:
127-
bun-version: latest
35+
uses: ./.github/actions/setup-bun
12836

12937
- name: Set up Deno
13038
if: matrix.RUNTIME == 'deno'
131-
uses: denoland/setup-deno@v2
132-
with:
133-
deno-version: latest
134-
135-
- name: Resolve Cassandra latest patch version
136-
env:
137-
SERVER_VERSION: ${{ matrix.SERVER_VERSION }}
138-
run: |
139-
PATCH_SERVER_VERSION=$(
140-
curl -s https://downloads.apache.org/cassandra/ \
141-
| grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=)' \
142-
| sort -rV \
143-
| uniq -w 3 \
144-
| grep "^${SERVER_VERSION}\."
145-
)
146-
echo "Resolved Cassandra ${SERVER_VERSION}.x -> ${PATCH_SERVER_VERSION}"
147-
echo "CCM_VERSION=$PATCH_SERVER_VERSION" >> "$GITHUB_ENV"
148-
149-
- name: Print environment
150-
run: printenv | sort
151-
152-
- name: Pre-download Cassandra distribution
153-
run: |
154-
ccm create predownload -v $CCM_VERSION
155-
ccm remove
39+
uses: ./.github/actions/setup-deno
15640

15741
- name: Run integration tests (${{ matrix.RUNTIME }})
15842
run: |

0 commit comments

Comments
 (0)