Skip to content

Commit

Permalink
refactor(github): standardize fixture building
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed May 29, 2024
1 parent 6a82ce6 commit c7b10c1
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 89 deletions.
58 changes: 58 additions & 0 deletions .github/actions/build-fixtures/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build and Package Fixtures
inputs:
name:
description: 'Name of the fixture package'
required: true
evm-type:
description: 'Type of evm tool to use to build the fixtures'
required: true
fill-params:
description: 'Parameters to pass to the fill command'
required: true
python:
description: 'Python version to use'
required: true
solc:
description: 'solc compiler version to use'
required: true

runs:
using: "composite"
steps:
- uses: ./.github/actions/build-evm
id: evm-builder
with:
type: ${{ inputs.evm-type }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}
- name: Install solc compiler
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then PLATFORM="linux-amd64"; else PLATFORM="macosx-amd64"; fi
RELEASE_NAME=$(curl https://binaries.soliditylang.org/${PLATFORM}/list.json | jq -r --arg SOLC_VERSION "${{ inputs.solc }}" '.releases[$SOLC_VERSION]')
wget -O $GITHUB_WORKSPACE/bin/solc https://binaries.soliditylang.org/${PLATFORM}/$RELEASE_NAME
chmod a+x $GITHUB_WORKSPACE/bin/solc
echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH
- name: Run fixtures fill
shell: bash
run: |
pip install --upgrade pip
python -m venv env
source env/bin/activate
pip install -e .
fill -n auto --evm-bin=${{ steps.evm-builder.outputs.evm-bin }} ${{ inputs.fill-params }}
- name: Create fixtures info file
shell: bash
run: |
echo -e "ref: $GITHUB_REF \ncommit: $GITHUB_SHA\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" \
> fixtures/info.txt
- name: Tar fixtures output
shell: bash
run: |
tar -czvf fixtures_${{ inputs.name }}.tar.gz ./fixtures
- uses: actions/upload-artifact@v4
with:
name: fixtures_${{ inputs.name }}
path: fixtures_${{ inputs.name }}.tar.gz
70 changes: 25 additions & 45 deletions .github/workflows/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,42 @@ on:
workflow_dispatch:

jobs:
build:
features:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: 'stable'
evm-type: 'main'
fill-params: ''
solc: '0.8.21'
python: '3.11'
- name: 'develop'
evm-type: 'develop'
fill-params: '--until=Prague'
solc: '0.8.21'
python: '3.11'
outputs:
features: ${{ steps.parse.outputs.features }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/build-evm
id: evm-builder
with:
type: ${{ matrix.evm-type }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install solc compiler
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then PLATFORM="linux-amd64"; else PLATFORM="macosx-amd64"; fi
RELEASE_NAME=$(curl https://binaries.soliditylang.org/${PLATFORM}/list.json | jq -r --arg SOLC_VERSION "${{ matrix.solc }}" '.releases[$SOLC_VERSION]')
wget -O $GITHUB_WORKSPACE/bin/solc https://binaries.soliditylang.org/${PLATFORM}/$RELEASE_NAME
chmod a+x $GITHUB_WORKSPACE/bin/solc
echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH
- name: Run fixtures fill
shell: bash
run: |
pip install --upgrade pip
python -m venv env
source env/bin/activate
pip install -e .
fill -n auto ${{ matrix.fill-params }}
- name: Create fixtures info file
python-version: 3.11
- name: Setup yq
shell: bash
run: |
echo -e "ref: $GITHUB_REF \ncommit: $GITHUB_SHA\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" \
> fixtures/info.txt
- name: Tar fixtures output
pip install yq
- name: Parse config-feature.yaml
id: parse
shell: bash
run: |
tar -czvf fixtures_${{ matrix.name }}.tar.gz ./fixtures
- uses: actions/upload-artifact@v4
echo "features=$(yq -c '[. | to_entries | .[] | {"name": .key} * .value]' ./config-feature.yaml)" >> "$GITHUB_OUTPUT"
build:
needs: features
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{ fromJson(needs.features.outputs.features) }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/build-fixtures
with:
name: fixtures_${{ matrix.name }}
path: fixtures_${{ matrix.name }}.tar.gz
name: ${{ matrix.name }}
evm-type: ${{ matrix.evm-type }}
fill-params: ${{ matrix.fill-params }}
python: ${{ matrix.python }}
solc: ${{ matrix.solc }}
release:
runs-on: ubuntu-latest
needs: build
Expand Down
42 changes: 6 additions & 36 deletions .github/workflows/fixtures_feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,13 @@ jobs:
run: |
awk "/^${{ steps.feature-name.outputs.name }}:/{flag=1; next} /^[[:alnum:]]/{flag=0} flag" ./config-feature.yaml \
| sed 's/ //g' | sed 's/:/=/g' >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/build-evm
id: evm-builder
- uses: ./.github/actions/build-fixtures
with:
type: ${{ steps.config-feature-reader.outputs.evm-type }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ steps.config-feature-reader.outputs.python }}
- name: Install solc compiler
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then PLATFORM="linux-amd64"; else PLATFORM="macosx-amd64"; fi
RELEASE_NAME=$(curl https://binaries.soliditylang.org/${PLATFORM}/list.json | jq -r --arg SOLC_VERSION "${{ steps.config-feature-reader.outputs.solc }}" '.releases[$SOLC_VERSION]')
wget -O $GITHUB_WORKSPACE/bin/solc https://binaries.soliditylang.org/${PLATFORM}/$RELEASE_NAME
chmod a+x $GITHUB_WORKSPACE/bin/solc
echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH
- name: Run fixtures fill
shell: bash
run: |
pip install --upgrade pip
python -m venv env
source env/bin/activate
pip install -e .
fill -n auto --evm-bin=${{ steps.evm-builder.outputs.evm-bin }} --fork=${{ steps.config-feature-reader.outputs.fork }} ${{ steps.config-feature-reader.outputs.tests }}
- name: Create fixtures info file
shell: bash
run: |
echo -e "ref: $GITHUB_REF \ncommit: $GITHUB_SHA\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" \
> fixtures/info.txt
- name: Tar fixtures output
shell: bash
run: |
tar -czvf fixtures_${{ steps.feature-name.outputs.name }}.tar.gz ./fixtures
- uses: actions/upload-artifact@v4
with:
name: fixtures_${{ steps.feature-name.outputs.name }}
path: fixtures_${{ steps.feature-name.outputs.name }}.tar.gz
name: ${{ steps.feature-name.outputs.name }}
evm-type: ${{ steps.config-feature-reader.outputs.evm-type }}
fill-params: ${{ steps.config-feature-reader.outputs.fill-params }}
python: ${{ steps.config-feature-reader.outputs.python }}
solc: ${{ steps.config-feature-reader.outputs.solc }}
release:
runs-on: ubuntu-latest
needs: build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
- os: ubuntu-latest
python: '3.10'
solc: '0.8.20'
evm-type: 'main'
evm-type: 'stable'
tox-cmd: 'tox run-parallel --parallel-no-spinner'
- os: ubuntu-latest
python: '3.12'
solc: '0.8.23'
evm-type: 'main'
evm-type: 'stable'
tox-cmd: 'tox run-parallel --parallel-no-spinner'
- os: ubuntu-latest
python: '3.11'
Expand All @@ -32,7 +32,7 @@ jobs:
- os: macos-latest
python: '3.11'
solc: '0.8.22'
evm-type: 'main'
evm-type: 'stable'
tox-cmd: 'tox run-parallel --parallel-no-spinner'
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion config-evm.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
main:
stable:
impl: geth
repo: ethereum/go-ethereum
ref: master
Expand Down
17 changes: 13 additions & 4 deletions config-feature.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
stable:
evm-type: stable
fill-params: ''
python: 3.11
solc: 0.8.21
develop:
evm-type: develop
fill-params: --until=Prague
python: 3.11
solc: 0.8.21
eip7692:
evm-type: eip7692
fork: CancunEIP7692
tests: ./tests/prague
solc: 0.8.21
python: 3.11
fill-params: --fork=CancunEIP7692 ./tests/prague
python: 3.11
solc: 0.8.21

0 comments on commit c7b10c1

Please sign in to comment.