Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
fewensa committed Oct 30, 2024
1 parent 569648f commit 64bcc1e
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 4 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Code

on:
push:
branches: [main]
pull_request:
branches: [main]


jobs:
check-code:
name: Check Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install deps
run: yarn install

- name: Build
run: yarn build
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
push:
tags:
- "v*"
pull_request:
branches: [main]
workflow_dispatch:

env:
DOCKER_REGISTRY: ghcr.io

jobs:
release-docker-image:
name: Publish docker image
runs-on: ubuntu-latest
strategy:
matrix:
package:
- reporter
- publisher
steps:
- uses: actions/checkout@v2

- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}

- name: Tag
uses: olegtarasov/[email protected]
- name: Sha
uses: benjlevesque/[email protected]

- name: Publish docker image
uses: docker/build-push-action@v6
with:
push: true
context: .
file: packages/${{ matrix.package }}-client/Dockerfile
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/${{ matrix.package }}:sha-${{ env.SHA }}

- name: Publish docker image with tag
uses: docker/build-push-action@v6
if: startsWith(github.ref, 'refs/tags/v')
with:
push: true
context: .
file: packages/${{ matrix.package }}-client/Dockerfile
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/${{ matrix.package }}:${{ env.GIT_TAG_NAME }}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "git+https://github.com/ringecosystem/xapi-offchain.git"
},
"scripts": {
"build:all": "lerna run build",
"build": "lerna run build",
"build:indexer": "lerna run build --scope=@ringdao/xapi-indexer-evm --scope=@ringdao/xapi-indexer-near",
"build:offchain": "lerna run build --scope=@ringdao/xapi-reporter-client --scope=@ringdao/xapi-publisher-client --scope=@ringdao/xapi-common",
"test": "lerna run test",
Expand Down
10 changes: 10 additions & 0 deletions packages/publisher-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:20-alpine as builder
ADD . /build
RUN cd /build \
&& yarn install \
&& yarn build:offchain

FROM node:20-alpine
COPY --from=builder /build /app

ENTRYPOINT ["/app/scripts/publisher.entrypoint.sh"]
10 changes: 10 additions & 0 deletions packages/reporter-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:20-alpine as builder
ADD . /build
RUN cd /build \
&& yarn install \
&& yarn build:offchain

FROM node:20-alpine
COPY --from=builder /build /app

ENTRYPOINT ["/app/scripts/reporter.entrypoint.sh"]
9 changes: 9 additions & 0 deletions scripts/publisher.entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
#

set -e

BIN_PATH=$(cd "$(dirname "$0")"; pwd -P)
WORK_PATH=${BIN_PATH}/../

node ${WORK_PATH}/packages/publisher-client/dist/main.js $@
9 changes: 9 additions & 0 deletions scripts/reporter.entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
#

set -e

BIN_PATH=$(cd "$(dirname "$0")"; pwd -P)
WORK_PATH=${BIN_PATH}/../

node ${WORK_PATH}/packages/reporter-client/dist/main.js $@
2 changes: 1 addition & 1 deletion scripts/start-publisher-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ npm run build:offchain

cd ${WORK_PATH}/packages/publisher-client

export XPI_LOG_LEVEL=debug
# export XPI_LOG_LEVEL=info

node dist/main.js $@
4 changes: 2 additions & 2 deletions scripts/start-reporter-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ npm run build:offchain

cd ${WORK_PATH}/packages/reporter-client

export XAPI_LOG_FULL=0
export XAPI_LOG_LEVEL=debug
# export XAPI_LOG_FULL=0
# export XAPI_LOG_LEVEL=info

node dist/main.js $@

0 comments on commit 64bcc1e

Please sign in to comment.