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

[WIP] Limit CI builds to 20 minutes #10

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5b86db1
FLUID-6524: Migrate to new organisation and update dependencies.
the-t-in-rtf Jul 15, 2020
250b9bf
FLUID-6524: Updated fluid-X dependencies to reflect actual available …
the-t-in-rtf Jul 17, 2020
03635eb
Merge remote-tracking branch 'upstream/master' into FLUID-6524
the-t-in-rtf Jul 21, 2020
2bbd736
FLUID-6524: Update to full release of fluid-mail-test.
the-t-in-rtf Jul 21, 2020
52f9fc6
Updated CI config to limit runs to firefox and bring in other config …
the-t-in-rtf Jul 21, 2020
07071d3
FLUID-6524: Updated to latest dev release of fluid-couchdb-test-harne…
the-t-in-rtf Jul 21, 2020
91f5bdb
FLUID-6524: Further updated dependencies.
the-t-in-rtf Jul 21, 2020
1cb42ac
FLUID-6524: Update to release versions of all remaining dependencies.
the-t-in-rtf Jul 23, 2020
7420f05
FLUID-6524: Updated dependencies.
the-t-in-rtf Jul 24, 2020
1e38f11
FLUID-6524: Remove option from CI runs.
the-t-in-rtf Jul 24, 2020
099352d
Added dev dependency on eslint-plugin-markdown.
the-t-in-rtf Jul 31, 2020
31a286a
Added note about running tests.
the-t-in-rtf Jul 31, 2020
92542b0
Limit CI builds to 20 minutes
gtirloni Aug 11, 2020
4dc8f9e
Merge remote-tracking branch 'tony/FLUID-6524' into test
gtirloni Aug 11, 2020
206cc0b
Split browser/node tests in CI
gtirloni Aug 11, 2020
cb0f10d
Debug CI env
gtirloni Aug 11, 2020
8de36b0
Debug CI env #2
gtirloni Aug 11, 2020
837d166
Debug CI env #3
gtirloni Aug 11, 2020
7655259
Debug CI env #4
gtirloni Aug 11, 2020
1e8175b
Debug CI env #5
gtirloni Aug 11, 2020
01d59fe
Debug CI env #6
gtirloni Aug 11, 2020
8e5461b
Debug CI env #7
gtirloni Aug 11, 2020
0694546
Debug CI env #8
gtirloni Aug 11, 2020
1138d9c
Debug CI env #9
gtirloni Aug 11, 2020
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
21 changes: 10 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,15 @@ jobs:
build:
runs-on: ubuntu-latest

services:
couchdb:
image: couchdb
ports:
- 25984:5984
env:
COUCHDB_USER: admin
COUCHDB_PASSWORD: admin
timeout-minutes: 20

strategy:
matrix:
node-version: [12.x]

env:
HEADLESS: true
FLUID_TEST_COUCH_USE_EXTERNAL: true
BROWSERS: chrome

steps:
- uses: actions/checkout@v2
Expand All @@ -39,7 +32,13 @@ jobs:
run: npm install

- name: Lint Code
run: $(npm bin)/grunt lint
run: npm run lint

- name: Node Tests
run: npm test
run: npm run test:node

- name: Stop all Docker containers
run: docker rm -f $(docker ps -q -a)

- name: Browser Tests
run: npm run test:webdriver
32 changes: 0 additions & 32 deletions .vagrant.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module.exports = function (grunt) {
}
});

grunt.loadNpmTasks("gpii-grunt-lint-all");
grunt.loadNpmTasks("fluid-grunt-lint-all");
grunt.registerTask("lint", "Perform all standard lint checks.", ["lint-all"]);
};
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gpii-express-user
# fluid-express-user

This package provides a series of server and client-side Fluid components to provide simple user management, including:

Expand All @@ -9,7 +9,7 @@ This package provides a series of server and client-side Fluid components to pro

## Server Side Components

The server side components are intended to be used with a `gpii.express` instance, and provide the REST API endpoints
The server side components are intended to be used with a `fluid.express` instance, and provide the REST API endpoints
documented in `src/docs/api.md`. Before you can use the server side components, you must set up your database with the
views included in `src/views` (see that directory for details).

Expand All @@ -20,17 +20,24 @@ between any two sites that use this package.

When writing your own server-side components that depend on the current user's information, the current user will
always be available as part of the `request.session` object. The user key may change depending on your configuration,
by default the user is found at `request.session._gpii_user`.
by default the user is found at `request.session._fluid_user`.

## Client Side Components

The client-side components provided here are intended to be used with the server-side API running on the same hostname
and port that hosts the client-side content. No CORS, proxy, or other mechanism is provided to handle remote lookups.

