Skip to content

Commit

Permalink
Merge pull request #151 from CodeHive-Solutions/dev
Browse files Browse the repository at this point in the history
Format code and update CSV files for consistency; add new migration f…
  • Loading branch information
Heibert authored Dec 19, 2024
2 parents d6b1817 + d1a14d4 commit 76fc579
Show file tree
Hide file tree
Showing 60 changed files with 7,374 additions and 7,244 deletions.
162 changes: 81 additions & 81 deletions .github/workflows/deploy-django.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
name: Deploy Django Project

on:
push:
branches:
- Production-version # Trigger the workflow on push to the production branch

jobs:
deploy:
name: Deploy to Server
runs-on: production # This tells GitHub Actions to use the local runner

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10.12' # Adjust the Python version according to your project

- name: Install Dependencies
run: |
mkdir -p ./INSIGHTSAPI/utils
python -m venv ./INSIGHTSAPI/utils/venv
source ./INSIGHTSAPI/utils/venv/bin/activate
pip install -r ./INSIGHTSAPI/requirements.txt
- name: Sync "excels" Directory
run: |
mkdir -p ./INSIGHTSAPI/utils/excels
rsync -av /var/www/INSIGHTS/INSIGHTSAPI/utils/excels/ ./INSIGHTSAPI/utils/excels/
- name: Sync "static" Directory
run: |
rsync -av /var/www/INSIGHTS/INSIGHTSAPI/static/ ./INSIGHTSAPI/static/
- name: Sync "secure/image" Directory
run: |
mkdir -p ./INSIGHTSAPI/secure/images
rsync -av /var/www/INSIGHTS/INSIGHTSAPI/secure/images/ ./INSIGHTSAPI/secure/images/
- name: Run Tests
run: |
source ./INSIGHTSAPI/utils/venv/bin/activate
cd INSIGHTSAPI
python manage.py test
- name: Run Migrations
run: |
source ./INSIGHTSAPI/utils/venv/bin/activate
python ./INSIGHTSAPI/manage.py migrate
- name: Deploy to production directory
run: |
sudo rsync -av --delete --exclude 'media/' --exclude 'logs/' --exclude='venv/' ./INSIGHTSAPI/ /var/www/INSIGHTS/INSIGHTSAPI/
- name: Recreate Virtual Environment
run: |
cd /var/www/INSIGHTS/INSIGHTSAPI/
if [ -d "utils/venv" ]; then
rm -rf utils/venv
fi
python3 -m venv utils/venv
- name: Install Dependencies
run: |
cd /var/www/INSIGHTS/INSIGHTSAPI/
source utils/venv/bin/activate
pip install -r /home/ares/actions-runner/_work/INSIGHTS/INSIGHTS/INSIGHTSAPI/requirements.txt
# Step 3: Install Python dependencies using the tested `requirements.txt`
- name: Grant Permissions to the Samba user to edit the files
run: |
chgrp -R www-data /var/www/INSIGHTS/INSIGHTSAPI/
chmod -R g+rwx /var/www/INSIGHTS/INSIGHTSAPI/
- name: Restart Nginx Service
run: |
sudo systemctl restart apache
name: Deploy Django Project

on:
push:
branches:
- Production-version # Trigger the workflow on push to the production branch

jobs:
deploy:
name: Deploy to Server
runs-on: production # This tells GitHub Actions to use the local runner

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10.12" # Adjust the Python version according to your project

