Skip to content

qol improvements

qol improvements #82

Workflow file for this run

name: CI
on:
push:
pull_request:
workflow_dispatch:
env:
go_version: 1.18.5
jobs:
define-env:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
IMAGE_TAG: ${{ steps.ct_image_tag.outputs.IMAGE_TAG }}
IMAGE_PATH_0: ghcr.io/${{ github.repository }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: ct_image_tag
run: |
TAG_NORMALIZED=$(echo ${GITHUB_REF#refs/*/} | sed "s/[^[:alpha:]0-9.-]/-/g")
if [[ "$TAG_NORMALIZED" == "main" ]]; then echo "IMAGE_TAG=latest" >> $GITHUB_OUTPUT
else echo "IMAGE_TAG=$TAG_NORMALIZED" >> $GITHUB_OUTPUT
fi
build-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- define-env
outputs:
IMAGE_SHA256_0: ${{ steps.image_sha256.outputs.IMAGE_SHA256_0 }}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Login to ghcr.io
shell: bash
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: Build and push container image
shell: bash
run: |
docker build --progress=plain --no-cache --build-arg ROSETTA_SRC=. --tag ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }} -f ./server/Dockerfile .
docker push ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }}
- name: get image sha256
id: image_sha256
run: |
docker pull ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }}
export IMAGE_SHA256_0_FULL=$(docker image inspect --format='{{json .RepoDigests}}' ${{ needs.define-env.outputs.IMAGE_PATH_0 }}:${{ needs.define-env.outputs.IMAGE_TAG }} | jq --raw-output '.[0]')
echo "IMAGE_SHA256_0=${IMAGE_SHA256_0_FULL#*@}" >> $GITHUB_OUTPUT
test-container-localflare-online:
runs-on: ubuntu-latest
needs:
- build-container
- define-env
strategy:
fail-fast: false
matrix:
index: [1, 2, 3, 4, 5]
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: [true, false]
services:
flare_node:
image: ${{ needs.define-env.outputs.IMAGE_PATH_0 }}@${{ needs.build-container.outputs.IMAGE_SHA256_0 }}
ports:
- 9650:9650
- 9651:9651
- 8080:8080
env:
DEBUG: true
NETWORK_ID: localflare
FLARE_LOCAL_TXS_ENABLED: true
START_ROSETTA_SERVER_AFTER_BOOTSTRAP: ${{ matrix.START_ROSETTA_SERVER_AFTER_BOOTSTRAP }}
EXTRA_ARGUMENTS: --staking-tls-cert-file=/app/flare/staking/local/staker1.crt --staking-tls-key-file=/app/flare/staking/local/staker1.key
options: >-
--health-interval 15s
--health-timeout 15s
--health-retries 10
--health-start-period 30s
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- run: sudo apt update -y && sudo apt install curl -y
- name: Wait for go-flare to bind to port
shell: bash
run: curl -s --retry 6 --retry-delay 10 --retry-connrefused http://localhost:9650 || exit 1
- name: Import testnet
shell: bash
run: |
curl -s -o /tmp/test_pchain_import.sh https://raw.githubusercontent.com/flare-foundation/go-flare/114017731f4f8f6192a4df2748da914c0257e16b/avalanchego/scripts/test_pchain_import.sh
sed -i 's/localhost/127.0.0.1/g' /tmp/test_pchain_import.sh
sed -i 's/ | jq .//g' /tmp/test_pchain_import.sh
bash /tmp/test_pchain_import.sh
while [[ "$(curl -X POST --data '{ "jsonrpc": "2.0", "method": "platform.getHeight", "params": {}, "id": 1 }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | jq -r .result.height)" != "2" ]]
do
echo "Block height not reached.. Block Height:" $(curl -X POST --data '{ "jsonrpc": "2.0", "method": "platform.getHeight", "params": {}, "id": 1 }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P | jq -r .result.height)
sleep 1
done
- name: Wait for rosetta to bind to port
shell: bash
run: curl -s --retry 6 --retry-delay 10 --retry-connrefused http://localhost:8080 || exit 1
- name: List networks Rosetta API lists
shell: bash
run: |
curl -s --location --request POST 'http://127.0.0.1:8080/network/list' \
--header 'Content-Type: application/json' \
--data-raw '{ "metadata" : {} }' \
--fail || exit 1
- name: Install rosetta cli
shell: bash
run: |
mkdir -p /tmp/rosetta
curl -o /tmp/rosetta/install.sh -sSfL https://raw.githubusercontent.com/coinbase/rosetta-cli/d5ccb7c5cdfc60cd23ff7cb010dea1bf19f80547/scripts/install.sh
bash /tmp/rosetta/install.sh -b /tmp/rosetta/
- name: Run rosetta-cli check:construction
timeout-minutes: 5
shell: bash
run: |
pushd server/rosetta-cli-conf/localflare
/tmp/rosetta/rosetta-cli --configuration-file=./config.json check:construction
popd
test-container-localflare-offline:
runs-on: ubuntu-latest
needs:
- build-container
- define-env
strategy:
fail-fast: false
matrix:
index: [1, 2, 3, 4, 5]
services:
flare_node:
image: ${{ needs.define-env.outputs.IMAGE_PATH_0 }}@${{ needs.build-container.outputs.IMAGE_SHA256_0 }}
ports:
- 9650:9650
- 9651:9651
- 8080:8080
env:
DEBUG: true
NETWORK_ID: localflare
FLARE_LOCAL_TXS_ENABLED: true
MODE: offline
EXTRA_ARGUMENTS: --staking-tls-cert-file=/app/flare/staking/local/staker1.crt --staking-tls-key-file=/app/flare/staking/local/staker1.key
options: >-
--health-interval 15s
--health-timeout 15s
--health-retries 10
--health-start-period 30s
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- run: sudo apt update -y && sudo apt install curl -y
- name: Wait for rosetta to bind to port
shell: bash
run: curl -s --retry 6 --retry-delay 10 --retry-connrefused http://localhost:8080 || exit 1
- name: List networks Rosetta API lists
shell: bash
run: |
curl -s --location --request POST 'http://127.0.0.1:8080/network/list' \
--header 'Content-Type: application/json' \
--data-raw '{ "metadata" : {} }' \
--fail || exit 1
test-make_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- run: (cd server && make build)
test-make_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go_version }}
- run: (cd server && make test)