From a7013047d2504edcca78df7683bace52a5dd84cc Mon Sep 17 00:00:00 2001 From: Florian Bach Date: Sat, 6 May 2023 17:51:45 +0200 Subject: [PATCH] Add more CI testing --- .github/workflows/ci_test_requirements.txt | 11 ++++++ .github/workflows/main.yml | 46 +++++++++++++++------- 2 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/ci_test_requirements.txt diff --git a/.github/workflows/ci_test_requirements.txt b/.github/workflows/ci_test_requirements.txt new file mode 100644 index 0000000..1a1dcda --- /dev/null +++ b/.github/workflows/ci_test_requirements.txt @@ -0,0 +1,11 @@ +freezegun +mock ; python_version < '3.0' +lxml +pycryptodome +rsa ; python_version >= '3.0' +rsa <= 4.3 ; python_version < '3.0' +oscrypto + +# Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. +cryptography==3.1 ; python_version < '3.0' +cryptography>=3.1 ; python_version >= '3.0' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 96a3248..3ae3c11 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,26 @@ jobs: path: | calibre-plugin.zip calibre-migration-plugin.zip - + + test-all-python-versions: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ["2.7", "3.8", "3.9", "3.10", "3.11"] + # 3.12-dev doesn't work yet due to lxml + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install python requirements + run: pip install -r ./.github/workflows/ci_test_requirements.txt + - name: Run tests + run: | + cd tests && python --version && PYTHONWARNINGS=ignore python ./main.py + + test-ubuntu-2004: runs-on: ubuntu-20.04 steps: @@ -36,12 +55,11 @@ jobs: - name: Install dependencies run: | - # Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. - pip3 install freezegun lxml pycryptodome rsa oscrypto "cryptography>=3.1" + pip3 install -r ./.github/workflows/ci_test_requirements.txt # Install Python2 stuff curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py python2 get-pip.py - pip2 --no-python-version-warning install freezegun mock lxml pycryptodome "rsa<=4.3" oscrypto cryptography==3.1 + pip2 --no-python-version-warning install -r ./.github/workflows/ci_test_requirements.txt - name: Run tests (Python 3) run: | @@ -60,14 +78,15 @@ jobs: id: pip-stuff continue-on-error: true run: | - # Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. # Require oscrypto > 1.3.0 because all versions until 1.3.0 had no (or broken) OpenSSL 3 support. - pip3 install freezegun lxml pycryptodome rsa "oscrypto>1.3.0" "cryptography>=3.1" + pip3 install "oscrypto>1.3.0" + pip3 install -r ./.github/workflows/ci_test_requirements.txt # Install Python2 stuff curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py sudo apt install python2 python2 get-pip.py - pip2 --no-python-version-warning install freezegun mock lxml pycryptodome "rsa<=4.3" "oscrypto>1.3.0" cryptography==3.1 + pip2 --no-python-version-warning install "oscrypto>1.3.0" + pip2 --no-python-version-warning install -r ./.github/workflows/ci_test_requirements.txt - name: Run tests (Python 3) if: steps.pip-stuff.outcome == 'success' && steps.pip-stuff.conclusion == 'success' @@ -88,14 +107,14 @@ jobs: run: | # Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. # Installing a forked version of oscrypto to fix OpenSSL 3 issues - pip3 install freezegun lxml pycryptodome rsa "cryptography>=3.1" pip3 install https://github.com/Leseratte10/acsm-calibre-plugin/releases/download/config/oscrypto_1.3.0_fork_fe39273cc5020.zip + pip3 install -r ./.github/workflows/ci_test_requirements.txt # Install Python2 stuff curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py sudo apt install python2 python2 get-pip.py - pip2 --no-python-version-warning install freezegun mock lxml pycryptodome "rsa<=4.3" cryptography==3.1 pip2 --no-python-version-warning install https://github.com/Leseratte10/acsm-calibre-plugin/releases/download/config/oscrypto_1.3.0_fork_fe39273cc5020.zip + pip2 --no-python-version-warning install -r ./.github/workflows/ci_test_requirements.txt - name: Run tests (Python 3) run: | @@ -114,7 +133,7 @@ jobs: - name: Install dependencies run: | # Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. - pip3 install freezegun lxml pycryptodome rsa oscrypto "cryptography>=3.1" + pip3 install -r ./.github/workflows/ci_test_requirements.txt shell: bash - name: Run tests (Python 3) @@ -130,7 +149,7 @@ jobs: - name: Install deps for Python 2 run: | # Install Python2 stuff - python -m pip --no-python-version-warning install freezegun mock lxml pycryptodome "rsa<=4.3" oscrypto cryptography==3.1 + pip2 --no-python-version-warning install -r ./.github/workflows/ci_test_requirements.txt - name: Run tests (Python 2) run: | @@ -145,12 +164,11 @@ jobs: - name: Install dependencies run: | - # Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. - pip3 install freezegun lxml pycryptodome rsa oscrypto "cryptography>=3.1" + pip3 install -r ./.github/workflows/ci_test_requirements.txt # Install Python2 stuff curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py python2 get-pip.py - pip2 --no-python-version-warning install freezegun mock lxml pycryptodome "rsa<=4.3" oscrypto cryptography==3.1 + pip2 --no-python-version-warning install -r ./.github/workflows/ci_test_requirements.txt - name: Run tests (Python 3) run: |