docs(circleci): Update CircleCI recipes config (#2018)
Updates the included CircleCI config file example. * Now uses 2.1 style config * Uses Node Orb * Use pre-defined node/test job * Uses Matrix jobs to test multiple node versions. * Updated Node versions * Using new CircleCI docker images (from node executor) * Updated language/terminology in description
This commit is contained in:
		
							parent
							
								
									143c8981bf
								
							
						
					
					
						commit
						413ffd2a4b
					
				| @ -10,46 +10,39 @@ Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with | |||||||
| 
 | 
 | ||||||
| ### `.circleci/config.yml` configuration for multiple Node jobs | ### `.circleci/config.yml` configuration for multiple Node jobs | ||||||
| 
 | 
 | ||||||
| This example is a minimal configuration for **semantic-release** with a build running Node 6 and 8. See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options. | This example is a minimal configuration for **semantic-release** with tests running against Node 16 and 14. See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options. | ||||||
| 
 | 
 | ||||||
| This example create the workflows `test_node_4`, `test_node_6`, `test_node_8` and `release`. The release workflows will [run `semantic-release` only after the all the `test_node_*` are successful](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded). | In this example, the [`circleci/node`](https://circleci.com/developer/orbs/orb/circleci/node) orb is imported (Which makes some node operations easier), then a `release` job is defined which will run `semantic-release`. | ||||||
|  | 
 | ||||||
|  | To run our `release` job, we have created a workflow named `test_and_release` which will run two jobs, `node/test`, which comes from the node orb and will test our application, and our release job. Here, we are actually making use of [matrix jobs](https://circleci.com/blog/circleci-matrix-jobs/) so that our single `node/test` job will actually be executed twice, once for Node version 16, and once for version 14. Finally, we call our release job with a `requires` parameter so that `release` will only run after `node/test` has successfully tested against v14 and v16. | ||||||
| 
 | 
 | ||||||
| ```yaml | ```yaml | ||||||
| version: 2 | version: 2.1 | ||||||
|  | orbs: | ||||||
|  |   node: circleci/node@4.5 | ||||||
| jobs: | jobs: | ||||||
|   test_node_6: |  | ||||||
|     docker: |  | ||||||
|       - image: circleci/node:6 |  | ||||||
|     steps: |  | ||||||
|       # Configure your test steps here (checkout, npm install, cache management, tests etc...) |  | ||||||
| 
 |  | ||||||
|   test_node_8: |  | ||||||
|     docker: |  | ||||||
|       - image: circleci/node:8 |  | ||||||
|     steps: |  | ||||||
|       # Configure your test steps here (checkout, npm install, cache management, tests etc...) |  | ||||||
| 
 |  | ||||||
|   release: |   release: | ||||||
|     docker: |     executor: node/default | ||||||
|       - image: circleci/node:8 |  | ||||||
|     steps: |     steps: | ||||||
|       - checkout |       - checkout | ||||||
|       - run: npm install |       - node/install-packages # Install and automatically cache packages | ||||||
|       # Run optional required steps before releasing |       # Run optional required steps before releasing | ||||||
|       # - run: npm run build-script |       # - run: npm run build-script | ||||||
|       - run: npx semantic-release |       - run: npx semantic-release | ||||||
| 
 | 
 | ||||||
| workflows: | workflows: | ||||||
|   version: 2 |  | ||||||
|   test_and_release: |   test_and_release: | ||||||
|     # Run the test jobs first, then the release only when all the test jobs are successful |     # Run the test jobs first, then the release only when all the test jobs are successful | ||||||
|     jobs: |     jobs: | ||||||
|       - test_node_6 |       - node/test: | ||||||
|       - test_node_8 |           matrix: | ||||||
|  |             parameters: | ||||||
|  |               version: | ||||||
|  |                 - 16.1.0 | ||||||
|  |                 - 14.7.0 | ||||||
|       - release: |       - release: | ||||||
|           requires: |           requires: | ||||||
|             - test_node_6 |             - node/test | ||||||
|             - test_node_8 |  | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ### `package.json` configuration for multiple Node jobs | ### `package.json` configuration for multiple Node jobs | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user