CI/CD
This commit is contained in:
+44
-24
@@ -73,31 +73,51 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git clone http://gitea:3000/sajad-dev/Ai.git .
|
git clone http://gitea:3000/sajad-dev/Ai.git .
|
||||||
|
|
||||||
- name: Install Python
|
# - name: Install Python
|
||||||
run: |
|
# run: |
|
||||||
apt-get install -y python3 python3-pip python3-venv git
|
# apt-get install -y python3 python3-pip python3-venv git
|
||||||
|
|
||||||
- name: Setup Python pip mirrors
|
# - name: Setup Python pip mirrors
|
||||||
run: |
|
# run: |
|
||||||
pip3 config --user set global.index-url https://package-mirror.liara.ir/repository/pypi/simple
|
# pip3 config --user set global.index-url https://package-mirror.liara.ir/repository/pypi/simple
|
||||||
pip3 config --user set global.extra-index-url https://mirror.cdn.ir/repository/pypi/simple
|
# pip3 config --user set global.extra-index-url https://mirror.cdn.ir/repository/pypi/simple
|
||||||
pip3 config --user set global.trusted-host "package-mirror.liara.ir mirror.cdn.ir mirror2.chabokan.net"
|
# pip3 config --user set global.trusted-host "package-mirror.liara.ir mirror.cdn.ir mirror2.chabokan.net"
|
||||||
- name: Install system dependencies
|
# - name: Install system dependencies
|
||||||
run: |
|
# run: |
|
||||||
apt-get install -y \
|
# apt-get install -y \
|
||||||
python3 \
|
# python3 \
|
||||||
python3-pip \
|
# python3-pip \
|
||||||
python3-venv \
|
# python3-venv \
|
||||||
pkg-config \
|
# pkg-config \
|
||||||
build-essential \
|
# build-essential \
|
||||||
default-libmysqlclient-dev
|
# default-libmysqlclient-dev
|
||||||
|
|
||||||
- name: Install dependencies
|
# - name: Install dependencies
|
||||||
run: |
|
# run: |
|
||||||
python3 -m pip install --upgrade pip
|
# python3 -m pip install --upgrade pip
|
||||||
pip3 install -r requirements.txt
|
# pip3 install -r requirements.txt
|
||||||
pip3 install pytest flake8
|
# pip3 install pytest flake8
|
||||||
|
|
||||||
- name: Run lint
|
# - name: Run lint
|
||||||
|
# run: |
|
||||||
|
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
|
||||||
|
- name: Install ssh client
|
||||||
run: |
|
run: |
|
||||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
apt-get install -y openssh-client
|
||||||
|
|
||||||
|
- name: Setup SSH key
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
run: |
|
||||||
|
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'EOF'
|
||||||
|
cd application/Ai
|
||||||
|
git pull origin production
|
||||||
|
docker-compose down
|
||||||
|
docker-compose up -d
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user