Skip to content

Commit

Permalink
fix: support custom solc version (#6)
Browse files Browse the repository at this point in the history
* Custom `solc` support for `era-solidity` testing
* Add a flag to save `ccache` 
* Remove `required` from some arguments that have default values
  • Loading branch information
antonbaliasnikov authored May 28, 2024
1 parent ad4e310 commit 183ec1f
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 15 deletions.
18 changes: 17 additions & 1 deletion .github/actions/build-llvm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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/[email protected]
env:
Expand All @@ -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
Expand Down
29 changes: 20 additions & 9 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down

0 comments on commit 183ec1f

Please sign in to comment.