Add unit tests for CloudProxy functionality #168
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python application | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
pull_request: | |
branches: | |
- develop | |
- main | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
jobs: | |
build: | |
name: Testing | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest pytest-mock pytest-cov | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Test with pytest | |
run: | | |
# Set dummy environment variables for testing | |
export PROXY_USERNAME=test_username | |
export PROXY_PASSWORD=test_password | |
export DIGITALOCEAN_ACCESS_TOKEN=test_do_token | |
export AWS_ACCESS_KEY=test_aws_key | |
export AWS_SECRET_KEY=test_aws_secret | |
export HETZNER_API_TOKEN=test_hetzner_token | |
export GCP_SERVICE_ACCOUNT={} | |
# Run the tests | |
pytest | |
- name: Generate coverage report | |
run: | | |
pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |