Modernize python packaging #980
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: [push, pull_request] | |
| concurrency: # https://stackoverflow.com/questions/66335225#comment133398800_72408109 | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| linters: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch git tags for setuptools_scm (smart_open.__version__) | |
| - name: Setup up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install flake8 -e .[all] | |
| - name: Run flake8 linter (source) | |
| run: flake8 --show-source smart_open | |
| - name: "Check whether help.txt update was forgotten" | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| python update_helptext.py | |
| test ! "$(git diff)" && echo "no changes" || ( git diff && echo 'looks like "python update_helptext.py" was forgotten' && exit 1 ) | |
| unit_tests: | |
| needs: [linters] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - {python-version: '3.8', os: ubuntu-22.04} | |
| - {python-version: '3.9', os: ubuntu-22.04} | |
| - {python-version: '3.10', os: ubuntu-22.04} | |
| - {python-version: '3.11', os: ubuntu-22.04} | |
| - {python-version: '3.12', os: ubuntu-22.04} | |
| - {python-version: '3.13', os: ubuntu-22.04} | |
| - {python-version: '3.8', os: windows-2019} | |
| - {python-version: '3.9', os: windows-2019} | |
| - {python-version: '3.10', os: windows-2019} | |
| - {python-version: '3.11', os: windows-2019} | |
| - {python-version: '3.12', os: windows-2019} | |
| - {python-version: '3.13', os: windows-2019} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch git tags for setuptools_scm (smart_open.__version__) | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install smart_open without dependencies | |
| run: pip install -e . | |
| - name: Check that smart_open imports without dependencies | |
| run: python -c 'import smart_open' | |
| - name: Install smart_open and its dependencies | |
| run: pip install -e .[test] | |
| - name: Run unit tests | |
| run: pytest tests -v -rfxECs --durations=20 | |
| doctest: | |
| needs: [linters,unit_tests] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - {python-version: '3.8', os: ubuntu-22.04} | |
| - {python-version: '3.9', os: ubuntu-22.04} | |
| - {python-version: '3.10', os: ubuntu-22.04} | |
| - {python-version: '3.11', os: ubuntu-22.04} | |
| - {python-version: '3.12', os: ubuntu-22.04} | |
| - {python-version: '3.13', os: ubuntu-22.04} | |
| # | |
| # Some of the doctests don't pass on Windows because of Windows-specific | |
| # character encoding issues. | |
| # | |
| # - {python-version: '3.7', os: windows-2019} | |
| # - {python-version: '3.8', os: windows-2019} | |
| # - {python-version: '3.9', os: windows-2019} | |
| # - {python-version: '3.10', os: windows-2019} | |
| # - {python-version: '3.11', os: windows-2019} | |
| # - {python-version: '3.12', os: windows-2019} | |
| # - {python-version: '3.13', os: windows-2019} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch git tags for setuptools_scm (smart_open.__version__) | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install smart_open and its dependencies | |
| run: pip install -e .[test] | |
| - name: Run doctests | |
| run: python ci_helpers/doctest.py | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| integration: | |
| needs: [linters,unit_tests] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - {python-version: '3.8', os: ubuntu-22.04} | |
| - {python-version: '3.9', os: ubuntu-22.04} | |
| - {python-version: '3.10', os: ubuntu-22.04} | |
| - {python-version: '3.11', os: ubuntu-22.04} | |
| - {python-version: '3.12', os: ubuntu-22.04} | |
| - {python-version: '3.13', os: ubuntu-22.04} | |
| # Not sure why we exclude these, perhaps for historical reasons? | |
| # | |
| # - {python-version: '3.7', os: windows-2019} | |
| # - {python-version: '3.8', os: windows-2019} | |
| # - {python-version: '3.9', os: windows-2019} | |
| # - {python-version: '3.10', os: windows-2019} | |
| # - {python-version: '3.11', os: windows-2019} | |
| # - {python-version: '3.12', os: windows-2019} | |
| # - {python-version: '3.13', os: windows-2019} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch git tags for setuptools_scm (smart_open.__version__) | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install smart_open and its dependencies | |
| run: pip install -e .[test] | |
| - run: bash ci_helpers/helpers.sh enable_moto_server | |
| if: ${{ matrix.moto_server }} | |
| - name: Start vsftpd | |
| timeout-minutes: 2 | |
| run: | | |
| sudo apt-get install vsftpd | |
| sudo bash ci_helpers/helpers.sh create_ftp_ftps_servers | |
| - name: Run integration tests | |
| run: python ci_helpers/run_integration_tests.py | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| - run: bash ci_helpers/helpers.sh disable_moto_server | |
| if: ${{ matrix.moto_server }} | |
| - run: sudo bash ci_helpers/helpers.sh delete_ftp_ftps_servers | |
| benchmarks: | |
| needs: [linters,unit_tests] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - {python-version: '3.8', os: ubuntu-22.04} | |
| - {python-version: '3.9', os: ubuntu-22.04} | |
| - {python-version: '3.10', os: ubuntu-22.04} | |
| - {python-version: '3.11', os: ubuntu-22.04} | |
| - {python-version: '3.12', os: ubuntu-22.04} | |
| - {python-version: '3.13', os: ubuntu-22.04} | |
| # - {python-version: '3.7', os: windows-2019} | |
| # - {python-version: '3.8', os: windows-2019} | |
| # - {python-version: '3.9', os: windows-2019} | |
| # - {python-version: '3.10', os: windows-2019} | |
| # - {python-version: '3.11', os: windows-2019} | |
| # - {python-version: '3.12', os: windows-2019} | |
| # - {python-version: '3.13', os: windows-2019} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch git tags for setuptools_scm (smart_open.__version__) | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install smart_open and its dependencies | |
| run: pip install -e .[test] | |
| - name: Run benchmarks | |
| run: python ci_helpers/run_benchmarks.py | |
| env: | |
| SO_BUCKET: smart-open | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # | |
| # The test_coverage environment in tox.ini generates coverage data and | |
| # saves it to disk. This step uploads that data. We do it | |
| # separately from the tox env because the upload can fail for various | |
| # reasons (e.g. https://github.com/lemurheavy/coveralls-public/issues/1392) | |
| # and we don't want it to break the build. | |
| # | |
| # Looks like there's a github action for this | |
| # (https://github.com/coverallsapp/github-action/issues/30) but it does | |
| # not work with pytest output. | |
| # | |
| # - name: Upload code coverage to coveralls.io | |
| # if: ${{ matrix.coveralls }} | |
| # continue-on-error: true | |
| # env: | |
| # GITHUB_TOKEN: ${{ github.token }} | |
| # run: | | |
| # pip install coveralls | |
| # coveralls |