Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using Travis and start using GitHub actions #158

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Building and Testing

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: 'ubuntu-latest'
strategy:
matrix:
python_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
django_version:
- '4.0'
- '4.1'
- '4.2'

services:
postgres:
# https://github.com/postgis/docker-postgis/blob/master/15-3.4/alpine/Dockerfile
image: postgis/postgis:15-3.4-alpine
env:
POSTGRES_DB: ddf
POSTGRES_USER: ddf_user
POSTGRES_PASSWORD: ddf_pass
ports:
# Random free port
- 5432/tcp
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: 'Install OS dependencies (Ubuntu)'
if: runner.os == 'Linux'
run: |
# https://docs.djangoproject.com/en/4.2/ref/contrib/gis/install/geolibs/
# GDAL_LIBRARY_PATH: /usr/lib/libgdal.so.*
# GEOS_LIBRARY_PATH: /usr/lib/libgeos_c.so.*
# ln -s /usr/lib/libgdal.so.32 /usr/lib/libgdal.so \
# ln -s /usr/lib/libgeos_c.so.1 /usr/lib/libgeos_c.so
# ln -s /usr/lib/libproj.so.25 /usr/lib/libproj.so \
sudo apt-get update \
&& sudo apt-get install -y binutils libproj-dev gdal-bin
- name: 'Set up Python ${{ matrix.python_version }}'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

- name: 'Checkout DDF code'
uses: actions/checkout@v3

- name: 'Install Python dependencies'
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install pytest-django
pip install django~=${{ matrix.django_version }}
pip install jsonfield==3.1.0
pip install django-polymorphic==3.1.0
- name: 'Testing with SQLite'
run: pytest --create-db --reuse-db --no-migrations --ds=settings_sqlite --maxfail=2

- name: 'Coverage with SQLite'
run: pytest --create-db --reuse-db --no-migrations -v --cov=django_dynamic_fixture

- name: 'Testing with Postgres'
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
POSTGRES_DB: ddf
POSTGRES_USER: ddf_user
POSTGRES_PASSWORD: ddf_pass
run: |
pip install psycopg2
pytest --create-db --reuse-db --no-migrations --ds=settings_postgres --maxfail=2
123 changes: 0 additions & 123 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,13 @@ tag:
reset_tag:
git tag -d ${VERSION}
git push origin :refs/tags/${VERSION}


# GitHub Action

act:
#brew install act
time act --container-architecture linux/amd64 --matrix python_version:3.11 --matrix django_version:4.2

actall:
time act --container-architecture linux/amd64
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Django Dynamic Fixture
======================

[![Build Status](https://travis-ci.org/paulocheque/django-dynamic-fixture.svg?branch=master)](https://travis-ci.org/paulocheque/django-dynamic-fixture)
[![Docs Status](https://readthedocs.org/projects/django-dynamic-fixture/badge/?version=latest)](http://django-dynamic-fixture.readthedocs.org/en/latest/index.html)
[![PyPI version](https://badge.fury.io/py/django-dynamic-fixture.svg)](https://badge.fury.io/py/django-dynamic-fixture)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-dynamic-fixture)
Expand Down
13 changes: 7 additions & 6 deletions settings_postgres.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from settings_ddf import *

DDF_TEST_GEODJANGO = True
Expand All @@ -10,13 +11,13 @@
# Postgis supports all Django features
# createdb ddf
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'ddf',
'USER': 'ddf_user', # please, change this if you want to run tests in your machine
'PASSWORD': 'ddf_pass',
'HOST': 'localhost',
'PORT': 5432,
'HOST': os.getenv('POSTGRES_HOST', 'localhost'),
'PORT': os.getenv('POSTGRES_PORT', 5432),
'NAME': os.getenv('POSTGRES_DB', 'ddf'),
'USER': os.getenv('POSTGRES_USER', 'ddf_user'), # please, change this if you want to run tests in your machine
'PASSWORD': os.getenv('POSTGRES_PASSWORD', 'ddf_pass'),
}
}

if DDF_TEST_GEODJANGO:
INSTALLED_APPS += ('django.contrib.gis',)
INSTALLED_APPS += ('django.contrib.gis',)