To use the client side components, set up your `gpii.express` instance with a static handler that will serve up the
contents of `src/js/client`, and a `gpii.express.hb` instance that can serve up the required template content. It is
To use the client side components, set up your `fluid.express` instance with a static handler that will serve up the
contents of `src/js/client`, and a `fluid.express.hb` instance that can serve up the required template content. It is
recommended that you copy the sample template content found in `src/templates` to your template directory and customize
based on your specific needs.

For an example of both the server-side configuration and of serving up client-side content, check out the configuration
of `tests/js/launch-test-harness.js` and `tests/js/test-harness.js`,

## Tests

To run the tests in this package, use the command `npm test`.

The tests in this package make use of [fluid-couchdb-test-harness](https://github.com/fluid-project/fluid-couchdb-test-harness),
see that package for supported environments and configuration options.
44 changes: 22 additions & 22 deletions docs/apiComponent.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `gpii.express.user.api`
# `fluid.express.user.api`

This is a `gpii.express.router` grade that mounts all parts of the user API under it. In terms of the default path
This is a `fluid.express.router` grade that mounts all parts of the user API under it. In terms of the default path
(`/user`), these endpoints include:

* [`/user/current`](currentComponent.md)
Expand All @@ -16,25 +16,25 @@ which are returned by default when `/user` is requested with no additional path

## Middleware required by this grade

This API requires access to `req.session`, which is provided by the `gpii.express.middleware.session` middleware.
That middleware requires `req.cookies`, which is provided by the `gpii.express.middleware.cookieparser` middleware.
This API requires access to `req.session`, which is provided by the `fluid.express.middleware.session` middleware.
That middleware requires `req.cookies`, which is provided by the `fluid.express.middleware.cookieparser` middleware.
Various endpoints accept `POST`/`PUT` data (`req.body`), so you must also have both the
`gpii.express.middleware.bodyparser.json` and `gpii.express.middleware.bodyparser.urlencoded` middleware. For details
on each of these pieces of middleware, see [the middleware documentation in `gpii.express`](https://github.com/GPII/gpii-express/blob/master/docs/middleware.md).
`fluid.express.middleware.bodyparser.json` and `fluid.express.middleware.bodyparser.urlencoded` middleware. For details
on each of these pieces of middleware, see [the middleware documentation in `fluid.express`](https://github.com/fluid-project/fluid-express/blob/master/docs/middleware.md).

The required middleware should be loaded at the same level (or higher) in the path, and before the API itself. The
order in which middleware loads is controlled using [namespaces and priorities](http://docs.fluidproject.org/infusion/development/Priorities.html).

If you want this to be taken care of automatically, mix the `gpii.express.user.api.withRequiredMiddleware` grade
into your `gpii.express` instance, as in the following example:
If you want this to be taken care of automatically, mix the `fluid.express.user.api.withRequiredMiddleware` grade
into your `fluid.express` instance, as in the following example:

```javascript
gpii.express({
gradeNames: ["gpii.express.user.api.withRequiredMiddleware"],
fluid.express({
gradeNames: ["fluid.express.user.api.withRequiredMiddleware"],
port: "8080",
components: {
api: {
type: "gpii.express.user.api",
type: "fluid.express.user.api",
options: {
priority: "after:session"
}
Expand All @@ -44,21 +44,21 @@ gpii.express({
```

This would result in the API being available on `http://localhost:8080/user`. The same mix-in grade can be used with
a `gpii.express.router` instance, as in the following example:
a `fluid.express.router` instance, as in the following example:

```javascript
gpii.express({
gradeNames: ["gpii.express.user.api.withRequiredMiddleware"],
fluid.express({
gradeNames: ["fluid.express.user.api.withRequiredMiddleware"],
port: "8080",
components: {
v1: {
type: "gpii.express.router.passthrough",
type: "fluid.express.router.passthrough",
options: {
path: "/v1.0.0",
gradeNames: ["gpii.express.user.api.withRequiredMiddleware"],
gradeNames: ["fluid.express.user.api.withRequiredMiddleware"],
components: {
api: {
type: "gpii.express.user.api",
type: "fluid.express.user.api",
options: {
priority: "after:session"
}
Expand All @@ -76,7 +76,7 @@ outside of that path.

## Component options

In addition to the options for any instance of [`gpii.express.router`](https://github.com/GPII/gpii-express/blob/master/docs/router.md),
In addition to the options for any instance of [`fluid.express.router`](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md),
this component supports the following unique options:

| Option | Type | Description |
Expand All @@ -87,13 +87,13 @@ this component supports the following unique options:
| `couch.port` | `{String}` | The port on which our CouchDB instance runs. |
| `couch.userDbName` | `{String}` | The CouchDB database name containing our user records. Defaults to `users`. |
| `couch.userDbUrl` | `{String}` | The URL of our CouchDB instance. By default this is expanded from `userDbName` above using the pattern `http://localhost:%port/%userDbName` (see above). |
| `schemaDirs` | `{Array}` | An array of schema directories that contain our [JSON Schemas](http://json-schema.org/). Supports package-relative paths like '%gpii-express-user/src/templates'. |
| `templateDirs` | `{Array}` | An array of template directories that contain our Handlebars templates. Supports package-relative paths like "%gpii-express-user/src/templates". |
| `schemaDirs` | `{Array}` | An array of schema directories that contain our [JSON Schemas](http://json-schema.org/). Supports package-relative paths like '%fluid-express-user/src/templates'. |
| `templateDirs` | `{Array}` | An array of template directories that contain our Handlebars templates. Supports package-relative paths like "%fluid-express-user/src/templates". |

When resolving schemas and templates from `schemaDirs` and `templateDirs`, the first directory containing matching
content is used.

## Component Invokers

This component has no unique invokers. For details on the `route` invoker it inherits from `gpii.express.router.passthrough`,
see the [`gpii.express` router documentation](https://github.com/GPII/gpii-express/blob/master/docs/router.md).
This component has no unique invokers. For details on the `route` invoker it inherits from `fluid.express.router.passthrough`,
see the [`fluid.express` router documentation](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md).
19 changes: 10 additions & 9 deletions docs/currentComponent.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# `gpii.express.user.api.current`
# `fluid.express.user.api.current`

This component provides a REST endpoint that displays information about the current user (and indicates whether they are
logged in). It is an instance of [`gpii.express.requestAware.router`]((https://github.com/GPII/gpii-express/blob/master/docs/requestAwareRouter.md))
with its own `handler` (see `gpii.express.user.api.current.handler` below).
logged in). It is an instance of [`fluid.express.requestAware.router`]((https://github.com/fluid-project/fluid-express/blob/master/docs/requestAwareRouter.md))
with its own `handler` (see `fluid.express.user.api.current.handler` below).

For details about making REST calls against the API endpoint provided by this component, see the [API docs](apidocs.md).

## Component options

This component supports only the common options available to any
[`gpii.express.router`](https://github.com/GPII/gpii-express/blob/master/docs/router.md) or
[`gpii.express.requestAware.router`](https://github.com/GPII/gpii-express/blob/master/docs/requestAwareRouter.md) instance.
[`fluid.express.router`](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md) or
[`fluid.express.requestAware.router`](https://github.com/fluid-project/fluid-express/blob/master/docs/requestAwareRouter.md)
instance.

## `gpii.express.user.api.current.handler`
## `fluid.express.user.api.current.handler`

This component is an instance of [`gpii.express.handler`]((https://github.com/GPII/gpii-express/blob/master/docs/handler.md)),
This component is an instance of [`fluid.express.handler`]((https://github.com/fluid-project/fluid-express/blob/master/docs/handler.md)),
meant for use with the above `requestAwareRouter`.

### Component options

In addition to the options for any instance of [`gpii.express.router`](https://github.com/GPII/gpii-express/blob/master/docs/router.md),
In addition to the options for any instance of [`fluid.express.router`](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md),
this component supports the following unique options:

| Option | Type | Description |
Expand All @@ -32,5 +33,5 @@ this component supports the following unique options:

* Returns: Nothing.

Fulfills the standard contract for an instance of [`gpii.express.handler`]((https://github.com/GPII/gpii-express/blob/master/docs/handler.md)).
Fulfills the standard contract for an instance of [`fluid.express.handler`]((https://github.com/fluid-project/fluid-express/blob/master/docs/handler.md)).
It sends either information about the current user, or a message indicating that the user is not already logged in.
38 changes: 19 additions & 19 deletions docs/forgotComponent.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# `gpii.express.user.api.forgot`
# `fluid.express.user.api.forgot`

This component provides a REST endpoint that can be used to request a password reset code. The reset code is sent to
the user in an email message, which they can use to continue the process using [`/user/reset`](resetComponent.md).

This component is an instance of
[`gpii.express.router.passthrough`](https://github.com/GPII/gpii-express/blob/master/docs/router.md) which wraps two
routers. One is an instance of `gpii.express.singleTemplateRouter` that renders a "forgot password" form using the
templates defined in this package when this endpoint receives a `GET` request. The other
(`gpii.express.user.api.forgot.post`, see below) handles `POST` requests, such as AJAX requests sent using the above
[`fluid.express.router.passthrough`](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md) which
wraps two routers. One is an instance of `fluid.express.singleTemplateRouter` that renders a "forgot password" form
using the templates defined in this package when this endpoint receives a `GET` request. The other
(`fluid.express.user.api.forgot.post`, see below) handles `POST` requests, such as AJAX requests sent using the above
form.

For details about making REST calls against the API endpoint provided by this component, see the [API docs](apidocs.md).

## Component options

In addition to the options for any instance of
[`gpii.express.router`](https://github.com/GPII/gpii-express/blob/master/docs/router.md), this component supports the
following unique options:
[`fluid.express.router`](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md), this component
supports the following unique options:

| Option | Type | Description |
| --------------------- | ---------- | ----------- |
| `codeIssuedKey` | `{String}` | The field key to use to indicate whether a user has had a reset code issued already. Should match what is used in [`gpii.express.user.api.reset`](resetComponent.md). |
| `couch` | `{Object}` | The CouchDB options used to read and write data from Couch. Generally distributed to this grade by the `gpii.express.user.api` component. |
| `codeIssuedKey` | `{String}` | The field key to use to indicate whether a user has had a reset code issued already. Should match what is used in [`fluid.express.user.api.reset`](resetComponent.md). |
| `couch` | `{Object}` | The CouchDB options used to read and write data from Couch. Generally distributed to this grade by the `fluid.express.user.api` component. |
| `defaultContext` | `{Object}` | The context (data) available to the renderer used to deliver the "forgot password" form. |
| `resetCodeLength` | `{Number}` | The length of the reset code we will generate and send to the user via email. |
| `resetCodeKey` | `{String}` | The field key to use when storing the generated code in the user's CouchDB record. Should match what is used in [`gpii.express.user.api.reset`](resetComponent.md). |
| `templates.form` | `{String}` | The location of the template to be used for the "forgot password" for, relative to the `templateDirs` option of our `gpii.handlebars` instance. |
| `templates.mail.html` | `{String}` | The location of the email template to be used for the HTML version of the "forgot password" email. This is defined relative to the `templateDirs` option of our `gpii.handlebars` instance. |
| `templates.mail.text` | `{String}` | The location of the email template to be used for the text version of the "forgot password" email. This is defined relative to the `templateDirs` option of our `gpii.handlebars` instance. |
| `resetCodeKey` | `{String}` | The field key to use when storing the generated code in the user's CouchDB record. Should match what is used in [`fluid.express.user.api.reset`](resetComponent.md). |
| `templates.form` | `{String}` | The location of the template to be used for the "forgot password" for, relative to the `templateDirs` option of our `fluid.handlebars` instance. |
| `templates.mail.html` | `{String}` | The location of the email template to be used for the HTML version of the "forgot password" email. This is defined relative to the `templateDirs` option of our `fluid.handlebars` instance. |
| `templates.mail.text` | `{String}` | The location of the email template to be used for the text version of the "forgot password" email. This is defined relative to the `templateDirs` option of our `fluid.handlebars` instance. |
| `urls.read` | `{String}` | The URL to use when reading user information from CouchDB. Derived from `options.couch.userDbUrl` (see above) by default. |
| `urls.write` | `{String}` | The URL to use when writing user information to CouchDB. Derived from `options.couch.userDbUrl` (see above) by default. |

## Component Invokers

This component has no unique invokers. For details on the `route` invoker it inherits from
`gpii.express.router.passthrough`, see the [`gpii.express` router documentation](https://github.com/GPII/gpii-express/blob/master/docs/router.md).
`fluid.express.router.passthrough`, see the [`fluid.express` router documentation](https://github.com/fluid-project/fluid-express/blob/master/docs/router.md).

## `gpii.express.user.api.forgot.post`
## `fluid.express.user.api.forgot.post`

This component is an instance of
[`gpii.express.requestAware.router`]((https://github.com/GPII/gpii-express/blob/master/docs/requestAwareRouter.md)) with
its own `handler` (see `gpii.express.user.api.forgot.post.handler` below). It has no unique invokers or component
[`fluid.express.requestAware.router`]((https://github.com/fluid-project/fluid-express/blob/master/docs/requestAwareRouter.md))
with its own `handler` (see `fluid.express.user.api.forgot.post.handler` below). It has no unique invokers or component
options.

## `gpii.express.user.api.forgot.post.handler`
## `fluid.express.user.api.forgot.post.handler`

The handler that actually fields individual requests.

### Component options

The handler instance used here receives a subset of the options sent to `gpii.express.user.api.post` (see above). In
The handler instance used here receives a subset of the options sent to `fluid.express.user.api.post` (see above). In
addition, it has the following unique options:

| Option | Type | Description |
Expand Down
Loading