feat: cairo-test -> snforge + fork test upgrade #377
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Compare Snapshot | |
on: pull_request | |
permissions: | |
pull-requests: write | |
jobs: | |
compare_snapshot: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" # Specify the Python version required | |
- name: Set up Scarb | |
uses: software-mansion/setup-scarb@v1 | |
- name: Run compare_snapshot script | |
id: run_script | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
result=$(python pragma-deployer/pragma_deployer/gas_usage/compare_snapshot.py| sed 's/\x1b\[[0-9;]*m//g') | |
result=$(echo "$result" | grep -v "Archive:") | |
result=$(echo "$result" | grep -v "inflating:") | |
echo "$result" > temp_result.txt | |
echo "output<<$EOF" >> $GITHUB_OUTPUT | |
cat temp_result.txt >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
outputs: | |
output: ${{ steps.run_script.outputs.output }} | |
display_result: | |
needs: compare_snapshot | |
runs-on: ubuntu-latest | |
steps: | |
- name: Comment on PR | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
output="${{needs.compare_snapshot.outputs.output}}" | |
echo "Debug: output for PR comment = $output" | |
pr_number=$(jq -r ".number" "$GITHUB_EVENT_PATH") | |
repo_full_name=$(jq -r ".repository.full_name" "$GITHUB_EVENT_PATH") | |
comment=$(printf "Output from Compare Snapshot:\\n\`\`\`\\n%s\\n\`\`\`" "$output") | |
comment=$(jq -n --arg body "$comment" '{body: $body}') | |
curl \ | |
-X POST \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/$repo_full_name/issues/$pr_number/comments \ | |
-d "$comment" |