Skip to content

Commit

Permalink
fix(github): extract feature parameters in the build-fixtures action
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed May 30, 2024
1 parent 2c8d045 commit fbdf812
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 48 deletions.
38 changes: 18 additions & 20 deletions .github/actions/build-fixtures/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,33 @@ 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 }}
python-version: 3.11
- name: Install yq
shell: bash
run: |
pip install yq
- name: Extract fixture properties
id: properties
shell: bash
run: |
echo "evm-type=$(yq --arg feature "${{ inputs.name }}" '.[$feature]."evm-type"' ./config-feature.yaml)" >> "$GITHUB_OUTPUT"
echo "fill-params=$(yq --arg feature "${{ inputs.name }}" '.[$feature]."fill-params"' ./config-feature.yaml)" >> "$GITHUB_OUTPUT"
echo "solc=$(yq --arg feature "${{ inputs.name }}" '.[$feature]."solc"' ./config-feature.yaml)" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/build-evm
id: evm-builder
with:
type: ${{ steps.properties.outputs.evm-type }}
- 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]')
RELEASE_NAME=$(curl https://binaries.soliditylang.org/${PLATFORM}/list.json | jq -r --arg SOLC_VERSION "${{ steps.properties.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
Expand All @@ -42,7 +40,7 @@ runs:
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 }}
fill -n auto --evm-bin=${{ steps.evm-builder.outputs.evm-bin }} ${{ steps.properties.outputs.fill-params }}
- name: Create fixtures info file
shell: bash
run: |
Expand Down
18 changes: 3 additions & 15 deletions .github/workflows/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,24 @@ jobs:
features: ${{ steps.parse.outputs.features }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Setup yq
shell: bash
run: |
pip install yq
- name: Parse config-feature.yaml
- name: Get names from config-feature.yaml
id: parse
shell: bash
run: |
echo "features=$(yq -c '[. | to_entries | .[] | {"name": .key} * .value]' ./config-feature.yaml)" >> "$GITHUB_OUTPUT"
echo "features=$(grep -Po "^[0-9a-zA-Z_\-]+" ./config-feature.yaml | jq -R . | jq -cs .)" >> "$GITHUB_OUTPUT"
build:
needs: features
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{ fromJson(needs.features.outputs.features) }}
name: ${{ fromJson(needs.features.outputs.features) }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/build-fixtures
with:
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
10 changes: 0 additions & 10 deletions .github/workflows/fixtures_feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,9 @@ jobs:
shell: bash
run: |
echo name=${GITHUB_REF_NAME//@*/} >> "$GITHUB_OUTPUT"
- name: Get the selected feature configuration from the config-feature.yaml
id: config-feature-reader
shell: bash
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-fixtures
with:
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
3 changes: 0 additions & 3 deletions config-feature.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
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
fill-params: --fork=CancunEIP7692 ./tests/prague
python: 3.11
solc: 0.8.21

0 comments on commit fbdf812

Please sign in to comment.