Skip to content

examples/node21-websocket (stable) #313

examples/node21-websocket (stable)

examples/node21-websocket (stable) #313

name: examples/node21-websocket (stable)
on:
workflow_dispatch:
push:
branches: [ main ]
paths:
- '.github/workflows/example-node21-websocket-stable.yaml'
- 'node21-websocket/**'
- '!node21-websocket/README.md'
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ main ]
paths:
- '.github/workflows/example-node21-websocket-stable.yaml'
- 'node21-websocket/**'
- '!node21-websocket/README.md'
schedule:
- cron: '30 16 * * 1-5'
# Automatically cancel in-progress actions on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
env:
UKC_METRO: "https://api.${{ vars.UKC_METRO_STABLE }}.unikraft.cloud/v1"
UKC_TOKEN: ${{ secrets.UKC_TOKEN }}
KRAFTKIT_NO_CHECK_UPDATES: true
KRAFTKIT_LOG_LEVEL: debug
jobs:
integration:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test
id: test
uses: unikraft/kraftkit@staging
with:
run: |
set -xe;
cd node21-websocket;
wget https://github.com/vi/websocat/releases/download/v1.14.0/websocat.x86_64-unknown-linux-musl;
chmod a+x websocat.x86_64-unknown-linux-musl;
kraft cloud deploy \
--no-start \
--name node21-websocket-stable-${GITHUB_RUN_ID} \
--runtime index.unikraft.io/official-testing/base-compat:latest \
--subdomain node21-websocket-stable-${GITHUB_RUN_ID} \
-p 443:8080 \
-M 1Gi \
.;
# wait for the instance to start
kraft cloud vm start -w 5s node21-websocket-stable-${GITHUB_RUN_ID};
sleep 5;
echo "hello" | ./websocat.x86_64-unknown-linux-musl wss://node21-websocket-stable-${GITHUB_RUN_ID}.${{ vars.UKC_METRO_STABLE }}.unikraft.app | grep "hello" > /dev/null
- name: Cleanup
uses: unikraft/kraftkit@staging
if: always()
with:
run: |
set -xe;
kraft cloud vm stop node21-websocket-stable-${GITHUB_RUN_ID} || true;
kraft cloud vm logs node21-websocket-stable-${GITHUB_RUN_ID} || true;
kraft cloud vm rm node21-websocket-stable-${GITHUB_RUN_ID} || true;
kraft cloud img rm index.unikraft.io/test/node21-websocket-stable-${GITHUB_RUN_ID} || true;