debugging 2 #22
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: | | |
echo "Running deploy 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/activate | |
pip install -r requirements.txt | |
python manage.py migrate | |
python manage.py collectstatic --noinput | |
sudo systemctl restart django | |
# Add ssh verbose for debugging | |
ssh -i ~/.ssh/id_rsa ubuntu-1021342@145.24.223.64 -p 22 "echo 'SSH Test Connection Successful'" | |
timeout: 300s # Timeout in seconds (5 minutes) | |
- name: Debug SSH Action | |
run: | | |
echo "Starting SSH deployment..." | |
echo "Server IP: ${{ secrets.SERVER_IP }}" | |
echo "User: ${{ secrets.SERVER_USER }}" | |
echo "SSH Key: ${{ secrets.SERVER_SSH_KEY }}" | |