add apache-2 license #2
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] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres | |
env: | |
POSTGRES_DB: dbname | |
POSTGRES_USER: login | |
POSTGRES_PASSWORD: password | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Install PostgreSQL Client | |
run: sudo apt-get install -y postgresql-client | |
- name: Test PostgreSQL Connection | |
run: psql "host=localhost user=login dbname=dbname password=password" | |
- uses: actions/checkout@v3 | |
with: | |
path: nopayloaddb | |
- name: Install Dependencies | |
run: | | |
cd nopayloaddb/ | |
pip install -r requirements.txt | |
- name: Change permissions of /var/log/ | |
run: sudo chmod a+w /var/log/ | |
#- name: Wait for PostgreSQL to become ready | |
# run: until pg_isready -h localhost -p 5432; do sleep 2; done | |
- name: Run Django | |
env: | |
POSTGRES_DB: dbname | |
POSTGRES_USER: login | |
POSTGRES_PASSWORD: password | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
run: | | |
cd nopayloaddb/ | |
python manage.py makemigrations cdb_rest && python manage.py migrate && python manage.py runserver 0.0.0.0:8000 & | |
- name: Access Django API | |
run: | | |
curl http://localhost:8000/api/cdb_rest/payloadiovs/?gtName=Test&majorIOV=0&minorIOV=0” |