Skip to content

Commit

Permalink
fix(ci):
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyRo1 committed Sep 18, 2024
1 parent c409ed2 commit 94da4f9
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/solidity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@ jobs:
- name: Get previous gas results
working-directory: ${{ env.working-directory }}
run: |
git checkout -b temp-branch
git reset --hard origin/${{ github.base_ref || 'main' }}
if [ -f previous_gas_results.txt ]; then
echo "previous_gas_results=$(cat previous_gas_results.txt)" >> $GITHUB_ENV
else
echo "previous_gas_results=" >> $GITHUB_ENV
fi
git checkout HEAD^1
forge test --match-contract PragmaDecoderGasTest -vvv | grep -E '^[A-Za-z]+,[0-9]+$' > previous_gas_report.txt
echo "previous_gas_results=$(cat previous_gas_report.txt | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
git checkout -
- name: Compare gas results
id: compare-gas
Expand All @@ -77,10 +74,7 @@ jobs:
echo '```'
IFS=',' read -ra current_array <<< "$current_gas_results"
if [ -f previous_gas_results.txt ]; then
IFS=',' read -ra previous_array <<< "$(cat previous_gas_results.txt)"
fi
IFS=',' read -ra previous_array <<< "$previous_gas_results"
for i in "${!current_array[@]}"; do
IFS=',' read -r test current <<< "${current_array[$i]}"
Expand All @@ -101,7 +95,7 @@ jobs:
echo "Change: N/A (Test name mismatch)"
fi
else
echo "Change: N/A (First run)"
echo "Change: N/A (New test)"
fi
echo ""
done
Expand All @@ -110,9 +104,6 @@ jobs:
echo 'EOF'
} >> $GITHUB_OUTPUT
# Update previous_gas_results.txt
echo "$current_gas_results" > previous_gas_results.txt
- name: Comment PR
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
Expand Down

0 comments on commit 94da4f9

Please sign in to comment.