Made structural changes to the server code. #81
Workflow file for this run
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 CI | |
on: | |
push: | |
paths: | |
- "server/**" | |
branches: | |
- dev | |
pull_request: | |
paths: | |
- "server/**" | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./server | |
steps: | |
- name: Checkout the Git Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tests | |
run: | | |
pytest tests/ | |
- name: Run security checks with bandit | |
uses: mdegis/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
path: "." | |
level: high | |
confidence: high | |
exit_zero: true | |
- name: Start application | |
run: | | |
flask run & | |
sleep 5 # give Flask time to start | |
- name: Check application is running | |
run: | | |
curl localhost:5000 | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
continue-on-error: true | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: your-dockerhub-username/your-repo-name:latest | |
continue-on-error: true | |
deploy: | |
runs-on: ubuntu-latest | |
needs: docker-build | |
steps: | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
continue-on-error: true | |
- name: Deploy to Azure Web App | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: 'your-app-name' | |
slot-name: 'production' | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
images: 'your-dockerhub-username/your-repo-name:latest' | |
continue-on-error: true |