Skip to content

Commit f5c907b

Browse files
authored
Add post-install test to make sure installation works on all supported platforms (#229)
* WIP: tests for debian-based OSes * Try with quoted OS names * Add alpine builds * Update alpine post-install * Add rhel block * Add macos block * Add Windows block * Remove unix specific line from pipeline * Add tempFolderPath to env * Enable install once * Fix windows error * Remove AlmaLinux/RockyLinux 9, split Debian block * Add node 23 to debian older tests * Address review comments
1 parent 540aa2b commit f5c907b

File tree

8 files changed

+264
-0
lines changed

8 files changed

+264
-0
lines changed

.semaphore/post_install.yml

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
version: v1.0
2+
name: post-install
3+
agent:
4+
machine:
5+
type: s1-prod-ubuntu22-04-amd64-1
6+
7+
global_job_config:
8+
prologue:
9+
commands:
10+
- checkout
11+
12+
auto_cancel:
13+
running:
14+
when: "branch != 'master'"
15+
16+
execution_time_limit:
17+
hours: 3
18+
19+
queue:
20+
- when: "branch != 'master'"
21+
processing: parallel
22+
23+
blocks:
24+
- name: "Debian-based OS (amd64)"
25+
dependencies: [ ]
26+
task:
27+
agent:
28+
machine:
29+
type: s1-prod-ubuntu22-04-amd64-1
30+
prologue:
31+
commands:
32+
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
33+
jobs:
34+
- name: "Install"
35+
matrix:
36+
- env_var: DOCKER_IMAGE
37+
values: ["debian:bullseye", "debian:bookworm", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04"]
38+
- env_var: NODE_VERSION
39+
values: ["18", "20", "21", "22", "23"]
40+
commands:
41+
- docker run -v "$(pwd):/v" "$DOCKER_IMAGE" /v/ci/post-install/install-debian.sh "$NODE_VERSION" "$LIBRARY_VERSION"
42+
43+
- name: "Debian-based OS (arm64)"
44+
dependencies: [ ]
45+
task:
46+
agent:
47+
machine:
48+
type: s1-prod-ubuntu22-04-arm64-1
49+
prologue:
50+
commands:
51+
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
52+
jobs:
53+
- name: "Install"
54+
matrix:
55+
- env_var: DOCKER_IMAGE
56+
values: ["debian:bullseye", "debian:bookworm", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04"]
57+
- env_var: NODE_VERSION
58+
values: ["18", "20", "21", "22", "23"]
59+
commands:
60+
- docker run -v "$(pwd):/v" "$DOCKER_IMAGE" /v/ci/post-install/install-debian.sh "$NODE_VERSION" "$LIBRARY_VERSION"
61+
62+
- name: "Alpine-based OS (amd64)"
63+
dependencies: [ ]
64+
task:
65+
agent:
66+
machine:
67+
type: s1-prod-ubuntu22-04-amd64-1
68+
prologue:
69+
commands:
70+
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
71+
jobs:
72+
- name: "Install"
73+
matrix:
74+
- env_var: NODE_VERSION
75+
values: ["18", "20", "21", "22", "23"]
76+
commands:
77+
- docker run -v "$(pwd):/v" "node:${NODE_VERSION}-alpine" /v/ci/post-install/install-alpine.sh "$NODE_VERSION" "$LIBRARY_VERSION"
78+
79+
- name: "Alpine-based OS (arm64)"
80+
dependencies: [ ]
81+
task:
82+
agent:
83+
machine:
84+
type: s1-prod-ubuntu22-04-arm64-1
85+
prologue:
86+
commands:
87+
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
88+
jobs:
89+
- name: "Install"
90+
matrix:
91+
- env_var: NODE_VERSION
92+
values: ["18", "20", "21", "22", "23"]
93+
commands:
94+
- docker run -v "$(pwd):/v" "node:${NODE_VERSION}-alpine" /v/ci/post-install/install-alpine.sh "$NODE_VERSION" "$LIBRARY_VERSION"
95+
96+
- name: "RHEL-based OS (amd64)"
97+
dependencies: [ ]
98+
task:
99+
agent:
100+
machine:
101+
type: s1-prod-ubuntu22-04-amd64-1
102+
prologue:
103+
commands:
104+
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
105+
jobs:
106+
- name: "Install"
107+
matrix:
108+
- env_var: DOCKER_IMAGE
109+
values: ["quay.io/centos/centos:stream9", "almalinux:9", "rockylinux:9"]
110+
- env_var: NODE_VERSION
111+
values: ["18", "20", "21", "22", "23"]
112+
commands:
113+
- docker run -v "$(pwd):/v" "$DOCKER_IMAGE" /v/ci/post-install/install-rhel.sh "$NODE_VERSION" "$LIBRARY_VERSION"
114+
115+
- name: "RHEL-based OS (arm64)"
116+
dependencies: [ ]
117+
task:
118+
agent:
119+
machine:
120+
type: s1-prod-ubuntu22-04-arm64-1
121+
prologue:
122+
commands:
123+
- '[[ -z $DOCKERHUB_APIKEY ]] || docker login --username $DOCKERHUB_USER --password $DOCKERHUB_APIKEY'
124+
jobs:
125+
- name: "Install"
126+
matrix:
127+
- env_var: DOCKER_IMAGE
128+
values: ["quay.io/centos/centos:stream9", "almalinux:9", "rockylinux:9"]
129+
- env_var: NODE_VERSION
130+
values: ["18", "20", "21", "22", "23"]
131+
commands:
132+
- docker run -v "$(pwd):/v" "$DOCKER_IMAGE" /v/ci/post-install/install-rhel.sh "$NODE_VERSION" "$LIBRARY_VERSION"
133+
134+
- name: "Mac (Intel)"
135+
dependencies: [ ]
136+
task:
137+
agent:
138+
machine:
139+
type: s1-prod-macos-13-5-amd64
140+
jobs:
141+
- name: "Install"
142+
matrix:
143+
- env_var: NODE_VERSION
144+
values: ["18", "20", "21", "22", "23"]
145+
commands:
146+
- sem-version node $NODE_VERSION
147+
- bash ci/post-install/install-mac.sh "$NODE_VERSION" "$LIBRARY_VERSION"
148+
149+
- name: "Mac (M1)"
150+
dependencies: [ ]
151+
task:
152+
agent:
153+
machine:
154+
type: s1-prod-macos-13-5-arm64
155+
jobs:
156+
- name: "Install"
157+
matrix:
158+
- env_var: NODE_VERSION
159+
values: ["18", "20", "21", "22", "23"]
160+
commands:
161+
- sem-version node $NODE_VERSION
162+
- bash ci/post-install/install-mac.sh "$NODE_VERSION" "$LIBRARY_VERSION"
163+
164+
- name: "Windows (x64)"
165+
dependencies: [ ]
166+
task:
167+
agent:
168+
machine:
169+
type: s1-prod-windows
170+
prologue:
171+
commands:
172+
# The semaphore agent already comes with an installed version of node. We, however, need to use a different
173+
# version of node for the release (as many as we need to cover all the different ABIs).
174+
# The node installer does not allow us to downgrade, so we need to uninstall the current version.
175+
# The method below isn't particularly robust (as it depends on the particular format of the URL), but it
176+
# works and can be easily fixed if it breaks (the node --version in the below jobs can be checked if there are
177+
# any issues in the build).
178+
- $env:InstalledMajor = (Get-Command node).Version.Major
179+
- $env:InstalledMinor = (Get-Command node).Version.Minor
180+
- $env:InstalledBuild = (Get-Command node).Version.Build
181+
- $env:InstalledVersion = "v${env:InstalledMajor}.${env:InstalledMinor}.${env:InstalledBuild}"
182+
- echo "https://nodejs.org/dist/${env:InstalledVersion}/node-${env:InstalledVersion}-x64.msi"
183+
- Invoke-WebRequest "https://nodejs.org/dist/${env:InstalledVersion}/node-${env:InstalledVersion}-x64.msi" -OutFile node_old.msi
184+
- msiexec /qn /l* node-old-log.txt /uninstall node_old.msi
185+
- cat .\node-old-log.txt
186+
jobs:
187+
- name: "Install"
188+
matrix:
189+
- env_var: NODE_VERSION
190+
values: ["18.19.0", "20.11.0", "21.6.1", "22.2.0", "23.2.0"]
191+
commands:
192+
- Invoke-WebRequest "https://nodejs.org/download/release/v${env:NODE_VERSION}/node-v${env:NODE_VERSION}-x64.msi" -OutFile node.msi
193+
- msiexec /qn /l* node-log.txt /i node.msi
194+
- cat .\node-log.txt
195+
- node --version
196+
- $env:tempFolderPath = Join-Path $Env:Temp $(New-Guid)
197+
- New-Item -Type Directory -Path ${env:tempFolderPath} | Out-Null
198+
- cd ${env:tempFolderPath}
199+
- npm init -y
200+
- npm install --save @confluentinc/kafka-javascript@${env:LIBRARY_VERSION}
201+
- node -e "console.log(require('@confluentinc/kafka-javascript').librdkafkaVersion);"

ci/post-install/_install_ckjs.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Only for logging purposes
2+
node -v
3+
uname -m
4+
5+
installDir=$(mktemp -d)
6+
cd $installDir
7+
npm init -y
8+
9+
# uncomment for one final run.
10+
library_version="$2"
11+
12+
if [ -z "${library_version}" ]; then
13+
library_version="latest"
14+
fi
15+
16+
npm install @confluentinc/kafka-javascript@${library_version} --save
17+
node -e 'console.log(require("@confluentinc/kafka-javascript").librdkafkaVersion);'

ci/post-install/_install_nvm.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_version="$1"
2+
3+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
4+
5+
export NVM_DIR="$HOME/.nvm"
6+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
7+
8+
nvm install $node_version

ci/post-install/install-alpine.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
set -e
3+
4+
. /v/ci/post-install/_install_ckjs.sh

ci/post-install/install-debian.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
set -e
3+
4+
export DEBIAN_FRONTEND=noninteractive
5+
export NEEDRESTART_MODE=a
6+
7+
apt update
8+
apt install -y bash curl
9+
10+
. /v/ci/post-install/_install_nvm.sh
11+
. /v/ci/post-install/_install_ckjs.sh

ci/post-install/install-mac.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
set -e
3+
4+
. $(pwd)/ci/post-install/_install_ckjs.sh

ci/post-install/install-rhel.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
set -e
3+
4+
pwd
5+
6+
dnf install --allowerasing -y bash curl
7+
8+
. /v/ci/post-install/_install_nvm.sh
9+
. /v/ci/post-install/_install_ckjs.sh

service.yml

+10
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ codeowners:
1010
enable: true
1111
semaphore:
1212
enable: true
13+
tasks:
14+
- name: post-install
15+
scheduled: false
16+
branch: "master"
17+
pipeline_file: .semaphore/post_install.yml
18+
parameters:
19+
- name: LIBRARY_VERSION
20+
required: true
21+
description: "Which library version to install."
22+
default_value: "latest"
1323
sonarqube:
1424
enable: true
1525
coverage_reports:

0 commit comments

Comments
 (0)