This repository was archived by the owner on Feb 13, 2025. It is now read-only.
error fix? #20
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: Django CI | |
on: | |
push: | |
branches: [ "Refactoring" ] | |
pull_request: | |
branches: [ "Refactoring" ] | |
jobs: | |
# Build Job | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
working-directory: ./CargoHub | |
# Test Job | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
working-directory: ./CargoHub | |
- name: Test with pytest | |
run: | | |
pytest | |
working-directory: ./CargoHub | |
# Deploy Job | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: SSH into server and deploy | |
uses: appleboy/ssh-action@v0.1.0 | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.SERVER_SSH_KEY }} | |
port: 22 | |
script: | | |
cd /home/ubuntu-1021342/Repo/Process-and-Tools/CargoHub | |
git pull origin Refactoring | |
source /home/ubuntu-1021342/Repo/Process-and-Tools/CargoHub/venv/bin | |
pip install -r requirements.txt | |
python manage.py migrate | |
sudo systemctl restart django | |
timeout: 300s # Timeout in seconds (5 minutes) |