name: Python CI on: push: branches: [ master ] pull_request: branches: [ master ] defaults: run: shell: bash working-directory: python jobs: build: runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - name: Install dependencies # aioresponses >= 0.7.7 uses PEP 585 (collections.abc.Mapping[str, str]) # at class-body scope, which only works on Python 3.9+. Pin to 0.7.6 # on 3.7/3.8 to keep the import path working; keep >=0.7.8 elsewhere. run: pip install 'cryptography>=3.0.0,<46.0.0; python_version < "3.8"' 'cryptography>=3.0.0,<48.0.0; python_version == "3.8"' 'cryptography>=50.0.0,<51.0.0; python_version >= "3.9"' urllib3==1.26.20 'darabonba-core>=1.0.10,<2.0.0' coverage pytest 'alibabacloud_credentials>=1.0.0' alibabacloud_gateway_spi==0.0.3 httpretty alibabacloud_gateway_pop==0.0.7 'aioresponses==0.7.6; python_version < "3.9"' 'aioresponses>=0.7.8; python_version >= "3.9"' 'aiohttp>=3.7.0,<3.14' - name: Test with unittest run: | coverage run --source="./alibabacloud_tea_openapi" -m pytest tests/test_* coverage xml -o coverage.xml - name: Require 90% diff coverage if: github.event_name == 'pull_request' run: | git fetch --no-tags --depth=1 origin ${{ github.event.pull_request.base.sha }} python3 "${{ github.workspace }}/.github/scripts/require_diff_coverage.py" \ --base "${{ github.event.pull_request.base.sha }}" \ --source-root python \ --report coverage.xml \ --format cobertura \ --minimum 90 - uses: codecov/codecov-action@v4 with: flags: python token: ${{ secrets.CODECOV_TOKEN }}