formal-verification.yml 2.1 KB

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