From 57a326eb5d6855acc41b5941c5cc4c086e8e0804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erce=20Can=20Bekt=C3=BCre?= <47954181+ercecan@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:18:57 +0300 Subject: [PATCH] CI Check genesis files (#903) * Test ci * Test ci 2 * Test ci 3 * Test ci 4 * Gitkeep state dir for temp genesis files * Test if ci works & revert python script * Remove comments of cis * Reduces unnecessary sleep * New script using git diff * Test ci works * Test ci * CI should work --- .github/scripts/check_genesis.sh | 18 +++++++++++++ .github/workflows/checks.yml | 26 +++++++++++++++++++ .../evm/src/evm/system_contracts/.gitignore | 3 ++- .../src/evm/system_contracts/state/.gitkeep | 0 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 .github/scripts/check_genesis.sh create mode 100644 crates/evm/src/evm/system_contracts/state/.gitkeep diff --git a/.github/scripts/check_genesis.sh b/.github/scripts/check_genesis.sh new file mode 100755 index 000000000..5b2dbf352 --- /dev/null +++ b/.github/scripts/check_genesis.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Run make command +make genesis + +sleep 1 + +# Check if script generates different genesis +git diff --exit-code ./resources/ + +if [ $? -ne 0 ]; then + echo "Differences found in genesis files." + exit 1 +fi + +echo "All directories are identical." + +exit 0 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2299103dd..926e190f1 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -423,3 +423,29 @@ jobs: cd crates/evm/src/evm/system_contracts forge test -vvv id: test + check_genesis_files: + strategy: + fail-fast: true + + name: Check Genesis Files + runs-on: ubicloud-standard-2 + if: github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Run check_genesis.sh + run: ./.github/scripts/check_genesis.sh + shell: bash + diff --git a/crates/evm/src/evm/system_contracts/.gitignore b/crates/evm/src/evm/system_contracts/.gitignore index f4ee93e35..edd2de820 100644 --- a/crates/evm/src/evm/system_contracts/.gitignore +++ b/crates/evm/src/evm/system_contracts/.gitignore @@ -1,7 +1,8 @@ # Compiler files cache/ out/ -state/ +state/*.json + # Ignores development broadcast logs !/broadcast diff --git a/crates/evm/src/evm/system_contracts/state/.gitkeep b/crates/evm/src/evm/system_contracts/state/.gitkeep new file mode 100644 index 000000000..e69de29bb