-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Likhon Sheikh
authored
Jun 27, 2024
1 parent
cea4426
commit 36b8db7
Showing
1 changed file
with
44 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,51 @@ | ||
name: Deploy | ||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # or any other branch you use for deployment | ||
branches: [ $default-branch ] | ||
pull_request: | ||
branches: [ $default-branch ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
environment: | ||
name: production # The name of the environment where you've configured your secrets | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' # Ensure this matches your project's requirements | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Deploy | ||
env: | ||
MONGODB_URI: ${{ secrets.MONGODB_URI }} | ||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | ||
run: | | ||
# Run your application or deployment script here | ||
python3 app.py | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
python3 -m pip install -r requirements.txt | ||
- name: Lint with flake8 | ||
run: | | ||
source venv/bin/activate | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
source venv/bin/activate | ||
pytest | ||
- name: Deploy Python App | ||
env: | ||
MONGODB_URI: ${{ secrets.MONGODB_URI }} | ||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | ||
run: | | ||
source venv/bin/activate | ||
python3 app.py |