Skip to content

Commit

Permalink
move to github actions and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Apr 16, 2021
1 parent fee29c2 commit c3a86c9
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 110 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Tests

on: [push, pull_request]

jobs:
create:
name: ${{ matrix.variant }}
runs-on: ubuntu-20.04
env:
TEST_VARIANT: ${{ matrix.variant }}
strategy:
matrix:
variant: [spatialite, postgis, npm]
python-version: [3.9]
django-version: [3.2]
drf-version: [3.12.4]
steps:
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest wheel
python -m pip install django==${{ matrix.django-version }}
python -m pip install djangorestframework==${{ matrix.drf-version }}
python -m pip install xlsconv
python -m pip install git+https://github.com/wq/wq.build.git#egg=wq.build
python -m pip install git+https://github.com/wq/wq.app.git#egg=wq.app
python -m pip install git+https://github.com/wq/wq.db.git#egg=wq.db
python -m pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --exclude django_project,tests --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --exclude django_project,tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Set up SpatiaLite
if: ${{ matrix.variant != 'postgis' }}
run: |
sudo apt-get update
sudo apt-get install libsqlite3-mod-spatialite gdal-bin
- name: Set up PostgreSQL
if: ${{ matrix.variant == 'postgis' }}
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-13-postgis-3
# postgresql is already installed on image
sudo systemctl start postgresql.service
sudo -u postgres createuser --superuser $USER
createdb test_project
psql test_project -c "CREATE EXTENSION postgis;"
python -m pip install psycopg2-binary
- name: CLI Tests
run: |
cd tests
./test-deploy.sh
npm:
name: "@wq/${{ matrix.package }}"
runs-on: ubuntu-20.04
env:
PACKAGE: ${{ matrix.package }}
strategy:
matrix:
python-version: [3.9]
node-version: [14]
package:
- cra-template
- rollup-plugin
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
if: ${{ matrix.package != 'cra-template' }}
run: |
cd packages/$PACKAGE
npm ci
- name: Lint with ESLint
if: ${{ matrix.package != 'cra-template' }}
run: |
cd packages/$PACKAGE
npm run lint
- name: Test with Jest
if: ${{ matrix.package != 'cra-template' }}
run: |
cd packages/$PACKAGE
npm run test
- name: Publish to Github Packages
if: ${{ github.event_name == 'push' }}
run: |
./set_dev_version.sh
cd packages/$PACKAGE
echo "registry=https://npm.pkg.github.com/wq" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
npm publish
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

