chore: Update the Dockerfile of godwoken-web3 #477
Workflow file for this run
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: Web3 Unit Tests | |
on: | |
push: | |
paths: | |
- 'web3/**' | |
pull_request: | |
env: | |
# Environment variables propagated to godwoken-kicker | |
MANUAL_BUILD_GODWOKEN: "true" | |
GODWOKEN_GIT_URL: "https://github.com/${{ github.repository }}" | |
GODWOKEN_GIT_CHECKOUT: "${{ github.ref }}" | |
MANUAL_BUILD_SCRIPTS: "false" | |
SCRIPTS_GIT_URL: "https://github.com/${{ github.repository }}" | |
SCRIPTS_GIT_CHECKOUT: "${{ github.ref }}" | |
MANUAL_BUILD_POLYJUICE: "false" | |
POLYJUICE_GIT_URL: "https://github.com/${{ github.repository }}" | |
POLYJUICE_GIT_CHECKOUT: "${{ github.ref }}" | |
MANUAL_BUILD_WEB3: "true" | |
MANUAL_BUILD_WEB3_INDEXER: "true" | |
WEB3_GIT_URL: "https://github.com/${{ github.repository }}" | |
WEB3_GIT_CHECKOUT: "${{ github.ref }}" | |
GODWOKEN_KICKER_REPO: "godwokenrises/godwoken-kicker" | |
GODWOKEN_KICKER_REF: "develop" | |
DOCKER_MANUAL_BUILD_IMAGE: "retricsu/godwoken-manual-build:node18" | |
jobs: | |
web3-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Rust components | |
run: rustup component add rustfmt && rustup component add clippy | |
- name: Install moleculec 0.7.2 | |
run: | | |
test "$(moleculec --version)" = "Moleculec 0.7.2" \ | |
|| cargo install moleculec --version 0.7.2 --force | |
- name: Install capsule | |
env: | |
CAPSULE_VERSION: v0.7.0 | |
run: | | |
(which capsule && test "$(capsule --version)" = "Capsule 0.7.0") \ | |
|| curl -OL https://github.com/nervosnetwork/capsule/releases/download/${CAPSULE_VERSION}/capsule_${CAPSULE_VERSION}_x86_64-linux.tar.gz \ | |
&& tar xf capsule_${CAPSULE_VERSION}_x86_64-linux.tar.gz \ | |
&& mv capsule_${CAPSULE_VERSION}_x86_64-linux/capsule ~/.cargo/bin/ | |
capsule --version | |
# Godwoken-Kicker | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.GODWOKEN_KICKER_REPO }} | |
ref: ${{ env.GODWOKEN_KICKER_REF }} | |
- name: Kicker init | |
run: ./kicker init | |
- name: Kicker start | |
run: | | |
# Temporary workaround unreliable web3 health check | |
(echo " == kicker start attempt: 1 == " && ./kicker start) || \ | |
(echo " == kicker start attempt: 2 == " && ./kicker stop && ./kicker start) || \ | |
(echo " == kicker start failed == " && docker-compose --file docker/docker-compose.yml logs --tail 6 && exit 1) | |
docker-compose --file docker/docker-compose.yml logs --tail 6 | |
- name: Kicker ps and logs | |
run: sleep 60 && ./kicker ps && ./kicker logs web3 | |
- name: Store kicker network information as environment variables | |
run: | | |
cat docker/layer2/config/web3-config.env | grep -v '^#' >> $GITHUB_ENV | |
echo "DATABASE_URL=postgres://user:[email protected]:5432/lumos" >> $GITHUB_ENV | |
echo "REDIS_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV | |
# Godwoken-Web3 | |
- uses: actions/checkout@v4 | |
with: | |
path: godwoken-monorepo | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('godwoken-monorepo/**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Godwoken Web3 | yarn run test | |
working-directory: godwoken-monorepo/web3 | |
run: yarn && yarn run build && yarn run test | |
- name: Kicker logs if failure | |
if: ${{ failure() }} | |
run: ./kicker ps && ./kicker logs |