Merge pull request #736 from lukso-network/DEV-5240 #555
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow ensure that the smart contracts can be compiled | |
# with different Solidity 0.8.x versions | |
name: Solidity Compiler Versions | |
on: | |
workflow_dispatch: | |
# Used to check pragma settings for `.sol` files are correct before releasing | |
push: | |
branches: | |
- "develop" | |
# compare gas diff only when editing Solidity smart contract code | |
paths: | |
- "contracts/**/*.sol" | |
pull_request: | |
types: [opened] | |
# compare gas diff only when editing Solidity smart contract code | |
paths: | |
- "contracts/**/*.sol" | |
jobs: | |
solc_version: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
solc: [ | |
"0.8.5", | |
"0.8.6", | |
"0.8.7", | |
"0.8.8", | |
"0.8.9", | |
"0.8.10", | |
"0.8.11", | |
"0.8.12", | |
"0.8.13", | |
"0.8.14", | |
"0.8.15", | |
"0.8.16", | |
# 0.8.17 skipped as default in hardhat.config.ts | |
"0.8.18", | |
"0.8.19", | |
"0.8.20", | |
"0.8.21", | |
] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js '16.15.0' | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16.15.0" | |
cache: "npm" | |
- name: 📦 Install dependencies | |
run: npm ci | |
- name: Install solc-select | |
run: pip3 install solc-select | |
- name: Use Solc v${{ matrix.solc }} | |
run: | | |
solc-select install ${{ matrix.solc }} | |
solc-select use ${{ matrix.solc }} | |
- name: Compare versions to filter contracts to compile | |
uses: madhead/semver-utils@latest | |
id: comparison | |
with: | |
version: ${{ matrix.solc }} | |
compare-to: 0.8.12 | |
- name: Compile Smart Contracts | |
run: | | |
if [[ "<" == "${{ steps.comparison.outputs.comparison-result }}" ]] | |
then | |
solc $(ls contracts/**/*.sol | grep -v "Compatible" | grep -v "Extension4337") --allow-paths $(pwd)/node_modules/ \ | |
@=node_modules/@ \ | |
solidity-bytes-utils/=node_modules/solidity-bytes-utils/ \ | |
../=$(pwd)/contracts/ | |
else | |
solc contracts/**/*.sol \ | |
@=node_modules/@ \ | |
solidity-bytes-utils/=node_modules/solidity-bytes-utils/ | |
fi; |