diff --git a/.github/workflows/artifacts.yml b/.github/workflows/artifacts.yml new file mode 100644 index 00000000..295eaba1 --- /dev/null +++ b/.github/workflows/artifacts.yml @@ -0,0 +1,40 @@ +on: + push: + branches: + - "master" + pull_request: + +name: "Validate contract artifacts" + +jobs: + check-artifacts: + name: "Check artifacts" + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout source code" + uses: "actions/checkout@v3" + with: + submodules: true + + - name: "Generate artifacts (Cairo 0)" + run: | + cd ./starknet-core/test-data/contracts/cairo0 + ./generate_artifacts.sh + + - name: "Generate artifacts (Cairo 1)" + run: | + cd ./starknet-core/test-data/contracts/cairo1 + ./generate_artifacts.sh + + - name: "Generate artifacts (Cairo 2)" + run: | + cd ./starknet-core/test-data/contracts/cairo2 + ./generate_artifacts.sh + + - name: "Check Git diffs" + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Git diffs found. Make sure contract artifacts are up to date." >&2 + exit 1 + fi diff --git a/starknet-core/test-data/contracts/cairo0/generate_artifacts.sh b/starknet-core/test-data/contracts/cairo0/generate_artifacts.sh index 9aef5988..8d1dce42 100755 --- a/starknet-core/test-data/contracts/cairo0/generate_artifacts.sh +++ b/starknet-core/test-data/contracts/cairo0/generate_artifacts.sh @@ -2,7 +2,7 @@ # Deterministically generate contract artifacts -docker run -it --rm \ +docker run --rm \ -v "$(pwd)/artifacts:/artifacts" \ -v "$(pwd)/contracts:/contracts:ro" \ -v "$(pwd)/docker_entry.sh:/entry.sh:ro" \ diff --git a/starknet-core/test-data/contracts/cairo1/generate_artifacts.sh b/starknet-core/test-data/contracts/cairo1/generate_artifacts.sh index 04a8a45a..687b16be 100755 --- a/starknet-core/test-data/contracts/cairo1/generate_artifacts.sh +++ b/starknet-core/test-data/contracts/cairo1/generate_artifacts.sh @@ -4,7 +4,7 @@ set -e # Deterministically generate contract artifacts -docker run -it --rm \ +docker run --rm \ -v "$(pwd)/artifacts:/artifacts" \ -v "$(pwd)/contracts:/contracts:ro" \ -v "$(pwd)/docker_entry_compile.sh:/entry.sh:ro" \ @@ -14,7 +14,7 @@ docker run -it --rm \ starknet/cairo:1.1.0 -docker run -it --rm \ +docker run --rm \ -v "$(pwd)/artifacts:/artifacts" \ -v "$(pwd)/docker_entry_hashes.sh:/entry.sh:ro" \ -v "$(pwd)/scripts/generate_hashes.py:/generate_hashes.py:ro" \ diff --git a/starknet-core/test-data/contracts/cairo2/generate_artifacts.sh b/starknet-core/test-data/contracts/cairo2/generate_artifacts.sh index 7aed8cde..da4f4131 100755 --- a/starknet-core/test-data/contracts/cairo2/generate_artifacts.sh +++ b/starknet-core/test-data/contracts/cairo2/generate_artifacts.sh @@ -4,7 +4,7 @@ set -e # Deterministically generate contract artifacts -docker run -it --rm \ +docker run --rm \ -v "$(pwd)/artifacts:/artifacts" \ -v "$(pwd)/contracts:/contracts:ro" \ -v "$(pwd)/docker_entry_compile.sh:/entry.sh:ro" \ @@ -14,7 +14,7 @@ docker run -it --rm \ starknet/cairo:2.1.0 -docker run -it --rm \ +docker run --rm \ -v "$(pwd)/artifacts:/artifacts" \ -v "$(pwd)/docker_entry_hashes.sh:/entry.sh:ro" \ -v "$(pwd)/scripts/generate_hashes.py:/generate_hashes.py:ro" \