fix: update license/copyright notice in all code #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build/Test/Release | |
on: [push] | |
env: | |
EMULATOR_TAG: 0.14.0 | |
ROM_VERSION: v0.16.0 | |
KERNEL_VERSION: v0.16.0 | |
LINUX_VERSION: 5.15.63-ctsi-2 | |
ROOTFS_VERSION: v0.17.0 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout server-manager source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Setup docker image tags | |
id: docker_image_tags | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=semver,pattern={{version}},enable=${{startsWith(github.ref, 'refs/tags/v')}} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Ubuntu based docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ steps.docker_image_tags.outputs.tags }} | |
push: false | |
load: true | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} | |
test-ioctl-echo-loop: | |
name: Test with ioctl-echo-loop | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout server-manager source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Ubuntu based docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:devel | |
push: false | |
load: true | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} | |
- name: Build installer stage docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
target: installer | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer | |
push: false | |
load: true | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} | |
- name: Download [rootfs.ext2] | |
uses: Legion2/download-release-action@v2.1.0 | |
with: | |
repository: ${{ github.repository_owner }}/image-rootfs | |
tag: ${{ env.ROOTFS_VERSION }} | |
file: rootfs-${{ env.ROOTFS_VERSION }}.ext2 | |
token: ${{ secrets.CI_TOKEN }} | |
- 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 | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Download [rom.bin] | |
uses: Legion2/download-release-action@v2.1.0 | |
with: | |
repository: ${{ github.repository_owner }}/machine-emulator-rom | |
tag: ${{ env.ROM_VERSION }} | |
file: rom-${{ env.ROM_VERSION }}.bin | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Move images to cartesi images folder | |
run: | | |
mkdir -m 755 -p /opt/cartesi/share/images | |
mv rom-*.bin linux-*.bin rootfs-*.ext2 /opt/cartesi/share/images/ | |
cd /opt/cartesi/share/images/ && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin | |
cd /opt/cartesi/share/images/ && ln -s rom-${{ env.ROM_VERSION }}.bin rom.bin | |
cd /opt/cartesi/share/images/ && ln -s rootfs-${{ env.ROOTFS_VERSION }}.ext2 rootfs.ext2 | |
- name: Run test suite inside the docker image | |
run: | | |
docker volume create --name server-manager-root | |
docker network create mynetwork | |
docker run --rm -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer chown -R cartesi:cartesi /tmp/server-manager-root | |
docker run --rm -u cartesi:cartesi -v /opt/cartesi/share/images:/opt/cartesi/share/images -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer make create-machines | |
docker run --rm -p 5001:5001 -h server-manager-container --name server-manager-container --network mynetwork -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/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 --rm -u cartesi:cartesi -h test-container --name test-container --network mynetwork -v /opt/cartesi/share/images:/opt/cartesi/share/images -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer make run-test-server-manager MANAGER_ADDRESS=server-manager-container:5001 | |
docker kill server-manager-container | |
test-echo-dapp: | |
name: Test with rollup-init echo-dapp | |
needs: build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout server-manager source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Ubuntu based docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:devel | |
push: false | |
load: true | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} | |
- name: Build installer stage docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
target: installer | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer | |
push: false | |
load: true | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} | |
- name: Download [rootfs.ext2] | |
uses: Legion2/download-release-action@v2.1.0 | |
with: | |
repository: ${{ github.repository_owner }}/image-rootfs | |
tag: ${{ env.ROOTFS_VERSION }} | |
file: rootfs-${{ env.ROOTFS_VERSION }}.ext2 | |
token: ${{ secrets.CI_TOKEN }} | |
- 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 | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Download [rom.bin] | |
uses: Legion2/download-release-action@v2.1.0 | |
with: | |
repository: ${{ github.repository_owner }}/machine-emulator-rom | |
tag: ${{ env.ROM_VERSION }} | |
file: rom-${{ env.ROM_VERSION }}.bin | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Move images to cartesi images folder | |
run: | | |
mkdir -m 755 -p /opt/cartesi/share/images | |
mv rom-*.bin linux-*.bin rootfs-*.ext2 /opt/cartesi/share/images/ | |
cd /opt/cartesi/share/images/ && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin | |
cd /opt/cartesi/share/images/ && ln -s rom-${{ env.ROM_VERSION }}.bin rom.bin | |
cd /opt/cartesi/share/images/ && ln -s rootfs-${{ env.ROOTFS_VERSION }}.ext2 rootfs.ext2 | |
- name: Run test suite inside the docker image | |
run: | | |
docker volume create --name server-manager-root | |
docker network create mynetwork | |
docker run --rm -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer chown -R cartesi:cartesi /tmp/server-manager-root | |
docker run --rm -u cartesi:cartesi -v /opt/cartesi/share/images:/opt/cartesi/share/images -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer make create-machines rollup_init=yes | |
docker run --rm -p 5001:5001 -h server-manager-container --name server-manager-container --network mynetwork -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/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 --rm -u cartesi:cartesi -h test-container --name test-container --network mynetwork -v /opt/cartesi/share/images:/opt/cartesi/share/images -v server-manager-root:/tmp/server-manager-root ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer make run-test-server-manager 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@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Ubuntu based docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
target: installer | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer | |
push: false | |
load: true | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} | |
- name: Check format | |
run: docker run --rm ${{ secrets.DOCKER_ORGANIZATION }}/server-manager:installer make check-format | |
- name: Lint | |
run: docker run --rm ${{ secrets.DOCKER_ORGANIZATION }}/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 | |
if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/develop') }} | |
steps: | |
- name: Checkout server-manager source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CI_TOKEN }} | |
- name: Setup ubuntu docker image tags | |
id: ubuntu_docker_image_tags | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ secrets.DOCKER_ORGANIZATION }}/server-manager | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Ubuntu based docker image | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
platforms: linux/amd64 | |
tags: ${{ steps.ubuntu_docker_image_tags.outputs.tags }} | |
push: true | |
load: false | |
cache-from: type=gha,scope=ubuntu | |
cache-to: type=gha,mode=max,scope=ubuntu | |
build-args: | | |
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | |
EMULATOR_REPOSITORY=${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator | |
EMULATOR_TAG=${{ env.EMULATOR_TAG }} |