- name: Install Dependencies
run: |
mkdir -p ./INSIGHTSAPI/utils
python -m venv ./INSIGHTSAPI/utils/venv
source ./INSIGHTSAPI/utils/venv/bin/activate
pip install -r ./INSIGHTSAPI/requirements.txt
- name: Sync "excels" Directory
run: |
mkdir -p ./INSIGHTSAPI/utils/excels
rsync -av /var/www/INSIGHTS/INSIGHTSAPI/utils/excels/ ./INSIGHTSAPI/utils/excels/
- name: Sync "static" Directory
run: |
rsync -av /var/www/INSIGHTS/INSIGHTSAPI/static/ ./INSIGHTSAPI/static/
- name: Sync "secure/image" Directory
run: |
mkdir -p ./INSIGHTSAPI/secure/images
rsync -av /var/www/INSIGHTS/INSIGHTSAPI/secure/images/ ./INSIGHTSAPI/secure/images/
- name: Run Tests
run: |
source ./INSIGHTSAPI/utils/venv/bin/activate
cd INSIGHTSAPI
python manage.py test
- name: Run Migrations
run: |
source ./INSIGHTSAPI/utils/venv/bin/activate
python ./INSIGHTSAPI/manage.py migrate
- name: Deploy to production directory
run: |
sudo rsync -av --delete --exclude 'media/' --exclude 'logs/' --exclude='venv/' ./INSIGHTSAPI/ /var/www/INSIGHTS/INSIGHTSAPI/
- name: Recreate Virtual Environment
run: |
cd /var/www/INSIGHTS/INSIGHTSAPI/
if [ -d "utils/venv" ]; then
rm -rf utils/venv
fi
python3 -m venv utils/venv
- name: Install Dependencies
run: |
cd /var/www/INSIGHTS/INSIGHTSAPI/
source utils/venv/bin/activate
pip install -r /home/ares/actions-runner/_work/INSIGHTS/INSIGHTS/INSIGHTSAPI/requirements.txt
# Step 3: Install Python dependencies using the tested `requirements.txt`
- name: Grant Permissions to the Samba user to edit the files
run: |
chgrp -R www-data /var/www/INSIGHTS/INSIGHTSAPI/
chmod -R g+rwx /var/www/INSIGHTS/INSIGHTSAPI/
- name: Restart Nginx Service
run: |
sudo systemctl restart apache
90 changes: 45 additions & 45 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
name: Deploy React App to Production

on:
push:
branches:
- Production-version # Adjust this to your main branch

jobs:
deploy:
runs-on: production

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18.17.1' # Adjust this to your required Node version

- name: Install Pnpm
run: npm install -g pnpm

- name: Format code
run: pnpm format

- name: Lint code
run: pnpm oxlint

- name: Install dependencies
run: pnpm install

- name: Build project
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: NODE_OPTIONS="--max-old-space-size=4096" pnpm run build

- name: Postbuild project
run: pnpm run postbuild

- name: Deploy to production server
run: |
rm -rf /var/www/INSIGHTS/dist/*
cp -r ./dist/* /var/www/INSIGHTS/dist
sudo systemctl restart apache2
name: Deploy React App to Production

on:
push:
branches:
- Production-version # Adjust this to your main branch

jobs:
deploy:
runs-on: production

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17.1" # Adjust this to your required Node version

- name: Install Pnpm
run: npm install -g pnpm

- name: Format code
run: pnpm format

- name: Lint code
run: pnpm oxlint

- name: Install dependencies
run: pnpm install

- name: Build project
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: NODE_OPTIONS="--max-old-space-size=4096" pnpm run build

- name: Postbuild project
run: pnpm run postbuild

- name: Deploy to production server
run: |
rm -rf /var/www/INSIGHTS/dist/*
cp -r ./dist/* /var/www/INSIGHTS/dist
sudo systemctl restart apache2
42 changes: 21 additions & 21 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
name: Deploy React App

on:
push:
push:
branches:
- dev # Adjust this to your main branch
- dev # Adjust this to your main branch

jobs:
deploy:
runs-on: dev
defaults:
run:
working-directory: ./frontend
deploy:
runs-on: dev
defaults:
run:
working-directory: ./frontend

steps:
- name: Checkout repository
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18.17.1" # Adjust this to your required Node version
node-version: "18.17.1" # Adjust this to your required Node version

- name: Install Pnpm
run: npm install -g pnpm

- name: Install dependencies
- name: Install dependencies
run: pnpm install

- name: Format code
- name: Format code
run: pnpm format

- name: Lint code
- name: Lint code
run: pnpm oxlint

- name: Run tests
- name: Run tests
run: pnpm run test

- name: Build project
- name: Build project
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: NODE_OPTIONS="--max-old-space-size=4096" pnpm run build

- name: Postbuild project
- name: Postbuild project
run: pnpm run postbuild

- name: Deploy to server
- name: Deploy to server
run: |
rm -rf /var/www/INSIGHTS/frontend/dist/*
cp -r ./dist/* /var/www/INSIGHTS/frontend/dist
sudo systemctl restart nginx
rm -rf /var/www/INSIGHTS/frontend/dist/*
cp -r ./dist/* /var/www/INSIGHTS/frontend/dist
sudo systemctl restart nginx
Loading

0 comments on commit 76fc579

Please sign in to comment.