Skip to content

Commit 186368a

Browse files
committed
correcting errors
1 parent 03918e3 commit 186368a

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,56 @@
1-
# .github/workflows/ci.yml
2-
name: CI
1+
name: CI/CD Pipeline
32

4-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
510

611
jobs:
712
build:
813
runs-on: ubuntu-latest
914

1015
steps:
11-
- uses: actions/checkout@v2 # Step to check out the code
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
1219
- name: Set up Python
13-
uses: actions/setup-python@v2 # Step to set up Python on Window
20+
uses: actions/setup-python@v2
1421
with:
1522
python-version: "3.10.11"
1623

17-
- name: Install dependencies # Install dependencies
24+
- name: Install dependencies
1825
run: |
1926
python -m pip install --upgrade pip
20-
pip install Flask flake8 pytest
27+
pip install -r requirements.txt
28+
29+
- name: Run tests
30+
run: |
31+
# You can use pytest or any other testing framework
32+
pytest
2133
22-
- name: Lint with Flake8
23-
run: flake8 app.py
34+
deploy:
35+
runs-on: windows-latest
36+
needs: build
37+
if: github.ref == 'refs/heads/main' # Deploy only from the main branch
2438

25-
- name: Run unit tests
26-
run: python test_app.py
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v2
42+
43+
- name: Deploy to Windows Server
44+
run: |
45+
echo "Deploying to the Windows server..."
46+
# Replace the following command with your deployment script
47+
# Example: Using PowerShell to invoke a deployment script
48+
$session = New-PSSession -ComputerName your_server -Credential (Get-Credential)
49+
Invoke-Command -Session $session -ScriptBlock {
50+
cd "C:\path\to\your\app"
51+
git pull
52+
# Optionally restart your Flask service or application
53+
Stop-Service -Name "your_flask_service" -Force
54+
Start-Service -Name "your_flask_service"
55+
}
56+
Remove-PSSession -Session $session

0 commit comments

Comments
 (0)