Skip to content

Commit 666e4dc

Browse files
author
Anas Husseini
committed
apply ci tests to node20 rock
1 parent 2087eff commit 666e4dc

File tree

6 files changed

+20
-5
lines changed

6 files changed

+20
-5
lines changed

.github/workflows/tests.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44

55
env:
66
node18-image: ubuntu/chiselled-node:18-test
7+
node20-image: ubuntu/nodejs:20-test
78
ubuntu-release: 24.04
89

910
jobs:
@@ -35,20 +36,34 @@ jobs:
3536
--output type=oci,dest="chiselled-node.${{ matrix.arch }}.tar" \
3637
node18
3738
39+
- name: Build the ${{ env.node20-image }} image on ${{ matrix.arch }}
40+
id: build
41+
uses: canonical/craft-actions/rockcraft-pack@main
42+
with:
43+
path: node20/
44+
verbosity: debug
45+
3846
- name: Run tests
3947
if: ${{ matrix.arch == 'amd64' }}
4048
run: |
4149
set -ex
4250
sudo apt-get update
4351
sudo apt-get install -y skopeo
4452
skopeo copy oci-archive:"chiselled-node.${{ matrix.arch }}.tar" docker-daemon:${{ env.node18-image }}
53+
skopeo copy oci-archive:node20/nodejs_20_amd64.rock docker-daemon:${{ env.node20-image }}
4554
./tests/run-all-tests ${{ env.node18-image }}
55+
./tests/run-all-tests ${{ env.node20-image }}
4656
4757
- uses: actions/upload-artifact@v3
4858
with:
4959
name: chiselled-node-oci-tarballs
5060
path: chiselled-node.*.tar
5161

62+
- uses: actions/upload-artifact@v3
63+
with:
64+
name: node-rocks
65+
path: node20/*.rock
66+
5267
- id: set-outputs
5368
if: always()
5469
run: |

tests/app_hello-world/runtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -ex
44
echo "Running test for Hello World app..."
55

66
test() {
7-
docker run --rm -v "$PWD/src":/src:ro "$1" /src/main.js
7+
docker run --rm -v "$PWD/src":/src:ro "$1" exec node /src/main.js
88
}
99

1010
test "$NODE18"

tests/app_http-server/runtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo "Running test for HTTP Server app..."
55

66
test() {
77
port=1234
8-
container="$(docker run -d --rm -v "$PWD/src":/src:ro -p $port:8080 "$1" /src/main.js)"
8+
container="$(docker run -d --rm -v "$PWD/src":/src:ro -p $port:8080 "$1" exec node /src/main.js)"
99
sleep 1
1010
output="$(curl http://localhost:$port/)"
1111
[ "$output" == "Hello world!" ] || exit 1

tests/app_simple-modules/runtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build() {
99
}
1010

1111
test() {
12-
docker run --rm -v "$PWD/dist":/src:ro "$1" /src/index.js
12+
docker run --rm -v "$PWD/dist":/src:ro "$1" exec node /src/index.js
1313
}
1414

1515
build

tests/app_simple-typescript/runtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build() {
1111

1212
test() {
1313
port=1234
14-
container="$(docker run -d --rm -v "$PWD/dist":/src:ro -p $port:3000 "$1" /src/index.js)"
14+
container="$(docker run -d --rm -v "$PWD/dist":/src:ro -p $port:3000 "$1" exec node /src/index.js)"
1515
sleep 1
1616
local output expected
1717
output="$(curl http://localhost:$port/)"

tests/app_simple-wasm/runtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build() {
1111
}
1212

1313
test() {
14-
docker run --rm -v "$PWD/dist":/src:ro "$1" /src/index.mjs
14+
docker run --rm -v "$PWD/dist":/src:ro "$1" exec node /src/index.mjs
1515
}
1616

1717
build

0 commit comments

Comments
 (0)