Skip to content

Only use localhost

Only use localhost #58

Workflow file for this run

name: Build and Deploy
on: [push, pull_request]
jobs:
vm-job:
name: build
runs-on: ubuntu-24.04
strategy:
matrix:
# Keep general for future DB transitions
db: [ mysql ]
# Keep general for future python version compatibility
python-version: ['3.11', '3.12']
include:
- db: mysql
host: 172.18.0.1
env:
MYSQL_DATABASE: marketplace
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_GEN_USER: mysql
MYSQL_GEN_PASSWORD: test
steps:
# MySQL is installed natively on Ubuntu 20.04 - no need to add as a service, simply start it
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }}
mysql -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} -e "CREATE USER '${{ env.MYSQL_GEN_USER }}'@'localhost' IDENTIFIED BY '${{ env.MYSQL_GEN_PASSWORD }}';"
mysql -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} -e "GRANT ALL PRIVILEGES ON *.* TO '${{ env.MYSQL_GEN_USER }}'@'localhost';"
- uses: actions/checkout@v4
- name: install prerequisites
run: sudo apt-get install -y python3-dev python3-setuptools libpq-dev apache2-dev mysql-client
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Migration and Tests
run: |
cp sasmarket/settings.py.example sasmarket/settings.py
python manage.py migrate
python manage.py test
# deploy:
# name: deploy
# needs: build
# runs-on: ubuntu-20.04