44 changes: 17 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![wq.create](https://raw.github.com/wq/wq/master/images/256/wq.create.png)](https://wq.io/wq.create)
[![wq.create][logo]][docs]

[wq.create](https://wq.io/wq.create) (formerly wq.start) provides a simple command-line interface (`wq create`) for starting a new project with the [wq framework], with [wq.app] for the front end and [wq.db] as the backend. wq.create also provides a `wq addform` command that can generate and configure new Django apps from an [XLSForm](http://xlsform.org) definition.
[**wq.create**][docs] (formerly wq.start) provides a simple command-line interface (`wq create`) for starting a new project with the [wq framework], with [wq.app] for the front end and [wq.db] as the backend. wq.create also provides a `wq addform` command that can generate and configure new Django apps from an [XLSForm] definition.

[![Latest PyPI Release](https://img.shields.io/pypi/v/wq.create.svg)](https://pypi.org/project/wq.create)
[![Release Notes](https://img.shields.io/github/release/wq/wq.create.svg)](https://github.com/wq/wq.create/releases)
Expand All @@ -9,37 +9,27 @@
[![GitHub Forks](https://img.shields.io/github/forks/wq/wq.create.svg)](https://github.com/wq/wq.create/network)
[![GitHub Issues](https://img.shields.io/github/issues/wq/wq.create.svg)](https://github.com/wq/wq.create/issues)

[![Travis Build Status](https://img.shields.io/travis/wq/wq.create/master.svg)](https://travis-ci.org/wq/wq.create)
[![Tests](https://github.com/wq/wq.create/actions/workflows/test.yml/badge.svg)](https://github.com/wq/wq.create/actions/workflows/test.yml)
[![Python Support](https://img.shields.io/pypi/pyversions/wq.create.svg)](https://pypi.org/project/wq.create)
[![Django Support](https://img.shields.io/pypi/djversions/wq.create.svg)](https://pypi.org/project/wq.create)

### Usage

```bash
# Recommended: create virtual environment
# python3 -m venv venv
# . venv/bin/activate
python3 -m pip install wq
### [Documentation][docs]

wq create <projectname> [directory]
cd <projectname>/db
wq addform ~/my-odk-form.xlsx
```
[**Getting Started**][setup]
&bull;
[`wq create`][create]
&bull;
[`wq addform`][addform]

See the [Getting Started] docs for more information.

### Commands

* `wq create <projectname> [directory]`: Create a new Django project from the [wq Django template] and (optionally) the [@wq Create React App template][@wq/cra-template]
* `wq addform ~/my-odk-form.xlsx`: Create a new Django app from the provided XLSForm (uses [xlsform-converter])
* `wq maketemplates`: Create templates for use with [@wq/jquery-mobile][@wq/jquery-mobile] (deprecated)
[logo]: https://wq.io/images/wq.create.svg
[docs]: https://wq.io/wq.create/

[setup]: https://wq.io/overview/setup
[create]: https://wq.io/wq.create/create
[addform]: https://wq.io/wq.create/addform

[wq framework]: https://wq.io/
[wq.app]: https://wq.io/wq.app
[wq.db]: https://wq.io/wq.db
[wq Django template]: https://github.com/wq/wq-django-template
[@wq/cra-template]: https://github.com/wq/wq.create/tree/master/packages/cra-template
[@wq/jquery-mobile]: https://github.com/wq/wq.app/tree/master/packages/jquery-mobile
[xlsform-converter]: https://github.com/wq/xlsform-converter
[Getting Started]: https://wq.io/docs/setup
[wq.app]: https://wq.io/wq.app/
[wq.db]: https://wq.io/wq.db/
[XLSForm]: https://xlsform.org/
6 changes: 3 additions & 3 deletions packages/cra-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "template.json",
"repository": {
"type": "git",
"url": "https://github.com/wq/wq.start.git",
"url": "https://github.com/wq/wq.create.git",
"directory": "packages/cra-template"
},
"keywords": [
Expand All @@ -19,9 +19,9 @@
"author": "S. Andrew Sheppard",
"license": "MIT",
"bugs": {
"url": "https://github.com/wq/wq.start/issues"
"url": "https://github.com/wq/wq.create/issues"
},
"homepage": "https://wq.io/wq.start",
"homepage": "https://wq.io/@wq/cra-template",
"files": [
"template",
"template.json"
Expand Down
6 changes: 3 additions & 3 deletions packages/rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/wq/wq.start.git",
"url": "git+https://github.com/wq/wq.create.git",
"directory": "packages/rollup-plugin"
},
"keywords": [
Expand All @@ -24,9 +24,9 @@
"author": "S. Andrew Sheppard",
"license": "MIT",
"bugs": {
"url": "https://github.com/wq/wq.start/issues"
"url": "https://github.com/wq/wq.create/issues"
},
"homepage": "https://wq.io/wq.start",
"homepage": "https://wq.io/@wq/rollup-plugin",
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.12.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import app from '@wq/app';
import material from '@wq/material';
import mapbox from '@wq/mapbox';
import mapgl from '@wq/map-gl';
import myPlugin from './plugin.js';

app.use([material, mapbox, myPlugin]);
app.use([material, mapgl, myPlugin]);
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { '@wq/app': app } = modules;
const { '@wq/material': material } = modules;
const materialPlugin = material.default;

const { '@wq/mapbox': mapbox } = modules;
const mapboxPlugin = mapbox.default;
const { '@wq/map-gl': mapgl } = modules;
const mapglPlugin = mapgl.default;

app.use([materialPlugin, mapboxPlugin, myPlugin]);
app.use([materialPlugin, mapglPlugin, myPlugin]);
6 changes: 0 additions & 6 deletions runtests.sh

This file was deleted.

9 changes: 9 additions & 0 deletions set_dev_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
VERSION=`python3 setup.py --version | \
sed s/\.dev/-dev/ | \
sed s/+/./ | \
sed "s/\.d[0-9]\{8\}$//" | \
sed "s/^\([0-9]\+\.[0-9]\+\.[0-9]\+\)\(.\+\)/\1-\2/" | \
sed "s/--/-/g"`
sed -i "s/\"version\": .*/\"version\": \"$VERSION\",/" packages/*/package.json
sed -i "s/\"@wq\/\(.\+\)\": \".\+\"/\"@wq\/\1\": \"\^$VERSION\"/" packages/*/package.json
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup

LONG_DESCRIPTION = """
Project scaffolding tools for creating a new crowdsourcing or citizen science application with the wq framework.
Project scaffolding tools for creating a new application with the wq framework.
"""


Expand Down Expand Up @@ -41,6 +41,7 @@ def list_package_data(root):
])
return paths


create_wq_namespace()

# Project template data
Expand Down
7 changes: 7 additions & 0 deletions tests/expected/config1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@
"name": "logout",
"url": "logout"
}
},
"router": {
"base_url": ""
},
"store": {
"service": "",
"defaults": {"format": "json"}
}
}
7 changes: 7 additions & 0 deletions tests/expected/config2.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,12 @@
"name": "logout",
"url": "logout"
}
},
"router": {
"base_url": ""
},
"store": {
"service": "",
"defaults": {"format": "json"}
}
}
9 changes: 8 additions & 1 deletion tests/expected/config3.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{
"hint": "The site where the observation was taken",
"name": "location",
"type": "string",
"type": "select one",
"wq:ForeignKey": "location",
"label": "Site"
},
Expand Down Expand Up @@ -123,5 +123,12 @@
"name": "logout",
"url": "logout"
}
},
"router": {
"base_url": ""
},
"store": {
"service": "",
"defaults": {"format": "json"}
}
}
Loading

0 comments on commit c3a86c9

Please sign in to comment.