From 830913e4c36dafc21f5214d3f50ed6fe83faace0 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Sat, 19 Oct 2024 18:11:08 +0500 Subject: [PATCH 1/2] Start testing with common Ubuntu packages as dependencies --- .../{test.yml => test-pypa-ubuntu.yml} | 15 +++++++++ .github/workflows/test-ubuntu.yml | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+) rename .github/workflows/{test.yml => test-pypa-ubuntu.yml} (76%) create mode 100644 .github/workflows/test-ubuntu.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test-pypa-ubuntu.yml similarity index 76% rename from .github/workflows/test.yml rename to .github/workflows/test-pypa-ubuntu.yml index 67b0162..d5c1ad3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-pypa-ubuntu.yml @@ -1,9 +1,24 @@ +name: Tests (PyPA packages) + +on: + push: + branches: + - "master" + pull_request: + branches: + - "master" + jobs: test: strategy: matrix: python-version: ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"] os: ["ubuntu-22.04"] + include: + - python-version: "3.6" + os: "ubuntu-20.04" + - python-version: "3.5" + os: "ubuntu-20.04" runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml new file mode 100644 index 0000000..2cd30c8 --- /dev/null +++ b/.github/workflows/test-ubuntu.yml @@ -0,0 +1,33 @@ +name: Tests (Ubuntu packages) + +on: + push: + branches: + - "master" + pull_request: + branches: + - "master" + +jobs: + test: + strategy: + matrix: + os: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + with: + submodules: 'true' + - name: Set up Python + run: sudo apt-get install python3 + - name: Install requirements + run: sudo apt-get install python3-redis python3-hiredis python3-requests python3-zmq + - name: Install requirements for testing (from PyPA) + if: matrix.os == 'ubuntu-20.04' + run: python3 -m pip install mockito + - name: Install requirements for testing (from Ubuntu packages) + if: matrix.os != 'ubuntu-20.04' + run: sudo apt-get install python3-mockito + - name: Run tests + run: python3 -m unittest tests From 487e35e5b190dc7592ae2b0656d0c87729ee53af Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Sat, 19 Oct 2024 16:51:55 +0500 Subject: [PATCH 2/2] Fix broken tests in GitHub CI/CD --- .github/workflows/test-pypa-ubuntu.yml | 41 ++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-pypa-ubuntu.yml b/.github/workflows/test-pypa-ubuntu.yml index d5c1ad3..3da9923 100644 --- a/.github/workflows/test-pypa-ubuntu.yml +++ b/.github/workflows/test-pypa-ubuntu.yml @@ -12,25 +12,60 @@ jobs: test: strategy: matrix: - python-version: ["3.12", "3.11", "3.10", "3.9", "3.8", "3.7"] - os: ["ubuntu-22.04"] include: + - python-version: "3.12" + os: "ubuntu-22.04" + - python-version: "3.11" + os: "ubuntu-22.04" + - python-version: "3.10" + os: "ubuntu-22.04" + - python-version: "3.9" + os: "ubuntu-22.04" + - python-version: "3.8" + os: "ubuntu-22.04" + - python-version: "3.7" + os: "ubuntu-22.04" - python-version: "3.6" os: "ubuntu-20.04" - python-version: "3.5" os: "ubuntu-20.04" runs-on: ${{ matrix.os }} + env: + GET_PIP_PATH_PREFIX: ${{ contains(fromJSON('["3.7", "3.6", "3.5"]'), matrix.python-version) && format('pip/{0}/', matrix.python-version) || '' }} steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Include ppa repository run: sudo add-apt-repository ppa:deadsnakes/ppa + - name: Set up Python ${{ matrix.python-version }} run: | sudo apt-get install python${{ matrix.python-version }}-dev sudo update-alternatives --install /usr/bin/python3 python3 `which python${{ matrix.python-version }}` 1 sudo update-alternatives --install /usr/bin/python3-config python3-config `which python${{ matrix.python-version }}-config` 1 + + - name: Install disutils package + if: contains(fromJSON('["3.5"]'), matrix.python-version) == false + run: sudo apt-get install python${{ matrix.python-version }}-distutils + + - name: Download get-pip.py + run: curl https://bootstrap.pypa.io/${{ env.GET_PIP_PATH_PREFIX }}get-pip.py -o get-pip.py + + - name: Install pip + run: python3 get-pip.py + + # TODO: try to remove this after unpining redis + - name: Install setuptools + if: contains(fromJSON('["3.12"]'), matrix.python-version) + run: python3 get-pip.py "setuptools" + + - name: Install requirements + run: python3 -m pip install -r requirements.txt + - name: Install requirements for testing - run: sudo python3 -m pip install mockito + run: python3 -m pip install mockito + - name: Run tests run: python3 -m unittest tests