Skip to content

[DO NOT MERGE] KIP-3 to Dev #952

[DO NOT MERGE] KIP-3 to Dev

[DO NOT MERGE] KIP-3 to Dev #952

Workflow file for this run

name: Release SDK & UI
env:
CI: true
FORCE_COLOR: true
on:
push:
types: ['opened', 'edited', 'reopened', 'synchronize', 'ready_for_review']
branches: ['main', 'dev', 'KIP-3']
paths-ignore:
- 'docs/**'
- 'packages/contracts/**'
- 'README.md'
- 'LICENSE'
- 'papers/**'
- 'images/**'
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize', 'ready_for_review']
branches: ['main', 'dev', 'KIP-3']
paths-ignore:
- 'docs/**'
- 'packages/contracts/**'
- 'README.md'
- 'LICENSE'
- 'papers/**'
- 'images/**'
jobs:
workflow-setup:
name: Initialize Workflow
runs-on: ubuntu-latest
# This condition checks if the pull request is not a draft
if: github.event.pull_request.draft == false
outputs:
publish: ${{ steps.build-flags.outputs.publish }}
steps:
- name: Set builds flags
id: build-flags
run: |
if [[ ${{github.event.repository.full_name}} == 'kumodao/kumo-protocol' && ${{github.event_name}} == 'push' && ( "${{github.base_ref}}" == 'main' || "${{github.ref}}" == 'refs/heads/main' ) ]]; then
echo "{publish}={true}" >> $GITHUB_OUTPUT
else
echo "{publish}={false}" >> $GITHUB_OUTPUT
fi
test:
name: Run SDK, Frontend tests
runs-on: ubuntu-latest
needs: workflow-setup
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: 18.17.1
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Install linux deps
run: |
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
- name: Run SDK tests
run: |
yarn test:lib-base &
yarn test:lib-ethers
- name: Run e2e tests (synpress-action)
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
yarn test:dev-frontend
env:
SECRET_WORDS: 'test test test test test test test test test test test junk'
NETWORK_NAME: 'Localhost'
RPC_URL: 'http://127.0.0.1:8545'
CHAIN_ID: 17
SYMBOL: 'ETH'
DISPLAY: :0.0
- name: Archive e2e artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # pin@v2
if: always()
with:
name: e2e-artifacts
path: |
./packages/dev-frontend/tests/e2e/videos
continue-on-error: true
# - name: Test SDK integration against live contracts
# if: ${{ github.ref == 'refs/heads/main' }}
# run: yarn test-live
release:
name: Publish SDK to NPM and build Frontend image
if: needs.workflow-setup.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [ workflow-setup, test ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: 18.17.1
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Release SDK on NPM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn release
- name: Convert the GitHub repository name to lowercase
id: repository-name
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.repository }}
- name: Prepare image labels and tags
if: ${{ github.event_name != 'pull_request' }}
id: prep
shell: bash
run: |
DOCKER_IMAGE=ghcr.io/${{ steps.repository-name.outputs.lowercase }}/dev-frontend
TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:latest"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Log into the GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
if: ${{ github.event_name != 'pull_request' }}
uses: docker/setup-buildx-action@v1
- name: Build and push image
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v2
with:
context: ./packages/dev-frontend
no-cache: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}