Handle openvpn requiring sudo and add CI tests #23
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: Run tests | |
on: [pull_request, workflow_dispatch] | |
env: | |
PIP_ROOT_USER_ACTION: ignore | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, macos-latest] | |
python-version: ["3.12"] | |
runs-on: ${{ matrix.os }} | |
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 dependencies | |
run: > | |
python -m pip install --upgrade pip | |
pip install -r test-requirements.txt prod-requirements.txt | |
--root-user-action=ignore | |
- name: Install OpenVPN on Ubuntu | |
if: matrix.os == 'ubuntu-24.04' | |
run: | | |
sudo apt update | |
sudo apt install openvpn | |
- name: Install OpenVPN on macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install openvpn | |
- name: Run tests on ${{ matrix.os }} | |
run: | | |
cp openvpnclient.py tests/ | |
pytest tests/test_openvpnclient.py -s -v | |
- name: Get test coverage percent | |
run: > | |
cp openvpnclient.py tests/ | |
pytest -s --cov=. tests/test_openvpnclient.py | |
--cov-report term --cov-report annotate | |
cat "openvpnclient.py,cover" |