update codecov-action to v4, python to 3.12 #1
This file contains 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: Code Coverage | |
on: [push, pull_request] | |
jobs: | |
code-coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Run local websockets echo server on port ${{ env.LOCAL_WS_SERVER_PORT }} | |
run: | | |
pip3 install -U websockets asyncio | |
python3 websocket/tests/echo-server.py & | |
- name: Run test cases without internet or option dependencies to verify no offline test failures and verify optional dependencies are optional | |
run: | | |
pip3 install coverage pytest pytest-cov setuptools | |
python3 -c "import setuptools; print('Setup tools version'); print(setuptools.__version__)" | |
pip3 install -e . | |
pytest -v -r f --cov=websocket websocket/tests --cov-config=.coveragerc | |
coverage report | |
- name: Install wsaccel and python-socks, then run all test cases for coverage collection | |
run: | | |
pip3 install wsaccel python-socks | |
pytest -v -r f --cov=websocket websocket/tests --cov-config=.coveragerc --cov-append | |
coverage report | |
env: | |
TEST_WITH_INTERNET: 1 | |
LOCAL_WS_SERVER_PORT: 8765 | |
- name: Run SSL test with extra environment variable and create report | |
run: | | |
ls $WEBSOCKET_CLIENT_CA_BUNDLE | |
python3 -c "import ssl; print(ssl.get_default_verify_paths().capath)" | |
pytest -v -r f --cov=websocket websocket/tests --cov-config=.coveragerc --cov-append -k "testSSLopt" | |
coverage report -m | |
env: | |
TEST_WITH_INTERNET: 1 | |
LOCAL_WS_SERVER_PORT: 8765 | |
WEBSOCKET_CLIENT_CA_BUNDLE: "/usr/lib/ssl/certs" | |
- name: Run SSL test with extra environment variable and create report | |
run: | | |
python3 -c "import ssl; print(ssl.get_default_verify_paths().capath)" | |
pytest -v -r f --cov=websocket websocket/tests --cov-config=.coveragerc --cov-append -k "testSSLopt" | |
coverage xml | |
env: | |
TEST_WITH_INTERNET: 1 | |
LOCAL_WS_SERVER_PORT: 8765 | |
WEBSOCKET_CLIENT_CA_BUNDLE: "/usr/lib/ssl/certs/Baltimore_CyberTrust_Root.pem" | |
- name: Submit code coverage report to Codecov.io | |
uses: codecov/codecov-action@v4 |