forked from HHS/ckanext-datajson
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from GSA/feature/py3-py2-conditional
Feature/py3 py2 conditional
- Loading branch information
Showing
59 changed files
with
3,406 additions
and
2,644 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Tests | ||
on: [pull_request] | ||
env: | ||
CODE_COVERAGE_THRESHOLD_REQUIRED: 35 | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
- name: Install requirements | ||
run: pip install flake8 pycodestyle | ||
- name: Check syntax | ||
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude ckan,nose | ||
- name: Run flake8 | ||
run: flake8 . --count --show-source --statistics --exclude ckan,nose | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
ckan-version: [2.9, 2.8] | ||
fail-fast: false | ||
|
||
name: CKAN ${{ matrix.ckan-version }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: openknowledge/ckan-dev:${{ matrix.ckan-version }} | ||
services: | ||
solr: | ||
image: ckan/ckan-solr-dev:${{ matrix.ckan-version }} | ||
postgres: | ||
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }} | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
redis: | ||
image: redis:3 | ||
env: | ||
CKAN_SQLALCHEMY_URL: postgresql://ckan_default:pass@postgres/ckan_test | ||
CKAN_DATASTORE_WRITE_URL: postgresql://datastore_write:pass@postgres/datastore_test | ||
CKAN_DATASTORE_READ_URL: postgresql://datastore_read:pass@postgres/datastore_test | ||
CKAN_SOLR_URL: http://solr:8983/solr/ckan | ||
CKAN_REDIS_URL: redis://redis:6379/1 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install requirements | ||
run: | | ||
pip install -r requirements.txt -r dev-requirements.txt -e . | ||
- name: Setup extension (CKAN >= 2.9) | ||
if: ${{ matrix.ckan-version != '2.7' && matrix.ckan-version != '2.8' }} | ||
run: | | ||
ckan -c test.ini db init | ||
- name: Setup extension (CKAN < 2.9) | ||
if: ${{ matrix.ckan-version == '2.7' || matrix.ckan-version == '2.8' }} | ||
run: | | ||
paster --plugin=ckan db init -c test.ini | ||
- name: Run tests | ||
run: | | ||
set -o pipefail | ||
pytest --ckan-ini=test.ini --cov=ckanext.datajson --cov-fail-under=${CODE_COVERAGE_THRESHOLD_REQUIRED} --disable-warnings ckanext/datajson/tests | tee pytest-coverage.txt | ||
- name: Report test coverage | ||
if: ${{ always() }} | ||
uses: coroo/[email protected] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
**.pyc | ||
build | ||
.coverage | ||
ckanext_datajson.egg-info | ||
.DS_Store | ||
ckanext/datajson/export_map/*.map.json | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ARG CKAN_VERSION=2.8 | ||
FROM openknowledge/ckan-dev:${CKAN_VERSION} | ||
|
||
COPY . /app | ||
WORKDIR /app | ||
|
||
# python cryptography takes a while to build | ||
RUN pip install -r requirements.txt -r dev-requirements.txt -e . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
CKAN_VERSION ?= 2.8 | ||
COMPOSE_FILE ?= docker-compose.yml | ||
COMPOSE_LEGACY_FILE ?= docker-compose.legacy.yml | ||
|
||
build: ## Build the docker containers | ||
CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_FILE) build | ||
|
||
lint: ## Lint the code | ||
@# our linting only runs with python3 | ||
@# TODO use CKAN_VERSION make variable once 2.8 is deprecated | ||
CKAN_VERSION=2.9 docker-compose -f docker-compose.yml run --rm app flake8 . --count --show-source --statistics --exclude ckan,nose | ||
|
||
clean: ## Clean workspace and containers | ||
find . -name *.pyc -delete | ||
CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_FILE) down -v --remove-orphan | ||
|
||
test: ## Run tests in a new container | ||
CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_FILE) run --rm app ./test.sh | ||
|
||
test-legacy: ## Run legacy nose tests in an existing container | ||
@# TODO wait for CKAN to be up; use docker-compose run instead | ||
docker-compose -f docker-compose.legacy.yml exec ckan /bin/bash -c "nosetests --ckan --with-pylons=src/ckan/test-catalog-next.ini src_extensions/datajson/ckanext/datajson/tests/nose" | ||
|
||
up: ## Start the containers | ||
ifeq ($(CKAN_VERSION), 2.8) | ||
CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_LEGACY_FILE) up | ||
else | ||
CKAN_VERSION=$(CKAN_VERSION) docker-compose -f $(COMPOSE_FILE) up | ||
endif | ||
|
||
|
||
|
||
.DEFAULT_GOAL := help | ||
.PHONY: build clean help lint test test-legacy up | ||
|
||
# Output documentation for top-level targets | ||
# Thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
help: ## This help | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
Oops, something went wrong.