Skip to content

feat: improve machine server shutdown message #104

feat: improve machine server shutdown message

feat: improve machine server shutdown message #104

Workflow file for this run

name: Build/Test/Release
on: [push]
env:
EMULATOR_REPOSITORY: cartesi/machine-emulator
EMULATOR_TAG: 0.16.1
KERNEL_VERSION: v0.19.1
LINUX_VERSION: 6.5.9-ctsi-1-v0.19.1
TOOLS_VERSION: v0.14.0
CARTESI_IMAGES_PATH: /usr/share/cartesi-machine/images
HOST_IMAGES_PATH: /tmp/cartesi-machine-images/
permissions:
id-token: write
packages: write
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout server-manager source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build Debian based docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ github.repository_owner }}/server-manager:devel
push: false
load: true
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}
test-ioctl-echo-loop:
strategy:
matrix:
include:
- arch: "amd64"
fast: false
- arch: "arm64"
fast: true
name: Test with ioctl-echo-loop (${{ matrix.arch }})
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout server-manager source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build Debian based docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
platforms: linux/${{ matrix.arch }}
tags: ${{ github.repository_owner }}/server-manager:devel
push: false
load: true
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}
- name: Build installer stage docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
target: installer
platforms: linux/${{ matrix.arch }}
tags: ${{ github.repository_owner }}/server-manager:installer
push: false
load: true
cache-from: type=gha,scope=debian-installer
cache-to: type=gha,mode=max,scope=debian-installer
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}
- name: Download [rootfs.ext2]
uses: Legion2/download-release-action@v2.1.0
with:
repository: ${{ github.repository_owner }}/machine-emulator-tools
tag: ${{ env.TOOLS_VERSION }}
file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2
- name: Download [kernel.bin]
uses: Legion2/download-release-action@v2.1.0
with:
repository: ${{ github.repository_owner }}/image-kernel
tag: ${{ env.KERNEL_VERSION }}
file: linux-${{ env.LINUX_VERSION }}.bin
- name: Move images to cartesi images folder
run: |
mkdir -m 755 -p /tmp/cartesi-machine-images
mv linux-*.bin rootfs-*.ext2 ${{ env.HOST_IMAGES_PATH }}
cd ${{ env.HOST_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin
cd ${{ env.HOST_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2
- name: Run test suite inside the docker image (Linux/${{ matrix.arch }})
run: |
docker volume create --name server-manager-root
docker network create mynetwork
docker run --platform linux/${{ matrix.arch }} --rm -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:installer chown -R cartesi:cartesi /tmp/server-manager-root
docker run --platform linux/${{ matrix.arch }} --rm -u cartesi:cartesi -v /tmp/cartesi-machine-images:${{ env.CARTESI_IMAGES_PATH }} -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:installer make create-machines
docker run --platform linux/${{ matrix.arch }} --rm -p 5001:5001 -h server-manager-container --name server-manager-container --network mynetwork -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:devel &
timeout 20 bash -c 'while ! nc -q0 127.0.0.1 5001 < /dev/null > /dev/null 2>&1; do sleep 1; done'
docker run --platform linux/${{ matrix.arch }} --rm -u cartesi:cartesi -h test-container --name test-container --network mynetwork -v /tmp/cartesi-machine-images:${{ env.CARTESI_IMAGES_PATH }} -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:installer make run-test-server-manager FAST_TEST=${{ matrix.fast }} MANAGER_ADDRESS=server-manager-container:5001
docker kill server-manager-container
test-echo-dapp:
strategy:
matrix:
include:
- arch: "amd64"
fast: false
- arch: "arm64"
fast: true
name: Test with rollup-init echo-dapp (${{ matrix.arch }})
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout server-manager source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build Debian based docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
platforms: linux/${{ matrix.arch }}
tags: ${{ github.repository_owner }}/server-manager:devel
push: false
load: true
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}
- name: Build installer stage docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
target: installer
platforms: linux/${{ matrix.arch }}
tags: ${{ github.repository_owner }}/server-manager:installer
push: false
load: true
cache-from: type=gha,scope=debian-installer
cache-to: type=gha,mode=max,scope=debian-installer
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}
- name: Download [rootfs.ext2]
uses: Legion2/download-release-action@v2.1.0
with:
repository: ${{ github.repository_owner }}/machine-emulator-tools
tag: ${{ env.TOOLS_VERSION }}
file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2
- name: Download [kernel.bin]
uses: Legion2/download-release-action@v2.1.0
with:
repository: ${{ github.repository_owner }}/image-kernel
tag: ${{ env.KERNEL_VERSION }}
file: linux-${{ env.LINUX_VERSION }}.bin
- name: Move images to cartesi images folder
run: |
mkdir -m 755 -p /tmp/cartesi-machine-images
mv linux-*.bin rootfs-*.ext2 ${{ env.HOST_IMAGES_PATH }}
cd ${{ env.HOST_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin
cd ${{ env.HOST_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2
- name: Run test suite inside the docker image (Linux/${{ matrix.arch }})
run: |
docker volume create --name server-manager-root
docker network create mynetwork
docker run --platform linux/${{ matrix.arch }} --rm -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:installer chown -R cartesi:cartesi /tmp/server-manager-root
docker run --platform linux/${{ matrix.arch }} --rm -u cartesi:cartesi -v /tmp/cartesi-machine-images:${{ env.CARTESI_IMAGES_PATH }} -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:installer make create-machines rollup_init=yes
docker run --platform linux/${{ matrix.arch }} --rm -p 5001:5001 -h server-manager-container --name server-manager-container --network mynetwork -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:devel &
timeout 20 bash -c 'while ! nc -q0 127.0.0.1 5001 < /dev/null > /dev/null 2>&1; do sleep 1; done'
docker run --platform linux/${{ matrix.arch }} --rm -u cartesi:cartesi -h test-container --name test-container --network mynetwork -v /tmp/cartesi-machine-images:${{ env.CARTESI_IMAGES_PATH }} -v server-manager-root:/tmp/server-manager-root ${{ github.repository_owner }}/server-manager:installer make run-test-server-manager FAST_TEST=${{ matrix.fast }} MANAGER_ADDRESS=server-manager-container:5001
docker kill server-manager-container
static-analysis:
name: Static Analysis
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout server-manager source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build Debian based docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
target: installer
platforms: linux/amd64
tags: ${{ github.repository_owner }}/server-manager:installer
push: false
load: true
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}
- name: Check format
run: docker run --rm ${{ github.repository_owner }}/server-manager:installer make check-format
- name: Lint
run: docker run --rm ${{ github.repository_owner }}/server-manager:installer make lint -j$(nproc)
release:
name: Publish Docker image
needs: [build, test-ioctl-echo-loop, test-echo-dapp, static-analysis]
runs-on: ubuntu-22.04
steps:
- name: Checkout server-manager source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup debian docker image tags
id: debian_docker_image_tags
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/server-manager
docker.io/${{ github.repository_owner }}/server-manager,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v') }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}},enable=${{startsWith(github.ref, 'refs/tags/v')}}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build Debian based docker image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
platforms: linux/amd64,linux/arm64
tags: ${{ steps.debian_docker_image_tags.outputs.tags }}
push: true
load: false
cache-from: type=gha,scope=debian
cache-to: type=gha,mode=max,scope=debian
build-args: |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }}
EMULATOR_REPOSITORY=${{ env.EMULATOR_REPOSITORY }}
EMULATOR_TAG=${{ env.EMULATOR_TAG }}
project: ${{ vars.DEPOT_PROJECT }}