Skip to content

Colossus archive script #6214

Colossus archive script

Colossus archive script #6214

name: run-network-tests
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
push:
jobs:
tests_build_ubuntu:
name: Ubuntu Checks
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: checks
run: |
yarn build
tests_build_osx:
name: MacOS Checks
runs-on: macos-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: python setuptools
run: brew install python-setuptools
- name: checks
run: |
yarn build
build_images:
name: Build joystream/node
needs: tests_build_ubuntu
runs-on: ubuntu-latest
outputs:
use_artifact: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
runtime: ${{ steps.compute_shasum.outputs.shasum }}
steps:
- name: Make some space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- id: compute_shasum
name: Compute runtime code shasum
env:
RUNTIME_PROFILE: 'TESTING'
run: |
export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
- name: Setup cache directory
run: mkdir ~/docker-images
- name: Cache docker images
uses: actions/cache@v3
env:
cache-name: joystream-node-docker-1
with:
path: ~/docker-images
key: ${{ env.cache-name }}-${{ steps.compute_shasum.outputs.shasum }}
- name: Check if we have cached image
continue-on-error: true
run: |
if [ -f ~/docker-images/joystream-node-docker-image.tar.gz ]; then
docker load --input ~/docker-images/joystream-node-docker-image.tar.gz
cp ~/docker-images/joystream-node-docker-image.tar.gz .
fi
- name: Check if we have pre-built image on Dockerhub
continue-on-error: true
run: |
if ! [ -f joystream-node-docker-image.tar.gz ]; then
docker pull joystream/node:${{ steps.compute_shasum.outputs.shasum }}
docker save --output joystream-node-docker-image.tar joystream/node:${{ steps.compute_shasum.outputs.shasum }}
gzip joystream-node-docker-image.tar
cp joystream-node-docker-image.tar.gz ~/docker-images/
fi
- name: Check we now have an image
id: check_files
uses: andstor/file-existence-action@v1
with:
files: 'joystream-node-docker-image.tar.gz'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v1.7
id: builder1
if: steps.check_files.outputs.files_exists == 'false'
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-tests
if: steps.check_files.outputs.files_exists == 'false'
- name: Build
uses: docker/build-push-action@v3
with:
context: .
file: joystream-node.Dockerfile
platforms: linux/amd64
build-args: |
CARGO_FEATURES=testing-runtime
CODE_SHASUM=${{ steps.compute_shasum.outputs.shasum }}
push: false
tags: joystream/node:${{ steps.compute_shasum.outputs.shasum }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
builder: ${{ steps.builder1.outputs.name }}
load: true
if: steps.check_files.outputs.files_exists == 'false'
- name: Save joystream/node image to cache
run: |
docker save --output joystream-node-docker-image.tar joystream/node:${{ steps.compute_shasum.outputs.shasum }}
gzip joystream-node-docker-image.tar
cp joystream-node-docker-image.tar.gz ~/docker-images/
if: steps.check_files.outputs.files_exists == 'false'
- name: Save joystream/node image to Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
path: joystream-node-docker-image.tar.gz
run_test_scenarios:
name: Tests
needs: build_images
runs-on: ubuntu-latest
strategy:
matrix:
scenario: ['full', 'setupNewChain', 'setupNewChainMultiStorage', 'bonding', 'storageSync']
include:
- scenario: 'full'
no_storage: 'false'
- scenario: 'setupNewChain'
no_storage: 'true'
- scenario: 'setupNewChainMultiStorage'
no_storage: 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Get artifacts
uses: actions/download-artifact@v3
with:
name: ${{ needs.build_images.outputs.use_artifact }}
- name: Install artifacts
run: |
docker load --input joystream-node-docker-image.tar.gz
docker images
- name: Install packages and dependencies
run: |
yarn build
- name: Ensure tests are runnable
run: yarn workspace network-tests build
- name: Execute network tests
run: |
export RUNTIME=${{ needs.build_images.outputs.runtime }}
export NO_STORAGE=${{ matrix.no_storage }}
tests/network-tests/run-tests.sh ${{ matrix.scenario }}