formal-verification.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: formal verification
  2. on:
  3. pull_request:
  4. types:
  5. - opened
  6. - reopened
  7. - synchronize
  8. - labeled
  9. workflow_dispatch: {}
  10. env:
  11. PIP_VERSION: '3.10'
  12. JAVA_VERSION: '11'
  13. SOLC_VERSION: '0.8.19'
  14. concurrency: ${{ github.workflow }}-${{ github.ref }}
  15. jobs:
  16. apply-diff:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v3
  20. - name: Apply patches
  21. run: make -C certora apply
  22. verify:
  23. runs-on: ubuntu-latest
  24. if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'formal-verification')
  25. steps:
  26. - uses: actions/checkout@v3
  27. with:
  28. fetch-depth: 0
  29. - name: Set up environment
  30. uses: ./.github/actions/setup
  31. - name: identify specs that need to be run
  32. id: arguments
  33. run: |
  34. if [[ ${{ github.event_name }} = 'pull_request' ]];
  35. then
  36. RESULT=$(git diff ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.base.sha }} --name-only certora/specs/*.spec | while IFS= read -r file; do [[ -f $file ]] && basename "${file%.spec}"; done | tr "\n" " ")
  37. else
  38. RESULT='--all'
  39. fi
  40. echo "result=$RESULT" >> "$GITHUB_OUTPUT"
  41. - name: Install python
  42. uses: actions/setup-python@v4
  43. with:
  44. python-version: ${{ env.PIP_VERSION }}
  45. cache: 'pip'
  46. - name: Install python packages
  47. run: pip install -r requirements.txt
  48. - name: Install java
  49. uses: actions/setup-java@v3
  50. with:
  51. distribution: temurin
  52. java-version: ${{ env.JAVA_VERSION }}
  53. - name: Install solc
  54. run: |
  55. wget https://github.com/ethereum/solidity/releases/download/v${{ env.SOLC_VERSION }}/solc-static-linux
  56. sudo mv solc-static-linux /usr/local/bin/solc
  57. chmod +x /usr/local/bin/solc
  58. - name: Verify specification
  59. run: |
  60. make -C certora apply
  61. node certora/run.js ${{ steps.arguments.outputs.result }} >> "$GITHUB_STEP_SUMMARY"
  62. env:
  63. CERTORAKEY: ${{ secrets.CERTORAKEY }}