Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gwos script tests #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ jobs:
# Docker buildx is required by docker/build-push-action
# see https://github.com/docker/setup-buildx-action
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
- name: Download component.gwos and omni_lock
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
# GitHub automatically creates a unique GITHUB_TOKEN secret to use in this workflow.
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
Expand All @@ -318,7 +318,7 @@ jobs:
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image to ${{ env.REGISTRY }}${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/godwoken-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ jobs:
MANUAL_BUILD_WEB3_INDEXER=true
WEB3_GIT_URL="https://github.com/${{ github.repository }}"
WEB3_GIT_CHECKOUT=${{ github.ref }}
MANUAL_BUILD_POLYJUICE=true
POLYJUICE_GIT_URL=https://github.com/${{ github.repository }}
POLYJUICE_GIT_CHECKOUT=${{ github.ref }}
GODWOKEN_KICKER_REPO=godwokenrises/godwoken-kicker
GODWOKEN_KICKER_REF=develop
DOCKER_MANUAL_BUILD_IMAGE=retricsu/godwoken-manual-build:node18
4 changes: 2 additions & 2 deletions .github/workflows/gwos-evm-fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
mv corpus-new corpus-cache

- name: Archive inputs that triggered crashes or sanitizer failures
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: fuzzing-inputs
Expand All @@ -103,7 +103,7 @@ jobs:
polyjuice-tests/fuzz/timeout-*
polyjuice-tests/fuzz/oom-*
- name: Archive corpus
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: corpus
path: |
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/gwos-scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Scripts test

on:
merge_group:
types: [checks_requested]
push:
# TODO: remove this comment
# paths:
# - 'gwos/**'
# - 'crates/tests/src/script_tests/**'
pull_request:
paths:
- 'gwos/**'
- 'crates/tests/src/script_tests/**'

jobs:
check-c-format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Note: cargo fmt is done in .github/workflows/rust.yml
- name: Check format of gwos/c
working-directory: gwos/c
run: make fmt

build-gwos-and-test-scripts:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo-gwos-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-gwos

- name: Install moleculec
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/ \
&& rm capsule_${CAPSULE_VERSION}_x86_64-linux.tar.gz \
&& rm -rf capsule_${CAPSULE_VERSION}_x86_64-linux/
capsule --version

- name: Compile C contracts of gwos
working-directory: gwos/c
run: make

- uses: actions/cache@v3
id: fetch-capsule-cache
with:
path: |
gwos/.tmp/capsule-cache.tar
key: ${{ runner.os }}-capsule-cache-${{ hashFiles('contracts/Cargo.lock') }}

- name: Restore capsule cache
if: steps.fetch-capsule-cache.outputs.cache-hit == 'true'
working-directory: gwos
run: tools/restore-capsule-cache.sh

- name: Build Rust contracts
working-directory: gwos
run: capsule build

- name: Backup capsule cache
if: steps.fetch-capsule-cache.outputs.cache-hit != 'true'
working-directory: gwos
run: tools/backup-capsule-cache.sh

- name: Test C Uint256
run: cargo test -p c-uint256-tests
- name: Script tests
run: cargo test --features scripts --features gw-config/no-builtin script_tests
2 changes: 1 addition & 1 deletion .github/workflows/prepare-builtin-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:

# commit to submodule repo
- name: Push to godwoken-builtin-binaries repo
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: crates/builtin-binaries/builtin
branch: master
Expand Down
113 changes: 69 additions & 44 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,85 @@ name: Build and Test
on: [push, pull_request]

jobs:
rust-clippy-and-test:
runs-on: ubuntu-latest
rustfmt-and-clippy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust components
run: rustup component add rustfmt && rustup component add clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-test
${{ runner.os }}-${{ runner.arch }}-cargo
- name: Install moleculec v0.7.2
run: CARGO_TARGET_DIR=target/ cargo install moleculec --version 0.7.2
- name: Check format
run: cargo fmt -- --check
- name: Cargo clippy check
env:
RUSTFLAGS: -D warnings
run: cargo clippy --tests --all-features --all-targets
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-clippy

- name: Install Rust components
run: |
cargo fmt --version || rustup component add rustfmt
cargo clippy --version || rustup component add clippy
- name: Check format
run: cargo fmt --all -- --check --verbose
- name: Cargo clippy check
env:
RUSTFLAGS: -D warnings
run: cargo clippy --tests --all-features --all-targets


rust-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-test

- name: Cache of component.gwos-evm
id: godwoken-polyjuice-cache
uses: actions/cache@v3
with:
path: |
gwos-evm/build/*generator*
gwos-evm/build/*validator*
key: component.gwos-evm-${{ hashFiles('gwos-evm/**') }}
- name: Build godwoken-polyjuice
if: steps.godwoken-polyjuice-cache.outputs.cache-hit != 'true'
working-directory: gwos-evm
run: |
test "$(moleculec --version)" = "Moleculec 0.7.2" \
|| cargo install moleculec --version 0.7.2 --force
git submodule update --init --recursive --depth=1
make all-via-docker

- name: Cache of component.gwos-evm
id: godwoken-polyjuice-cache
uses: actions/cache@v3
with:
path: |
gwos-evm/build/*generator*
gwos-evm/build/*validator*
key: component.gwos-evm-${{ hashFiles('gwos-evm/**') }}
- name: Build godwoken-polyjuice
if: steps.godwoken-polyjuice-cache.outputs.cache-hit != 'true'
working-directory: gwos-evm
run: |
git submodule update --init --recursive --depth=1
make all-via-docker
- name: Test all targets
run: RUST_BACKTRACE=1 cargo test --all-targets

- name: Tests all targets
run: RUST_BACKTRACE=1 cargo test --all-targets

test-generate-example-config:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache of Cargo
id: cargo-test-cache
uses: actions/cache@v3
with:
path: |
Expand All @@ -67,6 +93,5 @@ jobs:
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-cargo-build
${{ runner.os }}-${{ runner.arch }}-cargo
- name: Test TOML serialization
run: cargo run --bin godwoken -- generate-example-config -o test.toml
78 changes: 0 additions & 78 deletions .github/workflows/scripts.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/web3-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# https://github.com/docker/login-action
# GitHub automatically creates a unique GITHUB_TOKEN secret to use in this workflow.
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
Expand All @@ -67,7 +67,7 @@ jobs:
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: New Commit Build => Build and push commit image to ${{ env.REGISTRY }}
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
file: ./web3/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
Expand Down
Loading