Skip to content

Commit

Permalink
chore: Fix and extend regular tests (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgusakov authored Oct 18, 2024
1 parent bc6d134 commit 48ed806
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Regular tests
name: Regular holesky tests

on:
workflow_dispatch:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
run: just build --sizes

- name: Run integration & invariant tests
run: just test-post-voting
run: forge test --match-path 'test/fork/*' --no-match-path='{test/fork/deployment/*,test/fork/voting/*}' -vvv
env:
CHAIN: holesky
DEPLOY_CONFIG: ./artifacts/holesky/deploy-holesky.json
Expand All @@ -107,5 +107,5 @@ jobs:
if: ${{ failure() && (github.event_name == 'schedule' || inputs.notify) }}
uses: lidofinance/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.INVARIANTS_CHECK_DISCORD_WEBHOOK }}
DISCORD_WEBHOOK: ${{ secrets.INVARIANTS_CHECK_DISCORD_WEBHOOK_HOLESKY }}
DISCORD_EMBEDS: ${{ env.EMBEDS }}
111 changes: 111 additions & 0 deletions .github/workflows/regular-mainnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: Regular mainnet tests

on:
workflow_dispatch:
inputs:
notify:
description: "Notify about test results to the discord channel"
required: false
default: false
type: boolean
schedule:
- cron: "0 */3 * * *"

env:
FOUNDRY_PROFILE: ci
TERM: ansi

jobs:
bootstrap:
name: Bootstrap environment
runs-on: ubuntu-latest
outputs:
cache-path: ${{ steps.cache.outputs.path }}
cache-key: ${{ steps.cache.outputs.key }}
env:
FORGE_REV: 03ea54c
JUST_TAG: 1.24.0
steps:
- name: Build cache params
id: cache
run: |
echo "path=$CACHE_PATH" >> "$GITHUB_OUTPUT"
echo "$KEY_INPUT" | md5sum | awk '{print $1}' | xargs -I% echo "key=cargobin-%-${RUNNER_OS}" >> "$GITHUB_OUTPUT"
env:
CACHE_PATH: |
~/.cargo/bin/
KEY_INPUT: |
forge:${{env.FORGE_REV}}
just:${{env.JUST_TAG}}
- uses: actions/cache@v4
id: get-cache
with:
path: ${{ steps.cache.outputs.path }}
key: ${{ steps.cache.outputs.key }}

- name: Install just
run: cargo install "just@$JUST_TAG"
if: steps.get-cache.outputs.cache-hit != 'true'

- name: Install forge & anvil
run: cargo install --git https://github.com/foundry-rs/foundry --rev "$FORGE_REV" --profile release --locked forge anvil
if: steps.get-cache.outputs.cache-hit != 'true'

test:
name: Integration & Invariant tests
runs-on: ubuntu-latest
needs: bootstrap
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/cache@v4
with:
path: ${{ needs.bootstrap.outputs.cache-path }}
key: ${{ needs.bootstrap.outputs.cache-key }}

- name: Install node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache-dependency-path: "**/yarn.lock"

- name: Install dependencies
run: just deps

- name: Build
run: just build --sizes

- name: Run deployment tests
run: just test-deployment
env:
CHAIN: mainnet
DEPLOY_CONFIG: ./artifacts/mainnet/deploy-mainnet.json
RPC_URL: ${{ secrets.RPC_URL_MAINNET }}

- name: Echo embeds to the env variable
if: ${{ failure() && (github.event_name == 'schedule' || inputs.notify) }}
run: |
EMBEDS=$(cat <<EOF
[
{
"title": "Regular tests are failed! :scream:",
"url": "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID",
"description": "Check the logs for more information."
}
]
EOF
)
EMBEDS=$(echo "$EMBEDS" | jq -c .) # Compact JSON representation
echo "EMBEDS=$EMBEDS" >> $GITHUB_ENV
- name: Discord notification when fails
if: ${{ failure() && (github.event_name == 'schedule' || inputs.notify) }}
uses: lidofinance/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.INVARIANTS_CHECK_DISCORD_WEBHOOK_MAINNET }}
DISCORD_EMBEDS: ${{ env.EMBEDS }}

0 comments on commit 48ed806

Please sign in to comment.