Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
chore: configures CI to work with a monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-zakharchenko committed Oct 7, 2019
1 parent 94dae5a commit bb97ff4
Show file tree
Hide file tree
Showing 42 changed files with 98 additions and 93 deletions.
56 changes: 24 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
version: 2.1

commands:
npm-install:
steps:
- run: echo $(node --version) > .node-version
- restore_cache:
key: js-deps-{{ checksum ".node-version" }}-{{ checksum "package.json" }}
- run: npm install --no-save
- save_cache:
key: js-deps-{{ checksum "package.json" }}
paths:
- ./node_modules

pip-install-docs:
steps:
- run: echo $(python --version) > .python-version
- restore_cache:
key: py-deps-{{ checksum ".python-version" }}-{{ checksum "docs/requirements.txt" }}
key: py-deps-{{ checksum ".python-version" }}-{{ checksum "./docs/requirements.txt" }}
- run: 'if [ ! -d ./venv ]; then python -m venv ./venv; fi'
- run: echo "source $(pwd)/venv/bin/activate" >> $BASH_ENV
- run: pip install -r ./docs/requirements.txt
- save_cache:
key: py-deps-{{ checksum "docs/requirements.txt" }}
key: py-deps-{{ checksum "./docs/requirements.txt" }}
paths:
- ./venv

aliases:
- &install
- run: sudo npm i -g yarn && yarn install --frozen-lockfile

- &node12
image: circleci/node:12

Expand All @@ -35,9 +27,9 @@ aliases:
- &test-steps
steps:
- checkout
- npm-install
- run: npm run build
- run: npm run ci:test
- <<: *install
- run: yarn build
- run: yarn ci:test

jobs:
test-node12:
Expand All @@ -56,60 +48,60 @@ jobs:
docker: [<<: *node12]
steps:
- checkout
- npm-install
- run: npm run build
- run: npm run e2e:apib
- <<: *install
- run: yarn build
- run: yarn e2e:apib

test-e2e-openapi2:
docker: [<<: *node12]
steps:
- checkout
- npm-install
- run: npm run build
- run: npm run e2e:openapi2
- <<: *install
- run: yarn build
- run: yarn e2e:openapi2

quality-checks:
docker: [<<: *python-docs]
steps:
- checkout
- npm-install
- <<: *install
- pip-install-docs
- run: npm run ci:lint
- run: yarn ci:lint

format-check:
docker: [<<: *node12]
steps:
- checkout
- npm-install
- run: npm run prettify:check
- <<: *install
- run: yarn prettify:check

docs-dry-run:
# 'dry run', because production build happens directly on the ReadTheDocs
# infrastructure
docker: [<<: *python-docs]
steps:
- checkout
- npm-install
- <<: *install
- pip-install-docs
- run: npm run ci:docs
- run: yarn ci:docs

smoke-tests:
docker:
- <<: *node12
- image: circleci/mongo:latest
steps:
- checkout
- npm-install
- run: npm run ci:smoke
- <<: *install
- run: yarn ci:smoke

release:
# the GH_TOKEN and NPM_TOKEN environment variables are expected to be set
# in https://circleci.com/gh/apiaryio/dredd/edit#env-vars
docker: [<<: *node12]
steps:
- checkout
- npm-install
- run: npm run ci:release
- <<: *install
- run: yarn ci:release

workflows:
version: 2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cov.*
*.log
.env*
__pycache__
/docs/_build

# Regardless the rules above, never ignore following
!.vscode/launch.json
File renamed without changes.
File renamed without changes.
12 changes: 7 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ environment:
install:
- ps: Install-Product node 12
- 'npm -g install npm@6'
- 'npm install -g yarn'
- "set PATH=%APPDATA%\\npm;%PATH%"
- 'npm install'
- 'yarn install'
cache:
- 'node_modules -> package.json'
- "%APPDATA%\\npm-cache -> package.json"
- 'node_modules -> yarn.lock'
- "%APPDATA%\\npm-cache -> yarn.lock"
build: off
test_script:
- 'node --version'
- 'npm --version'
- 'npm run build'
- 'npm test'
- 'yarn --version'
- 'yarn build'
- 'yarn test'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/dredd/docs/conf.py → docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@

