|
| 1 | +name: E2E |
| 2 | + |
| 3 | +# based on https://docs.wavs.xyz/ & this repos README.md |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +# Ensures that only a single workflow per PR will run at a time. Cancels in-progress jobs if new commit is pushed. |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + run: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + env: |
| 18 | + DEBUGGING: true |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install Ubuntu packages |
| 25 | + run: sudo apt-get install bash make jq |
| 26 | + |
| 27 | + - uses: actions/setup-node@v4 |
| 28 | + name: Install Node.js |
| 29 | + with: |
| 30 | + node-version: 21 |
| 31 | + |
| 32 | + - name: Install Rust |
| 33 | + uses: actions-rs/toolchain@v1 |
| 34 | + with: |
| 35 | + profile: minimal |
| 36 | + toolchain: stable |
| 37 | + override: true |
| 38 | + |
| 39 | + - name: Cache Rust target |
| 40 | + uses: actions/cache@v3 |
| 41 | + with: |
| 42 | + path: | |
| 43 | + ~/.rustup/toolchains |
| 44 | + ~/.cargo/bin/ |
| 45 | + ~/.cargo/registry/index/ |
| 46 | + ~/.cargo/registry/cache/ |
| 47 | + ~/.cargo/git/db/ |
| 48 | + target/ |
| 49 | + key: ${{ runner.os }}-rust-wasm32-${{ hashFiles('**/Cargo.lock') }} |
| 50 | + restore-keys: | |
| 51 | + ${{ runner.os }}-rust-wasm32- |
| 52 | +
|
| 53 | + - uses: cargo-bins/cargo-binstall@main |
| 54 | + name: Install cargo-binstall |
| 55 | + with: |
| 56 | + version: latest |
| 57 | + |
| 58 | + - name: Install Foundry |
| 59 | + uses: onbjerg/foundry-toolchain@v1 |
| 60 | + with: |
| 61 | + version: nightly |
| 62 | + |
| 63 | + - name: Install rust wasm32-wasip2 |
| 64 | + run: rustup target add wasm32-wasip2 |
| 65 | + |
| 66 | + - name: Install wasi components |
| 67 | + run: | |
| 68 | + cargo binstall cargo-component warg-cli wkg --locked --no-confirm |
| 69 | + wkg config --default-registry wa.dev |
| 70 | +
|
| 71 | + - name: Install forge deps |
| 72 | + run: make setup |
| 73 | + |
| 74 | + - name: build contracts |
| 75 | + run: forge build |
| 76 | + |
| 77 | + - name: wasi build and local exec |
| 78 | + run: | |
| 79 | + make wasi-build |
| 80 | + make wasi-exec |
| 81 | +
|
| 82 | + # modified version of `make start-all` |
| 83 | + - name: Build the stack |
| 84 | + run: | |
| 85 | + cp .env.example .env |
| 86 | + anvil --host 0.0.0.0 & |
| 87 | + docker compose up -d |
| 88 | +
|
| 89 | + - name: Run tests |
| 90 | + run: | |
| 91 | + make deploy-contracts |
| 92 | + sleep 1 |
| 93 | + TRIGGER_EVENT="NewTrigger(bytes)" make deploy-service |
| 94 | + sleep 1 |
| 95 | + COIN_MARKET_CAP_ID=1 make trigger-service |
| 96 | + sleep 1 |
| 97 | +
|
| 98 | + - name: Run show result |
| 99 | + run: make show-result |
| 100 | + |
| 101 | + - name: Stop the stack |
| 102 | + run: | |
| 103 | + killall anvil |
| 104 | + docker compose down |
0 commit comments