name: run tests on: [push, pull_request] jobs: tests: runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: - "3.8" - "3.9" - "3.10" - "3.11" - "3.12" # pypy fails in some cases but we don't care much about that # with github actions we can't mark some jobs to not affect the overall # conclusion so we have to omit "allow-failure" tests. # See https://github.com/actions/toolkit/issues/399 # - pypy-3.7 deps: - tornado pycurl - aiohttp - tornado - httpx[http2]>=0.14.0 exclude: [] steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Setup Cache uses: actions/cache@v4 env: cache-name: cache-pip with: path: ~/.cache/pip key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.deps }}-${{ hashFiles('pyproject.toml', 'setup.cfg') }} restore-keys: | ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.deps }}- ${{ runner.os }}-${{ env.cache-name }}- - name: workaround pycurl wheel if: ${{ contains(matrix.deps, 'pycurl') }} run: | sudo mkdir -p /etc/pki/tls/certs sudo ln -s /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt # werkzeug is pinned for httpbin compatibility https://github.com/postmanlabs/httpbin/issues/673 - name: Install Python deps run: pip install -U ${{ matrix.deps }} pytest 'pytest-asyncio>=0.24' pytest-httpbin pytest-rerunfailures structlog tomli platformdirs lxml jq 'werkzeug<2.1' awesomeversion - name: Decrypt keys env: KEY: ${{ secrets.KEY }} run: if [[ -n $KEY ]]; then openssl enc -d -aes-256-ctr -pbkdf2 -k $KEY -in keyfile.toml.enc -out keyfile.toml; fi - name: Run pytest run: if [[ -f keyfile.toml ]]; then KEYFILE=keyfile.toml pytest; else pytest; fi