diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7d2b08296..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,112 +0,0 @@ -version: 2.1 - -commands: - pip-install-docs: - steps: - - run: echo $(python --version) > .python-version - - restore_cache: - 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" }} - paths: - - ./venv - -aliases: - - &install - - run: yarn install --frozen-lockfile - - - &node12 - image: circleci/node:12 - - - &python-docs # using Python 3.6 as that's the version ReadTheDocs is running - image: circleci/python:3.6-node - - - &test-steps - steps: - - checkout - - <<: *install - - run: yarn build - - run: yarn test - -jobs: - test-node14: - docker: [image: circleci/node:14] - <<: *test-steps - - test-node12: - docker: [<<: *node12] - <<: *test-steps - - test-node10: - docker: [image: circleci/node:10] - <<: *test-steps - - test-e2e-apib: - docker: [<<: *node12] - steps: - - checkout - - <<: *install - - run: yarn build - - run: npx lerna exec --scope="dredd" yarn e2e:apib - - test-e2e-openapi2: - docker: [<<: *node12] - steps: - - checkout - - <<: *install - - run: yarn build - - run: npx lerna exec --scope="dredd" yarn e2e:openapi2 - - quality-checks: - docker: [<<: *python-docs] - steps: - - checkout - - <<: *install - - pip-install-docs - - run: yarn lint - - run: yarn commit:lint - - run: yarn docs:lint - - run: yarn docs:test-extensions - - format-check: - docker: [<<: *node12] - steps: - - checkout - - <<: *install - - run: yarn prettify:check - - docs-dry-run: - # 'dry run', because production build happens directly on the ReadTheDocs - # infrastructure - docker: [<<: *python-docs] - steps: - - checkout - - <<: *install - - pip-install-docs - - run: yarn docs:build - - smoke-tests: - docker: - - <<: *node12 - - image: circleci/mongo:latest - steps: - - checkout - - <<: *install - - run: yarn test:smoke - -workflows: - version: 2 - test: - jobs: - - format-check - - quality-checks - - test-node14 - - test-node12 - - test-node10 - - test-e2e-apib - - test-e2e-openapi2 - - smoke-tests - - docs-dry-run diff --git a/.github/workflows/run-docs-test.yml b/.github/workflows/run-docs-tests.yml similarity index 93% rename from .github/workflows/run-docs-test.yml rename to .github/workflows/run-docs-tests.yml index 532816b77..6509ad800 100644 --- a/.github/workflows/run-docs-test.yml +++ b/.github/workflows/run-docs-tests.yml @@ -1,7 +1,7 @@ -name: run-docs-test +name: run-docs-tests -on: push +on: [push, pull_request] # here add directory listing on push to test # paths: # - /docs/*.rst @@ -30,7 +30,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-13] node-version: [12.x] steps: @@ -59,7 +59,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-13] node-version: [12.x] steps: diff --git a/.github/workflows/run-e2e-tests.yml b/.github/workflows/run-e2e-tests.yml index 65d36044b..b31c69afd 100644 --- a/.github/workflows/run-e2e-tests.yml +++ b/.github/workflows/run-e2e-tests.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-13] node-version: [12.x] steps: @@ -32,7 +32,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-13] node-version: [12.x] steps: diff --git a/.github/workflows/run-lints.yml b/.github/workflows/run-lints.yml new file mode 100644 index 000000000..ffcce43b4 --- /dev/null +++ b/.github/workflows/run-lints.yml @@ -0,0 +1,23 @@ +name: run-lints + +on: [push, pull_request] + +jobs: + lint: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [12.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: yarn install --frozen-lockfile + - run: yarn lint + - run: yarn prettify:check diff --git a/.github/workflows/run-smoke-tests.yml b/.github/workflows/run-smoke-tests.yml new file mode 100644 index 000000000..b19d2e7bb --- /dev/null +++ b/.github/workflows/run-smoke-tests.yml @@ -0,0 +1,27 @@ +name: run-smoke-tests + +on: [push, pull_request] + +jobs: + test-smoke: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [12.x] + + services: + mongo: + image: mongo:4.4 + ports: ["27017:27017"] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: yarn install --frozen-lockfile + - run: yarn test:smoke diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index f841cdcd1..18718be44 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -1,12 +1,8 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +name: run-tests -name: run-test - -on: push +on: [push, pull_request] jobs: - # general test run test: runs-on: ${{ matrix.os }} @@ -24,5 +20,4 @@ jobs: node-version: ${{ matrix.node-version }} - run: yarn install --frozen-lockfile - run: yarn build - - run: yarn lint - run: yarn test diff --git a/README.md b/README.md index ea4790fbe..906ea5916 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # Dredd — HTTP API Testing Framework [![npm version](https://badge.fury.io/js/dredd.svg)](https://www.npmjs.com/package/dredd) -[![Build Status](https://circleci.com/gh/apiaryio/dredd/tree/master.svg?style=svg)](https://circleci.com/gh/apiaryio/dredd/tree/master) +[![Tests](https://github.com/apiaryio/dredd/actions/workflows/run-tests.yml/badge.svg)](https://github.com/apiaryio/dredd/actions/workflows/run-tests.yml) +[![E2E Tests](https://github.com/apiaryio/dredd/actions/workflows/run-e2e-tests.yml/badge.svg)](https://github.com/apiaryio/dredd/actions/workflows/run-e2e-tests.yml) +[![Smoke Tests](https://github.com/apiaryio/dredd/actions/workflows/run-smoke-tests.yml/badge.svg)](https://github.com/apiaryio/dredd/actions/workflows/run-smoke-tests.yml) [![Build Status](https://ci.appveyor.com/api/projects/status/n3ixfxh72qushyr4/branch/master?svg=true)](https://ci.appveyor.com/project/Apiary/dredd/branch/master) [![Documentation Status](https://readthedocs.org/projects/dredd/badge/?version=latest)](https://readthedocs.org/projects/dredd/builds/) [![Known Vulnerabilities](https://snyk.io/test/npm/dredd/badge.svg)](https://snyk.io/test/npm/dredd) @@ -92,8 +94,8 @@ $ npm install -g dredd [api blueprint]: https://apiblueprint.org/ [api blueprint tutorial]: https://apiblueprint.org/documentation/tutorial.html [api blueprint examples]: https://github.com/apiaryio/api-blueprint/tree/master/examples -[openapi 2]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md -[openapi 3]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md +[openapi 2]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md +[openapi 3]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md [documentation]: https://dredd.org/en/latest/ [changelog]: https://github.com/apiaryio/dredd/releases [contributor's guidelines]: https://dredd.org/en/latest/contributing/ diff --git a/docs/_extensions/ghlink_check.py b/docs/_extensions/ghlink_check.py index 3d9dae6bd..0b28e8cd5 100644 --- a/docs/_extensions/ghlink_check.py +++ b/docs/_extensions/ghlink_check.py @@ -39,7 +39,7 @@ def test_external(self): self.assertTrue(check_uri('https://apiblueprint.org')) def test_github(self): - self.assertTrue(check_uri('https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md')) + self.assertTrue(check_uri('https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md')) def test_relevant_github_repo_but_irrelevant_path(self): self.assertTrue(check_uri('https://github.com/apiaryio/dredd/issues/820')) diff --git a/docs/_extensions/specs.py b/docs/_extensions/specs.py index e269d7110..ff8cb1603 100644 --- a/docs/_extensions/specs.py +++ b/docs/_extensions/specs.py @@ -15,8 +15,8 @@ SPECS = { 'apib': ('API Blueprint', 'https://apiblueprint.org/documentation/specification.html#{anchor}'), 'mson': ('MSON', 'https://apiblueprint.org/documentation/mson/specification.html#{anchor}'), - 'openapi2': ('OpenAPI 2', 'https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#user-content-{anchor}'), - 'openapi3': ('OpenAPI 3', 'https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#user-content-{anchor}'), + 'openapi2': ('OpenAPI 2', 'https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md'), # TODO: re-add #{anchor}, fix yarn docs:lint + 'openapi3': ('OpenAPI 3', 'https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#{anchor}'), } diff --git a/docs/_links.rst b/docs/_links.rst index 65902d83e..27f3c27c2 100644 --- a/docs/_links.rst +++ b/docs/_links.rst @@ -12,8 +12,8 @@ .. OpenAPI specification -.. _OpenAPI 2: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md -.. _OpenAPI 3: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md +.. _OpenAPI 2: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md +.. _OpenAPI 3: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md .. JSON Schema diff --git a/docs/hooks/perl.rst b/docs/hooks/perl.rst index e8ad58df5..eaa640230 100644 --- a/docs/hooks/perl.rst +++ b/docs/hooks/perl.rst @@ -3,8 +3,6 @@ Writing Dredd Hooks In Perl =========================== -|Build Status| - `GitHub repository `__ Perl hooks are using :ref:`Dredd’s hooks handler socket interface `. For using Perl hooks in Dredd you have to have :ref:`Dredd already installed ` @@ -232,6 +230,3 @@ Remove trailing newline character in expected *plain text* bodies $transaction->{expected}{body} = chomp($transaction->{expected}{body}); } }); - -.. |Build Status| image:: https://api.travis-ci.org/ungrim97/Dredd-Hooks.svg?branch=master - :target: https://api.travis-ci.org/ungrim97/Dredd-Hooks.svg?branch=master diff --git a/docs/how-it-works.rst b/docs/how-it-works.rst index 001206669..414533e30 100644 --- a/docs/how-it-works.rst +++ b/docs/how-it-works.rst @@ -150,7 +150,7 @@ If Dredd isn’t able to infer any value for a required parameter, it will termi Request Headers ~~~~~~~~~~~~~~~ -In `OpenAPI 2`_ documents, HTTP headers are inferred from ``"in": "header"`` parameters (:openapi2:`parameterobject`). HTTP headers significant for content negotiation are inferred according to following rules: +In `OpenAPI 2`_ documents, HTTP headers are inferred from ``"in": "header"`` parameters (:openapi2:`parameter-object`). HTTP headers significant for content negotiation are inferred according to following rules: - ``consumes`` (:openapi2:`swaggerconsumes`) is propagated as request’s ``Content-Type`` header. - ``produces`` (:openapi2:`swaggerproduces`) is propagated as request’s ``Accept`` header. @@ -173,7 +173,7 @@ This order :apib:`exactly follows the API Blueprint specification `__ generates sample values from the JSON Schema provided in the ``schema`` (:openapi2:`parameterschema`) property. Following rules apply when the adapter fills values of the properties, ordered by precedence: @@ -255,6 +255,6 @@ You can tell Dredd to use HTTP(S) proxy for: - downloading API description documents (the positional argument :option:`api-description-document` or the :option:`--path` option accepts also URL) - :ref:`reporting to Apiary ` -Dredd respects ``HTTP_PROXY``, ``HTTPS_PROXY``, ``NO_PROXY``, ``http_proxy``, ``https_proxy``, and ``no_proxy`` environment variables. For more information on how those work see `relevant section `__ of the underlying library’s documentation. +Dredd respects ``HTTP_PROXY``, ``HTTPS_PROXY``, ``NO_PROXY``, ``http_proxy``, ``https_proxy``, and ``no_proxy`` environment variables. For more information on how those work see `relevant section `__ of the underlying library’s documentation. Dredd intentionally **does not support HTTP(S) proxies for testing**. Proxy can deliberately modify requests and responses or to behave in a very different way then the server under test. Testing over a proxy is, in the first place, testing of the proxy itself. That makes the test results irrelevant (and hard to debug). diff --git a/docs/how-to-guides.rst b/docs/how-to-guides.rst index d37d0efb1..9e3c06961 100644 --- a/docs/how-to-guides.rst +++ b/docs/how-to-guides.rst @@ -424,7 +424,7 @@ If you describe a JSON body which has attributes ``name`` and ``size``, the foll It’s because properties are optional by default in both `MSON`_ and `JSON Schema`_ and you need to explicitly specify them as required. - In API Blueprint’s :apib:`Attributes ` section, you can use ``required`` (:mson:`353-type-attribute`). -- In API Blueprint’s :apib:`Schema ` sections and in OpenAPI 2 you can use ``required`` (`spec `__), where you list the required properties. (Note this is true only for the `Draft v4 `__ JSON Schema, in older versions the ``required`` functionality was done differently.) +- In API Blueprint’s :apib:`Schema ` sections and in OpenAPI 2 you can use ``required`` (`spec `__), where you list the required properties. (Note this is true only for the `Draft v4 `__ JSON Schema, in older versions the ``required`` functionality was done differently.) Validating Structure of Array Items ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -452,7 +452,7 @@ If you describe a JSON body which has attributes ``name`` and ``size``, the foll If the size should be always equal to 300, you need to specify the fact in your API description. - In API Blueprint’s :apib:`Attributes ` sections you can mark your property with ``fixed`` (:mson:`353-type-attribute`), which turns the sample value into a required value. You can also use ``enum`` (:mson:`212-structure-types`) to provide a set of possible values. -- In API Blueprint’s :apib:`Schema ` sections and in OpenAPI 2 you can use ``enum`` (`spec `__) with one or more possible values. +- In API Blueprint’s :apib:`Schema ` sections and in OpenAPI 2 you can use ``enum`` (`spec `__) with one or more possible values. Integrating Dredd with Your Test Suite -------------------------------------- @@ -732,7 +732,7 @@ Example Values for Request Parameters While example values are natural part of the API Blueprint format, the OpenAPI 2 specification allows them only for ``body`` request parameters (``schema.example``). -However, Dredd needs to know what values to use when testing described API, so it supports ``x-example`` :openapi2:`vendor extension property ` to overcome the OpenAPI 2 limitation: +However, Dredd needs to know what values to use when testing described API, so it supports ``x-example`` :openapi2:`vendor extension property ` to overcome the OpenAPI 2 limitation: .. code-block:: openapi2 diff --git a/docs/internals.rst b/docs/internals.rst index dffcc217c..35eebe1ff 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -67,7 +67,7 @@ To hack Dredd locally, clone the repository and run ``npm install`` to install J Commit message format ~~~~~~~~~~~~~~~~~~~~~ -`Semantic Release `__ automatically manages releasing of new Dredd versions to the `npm `_ registry. It makes sure correct version numbers get increased according to the **meaning** of your changes once they are added to the ``master`` branch. This requires all commit messages to be in a specific format, called `Conventional Changelog `__: +`Semantic Release `__ automatically manages releasing of new Dredd versions to the `npm `_ registry. It makes sure correct version numbers get increased according to the **meaning** of your changes once they are added to the ``master`` branch. This requires all commit messages to be in a specific format, called `Conventional Changelog `__: .. code-block:: text @@ -304,10 +304,10 @@ MSON spec Simplifies linking the `MSON`_ spec. Usage: ``:mson:`353-type-attribute``` OpenAPI 2 spec - Simplifies linking the `OpenAPI 2`_ spec. Usage: ``:openapi2:`parameterobject``` + Simplifies linking the `OpenAPI 2`_ spec. Usage: ``:openapi2:`parameter-object``` OpenAPI 3 spec - Simplifies linking the `OpenAPI 3`_ spec. Usage: ``:openapi3:`parameterobject``` + Simplifies linking the `OpenAPI 3`_ spec. Usage: ``:openapi3:`parameter-object``` RFCs Simplifies linking the RFCs. Not a custom extension in fact, this is provided by Sphinx out of the box. Usage: ``:rfc:`1855``` diff --git a/docs/requirements.txt b/docs/requirements.txt index e553192e0..0e17eb4a0 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -10,6 +10,11 @@ pygments-apiblueprint==0.2.0 sphinx-tabs==3.2.0 sphinx-panels==0.6.0 myst-parser==0.15.2 +sphinxcontrib-applehelp==1.0.4 +sphinxcontrib.devhelp==1.0.2 +sphinxcontrib.htmlhelp==2.0.1 +sphinxcontrib.serializinghtml==1.1.5 +sphinxcontrib.qthelp==1.0.3 # dev dependencies sphinx-autobuild==2021.3.14 diff --git a/package.json b/package.json index 17bd234ae..216c187b3 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "devDependencies": { "@commitlint/cli": "11.0.0", "@commitlint/config-conventional": "11.0.0", - "commitlint-circle": "1.0.0", "lerna": "^3.22.1" }, "workspaces": { diff --git a/packages/dredd/lib/getProxySettings.js b/packages/dredd/lib/getProxySettings.js index 40fa58f9a..c2e7cd4ef 100644 --- a/packages/dredd/lib/getProxySettings.js +++ b/packages/dredd/lib/getProxySettings.js @@ -11,7 +11,7 @@ const PROXY_ENV_VARIABLES = ['HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']; * * Note: The settings are later only printed to the user. Applying the settings * is handled directly by the 'request' library, see - * https://github.com/request/request#user-content-proxies + * https://github.com/request/request#proxies */ export default function getProxySettings(env) { return Object.entries(env)