Merwin aamir #11
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: Python application | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
working-directory: VitalTrackServer | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8==4.0.1 pytest==7.0.1 # Pinning specific versions | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Set MongoDB URI environment variable | |
env: | |
MONGO_API_KEY: ${{ secrets.MONGO_API_KEY }} | |
run: echo "MongoDB URI set" | |
- name: Lint with flake8 | |
working-directory: VitalTrackServer | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
working-directory: VitalTrackServer | |
run: | | |
pytest |