Add more CI testing

This commit is contained in:
Florian Bach 2023-05-06 17:51:45 +02:00
parent f5e19f4391
commit a7013047d2
2 changed files with 43 additions and 14 deletions

View File

@ -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'

View File

@ -28,7 +28,26 @@ jobs:
path: | path: |
calibre-plugin.zip calibre-plugin.zip
calibre-migration-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: test-ubuntu-2004:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -36,12 +55,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
# Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. pip3 install -r ./.github/workflows/ci_test_requirements.txt
pip3 install freezegun lxml pycryptodome rsa oscrypto "cryptography>=3.1"
# Install Python2 stuff # Install Python2 stuff
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python2 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) - name: Run tests (Python 3)
run: | run: |
@ -60,14 +78,15 @@ jobs:
id: pip-stuff id: pip-stuff
continue-on-error: true continue-on-error: true
run: | 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. # 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 # Install Python2 stuff
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo apt install python2 sudo apt install python2
python2 get-pip.py 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) - name: Run tests (Python 3)
if: steps.pip-stuff.outcome == 'success' && steps.pip-stuff.conclusion == 'success' if: steps.pip-stuff.outcome == 'success' && steps.pip-stuff.conclusion == 'success'
@ -88,14 +107,14 @@ jobs:
run: | run: |
# Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. # 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 # 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 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 # Install Python2 stuff
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo apt install python2 sudo apt install python2
python2 get-pip.py 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 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) - name: Run tests (Python 3)
run: | run: |
@ -114,7 +133,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
# Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. # 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 shell: bash
- name: Run tests (Python 3) - name: Run tests (Python 3)
@ -130,7 +149,7 @@ jobs:
- name: Install deps for Python 2 - name: Install deps for Python 2
run: | run: |
# Install Python2 stuff # 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) - name: Run tests (Python 2)
run: | run: |
@ -145,12 +164,11 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
# Require cryptography >= 3.1 because in 3.0 and below, the backend param in load_key_and_certificates was still required. pip3 install -r ./.github/workflows/ci_test_requirements.txt
pip3 install freezegun lxml pycryptodome rsa oscrypto "cryptography>=3.1"
# Install Python2 stuff # Install Python2 stuff
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python2 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) - name: Run tests (Python 3)
run: | run: |