Skip to content

Commit

Permalink
Merge pull request #3 from remyroy/fix-tests-python
Browse files Browse the repository at this point in the history
Fix tests with latest python with initial Github workflow
  • Loading branch information
valefar-on-discord authored Apr 13, 2024
2 parents fdab65d + 01fea08 commit b09771e
Show file tree
Hide file tree
Showing 30 changed files with 698 additions and 608 deletions.
64 changes: 25 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ tox_common: &tox_common
key: tox-deps4-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}-{{ checksum "Makefile" }}

orbs:
win: circleci/windows@2.2.0 # The Windows orb give you everything you need to start using the Windows executor.
win: circleci/windows@5.0 # The Windows orb give you everything you need to start using the Windows executor.

jobs:
# Job(s) with Linux OS
venv_build:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.12
working_directory: ~/repo
steps:
- checkout
Expand All @@ -40,7 +40,7 @@ jobs:
- ./venv
venv_pytest:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.12
working_directory: ~/repo
steps:
- checkout
Expand All @@ -56,7 +56,7 @@ jobs:
path: test-reports/
venv_lint:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.12
working_directory: ~/repo
steps:
- checkout
Expand All @@ -65,40 +65,28 @@ jobs:
- run:
name: Run linter with venv
command: make venv_lint
tox-py310-core:
tox-py312-core:
<<: *tox_common
docker:
- image: cimg/python:3.10
- image: cimg/python:3.12
environment:
TOXENV: py310-core
tox-py38-core:
TOXENV: py312-core
tox-py312-script:
<<: *tox_common
docker:
- image: cimg/python:3.8
- image: cimg/python:3.12
environment:
TOXENV: py38-core
tox-py310-script:
<<: *tox_common
docker:
- image: cimg/python:3.10
environment:
TOXENV: py310-script
tox-py38-script:
<<: *tox_common
docker:
- image: cimg/python:3.8
environment:
TOXENV: py38-script
TOXENV: py312-script
# Job(s) with Windows OS
win-py310-script:
win-py312-script:
executor:
name: win/default
shell: powershell.exe
steps:
- checkout
- run:
name: "Install Python"
command: choco install python --version=3.10.3
command: choco install python --version=3.12.2 -y
- run:
name: Install testing requirements on Windows
command: python -m pip install -r requirements_test.txt
Expand All @@ -110,15 +98,15 @@ jobs:
command: python ./test_btec_script.py
build-linux-amd64:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2204:2024.01.1
working_directory: ~/repo
steps:
- checkout
- run:
name: Install building requirements on Linux
command: |
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f 3.10.2;
pyenv global 3.10.2;
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f 3.12.1;
pyenv global 3.12.1;
pip install -r ./build_configs/linux/requirements.txt;
- run:
name: Build with build.spec
Expand All @@ -127,7 +115,7 @@ jobs:
export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7)
export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-amd64;
mkdir ${BUILD_FILE_NAME};
pyenv global 3.10.2;
pyenv global 3.12.1;
pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec;
- run:
name: Test executable binaries
Expand Down Expand Up @@ -157,16 +145,16 @@ jobs:
path: /tmp/artifacts
build-linux-arm64:
machine:
image: ubuntu-2004:202201-02
image: ubuntu-2204:2024.01.1
resource_class: arm.medium
working_directory: ~/repo
steps:
- checkout
- run:
name: Install building requirements on Linux ARM64
command: |
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f 3.10.2;
pyenv global 3.10.2;
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f 3.12.1;
pyenv global 3.12.1;
pip install -r ./build_configs/linux/requirements.txt;
- run:
name: Build with build.spec
Expand All @@ -175,7 +163,7 @@ jobs:
export CIRCLE_SHORT_SHA1=$(eval echo $CIRCLE_SHA1 | cut -c -7)
export BUILD_FILE_NAME=staking_deposit-cli-${CIRCLE_SHORT_SHA1}-linux-arm64;
mkdir ${BUILD_FILE_NAME};
pyenv global 3.10.2;
pyenv global 3.12.1;
pyinstaller --distpath ./${BUILD_FILE_NAME} ./build_configs/linux/build.spec;
- run:
name: Test executable binaries
Expand Down Expand Up @@ -210,7 +198,7 @@ jobs:
- checkout
- run:
name: "Install Python"
command: choco install python --version=3.10.3
command: choco install python --version=3.12.2 -y
- run:
name: Install building requirements on Windows
command: pip install -r ./build_configs/windows/requirements.txt
Expand Down Expand Up @@ -254,7 +242,7 @@ jobs:
path: /tmp/artifacts
build-macos:
macos:
xcode: 13.4.1
xcode: 15.1.0
working_directory: ~/repo
steps:
- run: xcodebuild -version
Expand Down Expand Up @@ -309,11 +297,9 @@ workflows:
- venv_lint:
requires:
- venv_build
- tox-py310-core
- tox-py38-core
- tox-py310-script
- tox-py38-script
- win-py310-script
- tox-py312-core
- tox-py312-script
- win-py312-script
build_linux:
jobs:
- build-linux-amd64
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: run-tests
run-name: ${{ github.actor }} is running tests
on: [push, pull_request]
jobs:
tests:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
- name: Run tests
run: pytest tests
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:alpine3.14
FROM python:alpine3.19

WORKDIR /app

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VENV_NAME?=venv
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate
PYTHON=${VENV_NAME}/bin/python3.8
PYTHON=${VENV_NAME}/bin/python3.12
DOCKER_IMAGE="ethereum/staking-deposit-cli:latest"

help:
Expand All @@ -24,9 +24,9 @@ clean:

$(VENV_NAME)/bin/activate: requirements.txt
@test -d $(VENV_NAME) || python3 -m venv --clear $(VENV_NAME)
${VENV_NAME}/bin/python setup.py install
${VENV_NAME}/bin/python -m pip install -r requirements.txt
${VENV_NAME}/bin/python -m pip install -r requirements_test.txt
${VENV_NAME}/bin/python setup.py install
@touch $(VENV_NAME)/bin/activate

venv_build: $(VENV_NAME)/bin/activate
Expand Down
Loading

0 comments on commit b09771e

Please sign in to comment.