Ydo #124
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: CI/CD for Backend | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
types: [opened, closed] | |
branches: [main, master] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Set Environment Variables | |
run: | | |
echo "MONGODB_USER=${{ secrets.MONGODB_USER }}" >> $GITHUB_ENV | |
echo "MONGO_PWD=${{ secrets.MONGO_PWD }}" >> $GITHUB_ENV | |
echo "DB_HOST=${{ secrets.DB_HOST }}" >> $GITHUB_ENV | |
echo "API_KEY=${{ secrets.API_KEY }}" >> $GITHUB_ENV | |
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r backend_api/requirements.txt | |
pip install pytest | |
pip install pylint black | |
- name: Run Pylint | |
run: pylint backend_api/ --ignore-patterns='.*\.pb2\.py,.*\.pb2_grpc\.py' | |
- name: Run Black (Check mode) | |
run: black backend_api/ | |
- name: Run tests | |
run: pytest tests/web_app_tests.py |