Skip to content

Commit

Permalink
Merge branch 'main' into refactor-transform
Browse files Browse the repository at this point in the history
  • Loading branch information
cwastche committed Jun 29, 2024
2 parents fb31139 + 509abf1 commit 2fba4f0
Show file tree
Hide file tree
Showing 39 changed files with 630 additions and 698 deletions.
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ STARKNET_NETWORK=
## Katana specific configurations
KATANA_ACCOUNT_ADDRESS=0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca
KATANA_PRIVATE_KEY=0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a
## Madara account address and private key
MADARA_ACCOUNT_ADDRESS=0x3
MADARA_PRIVATE_KEY=0x00c1cf1490de1352865301bb8705143f3ef938f97fdf892f1090dcb5ac7bcd1d

# Kakarot Environment
KAKAROT_RPC_URL=127.0.0.1:3030
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/deno_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
name: deno test

on:
workflow_call:

jobs:
formatting:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: indexer
- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: Run formatting
run: deno fmt --check indexer/

test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
# Checkout target branch and run tests
- name: Run Tests with Coverage on target branch
run: KAKAROT_ADDRESS=0x1 deno test --allow-env --coverage=cov_profile
- name: Generate Coverage Report on target branch
run: deno coverage cov_profile --html
- name: Install bc
run: |
sudo apt-get update
sudo apt-get install -y bc
- name: Extract coverage percentage from HTML for the target branch
run: |
cat cov_profile/html/index.html
coverage_percentage=$(grep -A 3 "<div class='fl pad1y space-right2'>" cov_profile/html/index.html | grep "<span class='strong'>" | awk -F'[<>]' '{gsub("%","",$3); print $3}')
echo $coverage_percentage > curr_coverage_percentage.txt
# Checkout base branch and run tests
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
clean: false
- name: Run Tests with Coverage on base branch
run: KAKAROT_ADDRESS=0x1 deno test --allow-env --coverage=cov_profile_main
- name: Generate HTML report from for the base branch
run: deno coverage cov_profile_main --html
- name: Extract coverage percentage from HTML for the base branch
run: |
coverage_percentage_main=$(grep -A 3 "<div class='fl pad1y space-right2'>" cov_profile_main/html/index.html | grep "<span class='strong'>" | awk -F'[<>]' '{gsub("%","",$3); print $3}')
echo $coverage_percentage_main > coverage_percentage_main.txt
- name: Compare coverage percentage
run: |
previous_coverage=$(awk '{print $2}' coverage_percentage_main.txt)
echo "Previous coverage percentage was $previous_coverage%"
current_coverage=$(awk '{print $2}' curr_coverage_percentage.txt)
echo "Current coverage percentage is $current_coverage%"
change=$(echo "$previous_coverage - $current_coverage" | bc)
echo "Coverage change is $change%"
if (( $(echo "$change > 5.0" | bc -l) )); then
echo "Coverage dropped by more than 5%!"
exit 1
fi
20 changes: 0 additions & 20 deletions .github/workflows/indexer_formatting.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
name: Spell check
uses: ./.github/workflows/spell_check.yml

tests:
rust-tests:
name: Rust tests
uses: ./.github/workflows/test.yml
uses: ./.github/workflows/rust_test.yml

indexer_formatting:
name: Deno formatting
uses: ./.github/workflows/indexer_formatting.yml
deno-tests:
name: Deno tests
uses: ./.github/workflows/deno_test.yml
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
name: Spell check
uses: ./.github/workflows/spell_check.yml

indexer_formatting:
name: Deno formatting
uses: ./.github/workflows/indexer_formatting.yml
deno-tests:
name: Deno tests
uses: ./.github/workflows/deno_test.yml
19 changes: 4 additions & 15 deletions .github/workflows/test.yml → .github/workflows/rust_test.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
---
name: test
name: rust test

on:
workflow_call:

jobs:
test-deno:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: KAKAROT_ADDRESS=0x1 deno test --allow-env
test-rust:
test:
runs-on: ubuntu-latest-16-cores
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Setup rust env
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
components: llvm-tools-preview, rustfmt, clippy
override: true
components: rustfmt, clippy
toolchain: 1.76.0
- name: Retrieve cached dependencies
uses: Swatinem/rust-cache@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
vscode
broadcast
.idea
.DS_Store

# ignore genesis.json
.hive
Expand Down
4 changes: 2 additions & 2 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ lint:
- git-diff-check
- hadolint@2.12.0
- markdownlint@0.41.0
- osv-scanner@1.7.4
- osv-scanner@1.8.1
- oxipng@9.1.1
- prettier@3.3.2
- rustfmt@1.65.0
Expand All @@ -31,7 +31,7 @@ lint:
- taplo@0.8.1
- terrascan@1.19.1
- trivy@0.52.2
- trufflehog@3.78.1
- trufflehog@3.79.0
- yamllint@1.35.1
- deno@1.44.4
ignore:
Expand Down
Loading

0 comments on commit 2fba4f0

Please sign in to comment.