Skip to content

Commit 3d113f0

Browse files
committed
New: setup CI/CD workflow
1 parent 3f347ca commit 3d113f0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Diff for: .github/workflows/forum.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Forum CI/CD
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["master"]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
max-parallel: 4
14+
matrix:
15+
python-version: [3.10]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install Dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
- name: Run Tests
28+
run: |
29+
coverage run -m pytest
30+
31+
- name: Deploy to digital ocean
32+
uses: appleboy/ssh-action@master
33+
with:
34+
host: "161.35.20.217"
35+
username: "root"
36+
port: 22
37+
key: ${{ secrets.DO_PRIVATE_KEY}}
38+
script: |
39+
cd forum-backend/
40+
docker stop forum-backend-container || true
41+
docker rm forum-backend-container || true
42+
docker system prune -af
43+
docker build -t forum-backend:v0 .
44+
docker run -d --name forum-backend-container --env-file .env -p 80:8000 forum-backend:v0

0 commit comments

Comments
 (0)