linkcheck_ignore = [
'https://crates.io/crates/dredd-hooks', # https://github.com/sphinx-doc/sphinx/pull/5140
r'https?://github\.com/apiaryio/dredd/.+',
]

sphinx_tabs_valid_builders = ['linkcheck']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ Apiary Reporter Test Data (object)
Internal Apiary Data Structures
-------------------------------

These are private data structures used in Apiary internally and they are documented incompletely. They’re present in this document just to provide better insight on what and how Apiary internally saves. It is closely related to what you can see in documentation for `Apiary Tests API for authenticated test reports <https://github.com/apiaryio/dredd/blob/master/ApiaryReportingApi.apib>`__.
These are private data structures used in Apiary internally and they are documented incompletely. They’re present in this document just to provide better insight on what and how Apiary internally saves. It is closely related to what you can see in documentation for `Apiary Tests API for authenticated test reports <https://github.com/apiaryio/dredd/blob/master/packages/dredd/ApiaryReportingApi.apib>`__.

.. _apiary-test-run:

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions packages/dredd/docs/hooks/index.rst → docs/hooks/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ Let's have a description of a blog API, which allows to list all articles, and t

.. group-tab:: API Blueprint

.. literalinclude:: ../../test/fixtures/blog/apidesc.apib
.. literalinclude:: ../../packages/dredd/test/fixtures/blog/apidesc.apib
:language: apiblueprint

.. group-tab:: OpenAPI 2

.. literalinclude:: ../../test/fixtures/blog/apidesc.openapi2.yaml
.. literalinclude:: ../../packages/dredd/test/fixtures/blog/apidesc.openapi2.yaml
:language: openapi2

Now let's say the real instance of the API has the POST request protected so it is not possible for everyone to publish new articles. We do not want to hardcode secret tokens in our API description, but we want to get Dredd to pass the auth. This is where the hooks can help.
Expand All @@ -52,7 +52,7 @@ Dredd supports :ref:`writing hooks in multiple programming languages <supported-

Let's create a file called ``hooks.js`` with the following content:

.. literalinclude:: ../../test/fixtures/blog/hooks.apib.js
.. literalinclude:: ../../packages/dredd/test/fixtures/blog/hooks.apib.js
:language: javascript

As you can see, we're registering the hook function to be executed **before** the HTTP transaction ``Articles > Publish an article``. This path-like identifier is a :ref:`transaction name <transaction-names>`.
Expand All @@ -61,7 +61,7 @@ Dredd supports :ref:`writing hooks in multiple programming languages <supported-

Let's create a file called ``hooks.js`` with the following content:

.. literalinclude:: ../../test/fixtures/blog/hooks.openapi2.js
.. literalinclude:: ../../packages/dredd/test/fixtures/blog/hooks.openapi2.js
:language: javascript

As you can see, we're registering the hook function to be executed **before** the HTTP transaction ``Articles > Publish an article > 201 > application/json``. This path-like identifier is a :ref:`transaction name <transaction-names>`.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ If there is no body example or schema specified for the response in your API des

If you want to enforce the incoming body is empty, you can use :ref:`hooks <hooks>`:

.. literalinclude:: ../test/fixtures/response/empty-body-hooks.js
.. literalinclude:: ../packages/dredd/test/fixtures/response/empty-body-hooks.js
:language: javascript

In case of responses with 204 or 205 status codes Dredd still behaves the same way, but it warns about violating the :rfc:`7231` when the responses have non-empty bodies.
Expand Down
Loading

0 comments on commit bb97ff4

Please sign in to comment.