diff --git a/.github/actions/setup-env/action.yaml b/.github/actions/setup-env/action.yaml new file mode 100644 index 0000000000..18d8f611b8 --- /dev/null +++ b/.github/actions/setup-env/action.yaml @@ -0,0 +1,23 @@ +name: Setup Environment +description: Common setup for Ethereum Spec jobs +runs: + using: "composite" + steps: + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: "1.69.0" + override: true + + - name: Install Tox and any other packages + shell: bash + run: | + sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes build-essential pkg-config + pip install 'tox>=4.11,<5' requests + + - name: Download Geth and add to $PATH + shell: bash + run: | + mkdir -p $GITHUB_WORKSPACE/bin + $GITHUB_WORKSPACE/scripts/download_geth_linux.py --dir $GITHUB_WORKSPACE/bin + echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8274d6369e..7e9a174d10 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -10,53 +10,84 @@ on: pull_request: jobs: - build: - runs-on: [self-hosted-ghr, size-xl-x64] - strategy: - matrix: - py: [ "3.11", "pypy3.11" ] - + static: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - - - name: Install Rust - uses: actions-rs/toolchain@v1 + - name: Setup Python + uses: actions/setup-python@v5 with: - toolchain: "1.69.0" - override: true + python-version: "3.11" + - uses: ./.github/actions/setup-env + - name: Run static checks + run: tox -e static + py3: + runs-on: ubuntu-latest + needs: static + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.py }} - - - name: Install Tox and any other packages - run: | - DEBIAN_FRONTEND=noninteractive apt-get install --yes --force-yes build-essential pkg-config - pip install 'tox>=4.11,<5' requests + python-version: "3.11" + - uses: ./.github/actions/setup-env + - name: Run py3 tests + run: tox -e py3 - - name: Download Geth and add to $PATH - run: | - mkdir -p $GITHUB_WORKSPACE/bin - $GITHUB_WORKSPACE/scripts/download_geth_linux.py --dir $GITHUB_WORKSPACE/bin - echo $GITHUB_WORKSPACE/bin >> $GITHUB_PATH - - - name: Run Tox (CPython) - if: "${{ !startsWith(matrix.py, 'pypy') }}" - run: tox -e static,py3_eest,optimized,py3 - - - name: Run Tox (PyPy) - if: "${{ startsWith(matrix.py, 'pypy') }}" + pypy3: + runs-on: ubuntu-latest + needs: static + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "pypy3.11" + - uses: ./.github/actions/setup-env + - name: Run pypy3 tests run: tox -e pypy3 env: PYPY_GC_MAX: "10G" + json_infra: + runs-on: ubuntu-latest + needs: py3 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - uses: ./.github/actions/setup-env + - name: Run json infra tests + run: tox -e json_infra - name: Upload coverage reports to Codecov - if: "${{ !startsWith(matrix.py, 'pypy') }}" uses: codecov/codecov-action@v5 with: files: .tox/coverage.xml flags: unittests token: ${{ secrets.CODECOV_TOKEN }} + + optimized: + runs-on: ubuntu-latest + needs: py3 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - uses: ./.github/actions/setup-env + - name: Run optimized tests + run: tox -e optimized diff --git a/tox.ini b/tox.ini index 8ae7dd2a26..b75c374932 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ commands = ethereum-spec-lint vulture src tests vulture_whitelist.py --exclude "*/tests/fixtures/*" --ignore-names "pytest_*" -[testenv:py3] +[testenv:json_infra] extras = test commands = @@ -33,7 +33,7 @@ commands = --basetemp="{temp_dir}/pytest" \ tests -[testenv:py3_eest] +[testenv:py3] extras = test commands =