From 70ee859477d9d333af2706f2918b5022b49aae35 Mon Sep 17 00:00:00 2001 From: Anton Baliasnikov Date: Tue, 28 May 2024 12:20:09 +0100 Subject: [PATCH] feat: support custom-solc-version parameter for benchmarks --- .github/actions/build-llvm/action.yml | 18 ++++++++++++++- .github/workflows/benchmarks.yml | 29 ++++++++++++++++-------- .github/workflows/integration-tests.yaml | 24 ++++++++++++++++---- 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/.github/actions/build-llvm/action.yml b/.github/actions/build-llvm/action.yml index 157f8a3..4fda803 100644 --- a/.github/actions/build-llvm/action.yml +++ b/.github/actions/build-llvm/action.yml @@ -44,6 +44,12 @@ inputs: description: 'Type of ccache key: `static` - rotate each month, or `dynamic` - rotate with each update of `LLVM.lock`.' required: false default: 'dynamic' + save-ccache: + description: 'Whether to save ccache after the build.' + required: false + default: 'false' + + runs: using: "composite" steps: @@ -85,6 +91,16 @@ runs: shell: 'bash' run: apt update + - name: Define ccache save key + id: ccache-save + shell: ${{ runner.os == 'Windows' && 'msys2 {0}' || 'bash' }} + run: | + if [ '${{ inputs.save-ccache }}' = 'true' ]; then + echo "save=true" | tee -a "${GITHUB_OUTPUT}" + else + echo "save=${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }}" | tee -a "${GITHUB_OUTPUT}" + fi + - name: Set up compiler cache uses: hendrikmuhs/ccache-action@v1.2 env: @@ -97,7 +113,7 @@ runs: append-timestamp: false max-size: "2G" verbose: 2 - save: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') }} + save: ${{ steps.ccache-save.outputs.save }} # CCACHE_BASEDIR, CCACHE_NOHASHDIR, and CCACHE_COMPILERCHECK # are allowing to cache compiler output across different diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index b83915f..4c096ab 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -11,22 +11,22 @@ on: compiler_tester_reference_branch: type: string description: "compiler-tester branch to use as a benchmark reference" - required: true + required: false default: "main" compiler_tester_candidate_branch: type: string description: "compiler-tester branch to use as a benchmark candidate" - required: true + required: false default: "main" compiler_llvm_reference_branch: type: string description: "compiler-llvm branch to use as a benchmark reference" - required: true + required: false default: "main" compiler_llvm_candidate_branch: type: string description: "compiler-llvm branch to use as a benchmark candidate" - required: true + required: false default: "main" compiler_llvm_benchmark_mode: type: string @@ -58,6 +58,11 @@ on: required: false default: '' description: 'run id of custom zksync solc artifact to download.' + custom-solc-version: + type: string + required: false + default: '' + description: 'custom solc version to use for benchmarks' jobs: benchmarks: @@ -122,19 +127,23 @@ jobs: --target-dir './target-zkvyper/' - name: Download custom solc - if: inputs.custom-solc-run-id != '' && matrix.type == 'candidate' + if: inputs.custom-solc-run-id != '' && inputs.custom-solc-version != '' uses: actions/download-artifact@v4 with: - path: ./solc-bin/ + pattern: solc* + path: ./solc-custom-bin/ run-id: ${{ inputs.custom-solc-run-id }} merge-multiple: true - name: Prepare custom solc - if: inputs.custom-solc-run-id != '' && matrix.type == 'candidate' + if: inputs.custom-solc-run-id != '' && inputs.custom-solc-version != '' run: | - chmod a+x ./solc-bin/solc* + mkdir -p ./solc-bin + chmod a+x "./solc-custom-bin/solc-${{ inputs.custom-solc-version}}-${{ matrix.type }}" + mv "./solc-custom-bin/solc-${{ inputs.custom-solc-version}}-${{ matrix.type }}" \ + "./solc-bin/solc-${{ inputs.custom-solc-version}}" echo "Testing with custom solc from run ${{ inputs.custom-solc-run-id }}" - echo $(./solc-bin/solc* --version) + echo $(./solc-bin/solc-${{ inputs.custom-solc-version}} --version) - name: Run benchmarks run: | @@ -146,6 +155,7 @@ jobs: --benchmark=${{ matrix.type }}.json - uses: actions/upload-artifact@v4 + if: always() with: name: compiler-llvm-${{ matrix.type }}-benchmark path: ${{ matrix.type }}.json @@ -158,6 +168,7 @@ jobs: container: image: matterlabs/llvm_runner:ubuntu22-llvm17-latest needs: benchmarks + if: always() steps: - name: Checking out the compiler-tester repository uses: actions/checkout@v4 diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index f54a8cd..fb8256b 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -26,11 +26,21 @@ on: required: false default: '' description: 'run id of custom zksync solc artifact to download.' + custom-solc-version: + type: string + required: false + default: '' + description: 'custom solc version to use for integration tests' ccache-key-type: type: string required: false default: 'dynamic' description: 'Type of ccache key: `static` - rotate each month, or `dynamic` - rotate with each update of `LLVM.lock`.' + save-ccache: + type: string + required: false + default: 'false' + description: 'Whether to save ccache after the build.' compiler-tester-repo: type: string required: false @@ -93,19 +103,23 @@ jobs: --target-dir './target-zkvyper/' - name: Download custom solc - if: inputs.custom-solc-run-id != '' + if: inputs.custom-solc-run-id != '' && inputs.custom-solc-version != '' uses: actions/download-artifact@v4 with: - path: ./solc-bin/ + pattern: solc* + path: ./solc-custom-bin/ run-id: ${{ inputs.custom-solc-run-id }} merge-multiple: true - name: Prepare custom solc - if: inputs.custom-solc-run-id != '' + if: inputs.custom-solc-run-id != '' && inputs.custom-solc-version != '' run: | - chmod a+x ./solc-bin/solc* + mkdir -p ./solc-bin + chmod a+x "./solc-custom-bin/solc-${{ inputs.custom-solc-version}}-candidate" + mv "./solc-custom-bin/solc-${{ inputs.custom-solc-version}}-candidate" \ + "./solc-bin/solc-${{ inputs.custom-solc-version}}" echo "Testing with custom solc from run ${{ inputs.custom-solc-run-id }}" - echo $(./solc-bin/solc* --version) + echo $(./solc-bin/solc-${{ inputs.custom-solc-version}} --version) - name: Run integration tests run: |