Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deryeger/yarn-setup-action
GitHub Action for setting up a Yarn environment. Caches dependencies for reduced execution times.
https://github.com/deryeger/yarn-setup-action
actions ci github-actions nodejs yarn
Last synced: 3 months ago
JSON representation
GitHub Action for setting up a Yarn environment. Caches dependencies for reduced execution times.
- Host: GitHub
- URL: https://github.com/deryeger/yarn-setup-action
- Owner: DerYeger
- License: mit
- Created: 2021-08-26T12:09:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-03-24T07:02:27.000Z (10 months ago)
- Last Synced: 2024-05-01T16:52:03.407Z (9 months ago)
- Topics: actions, ci, github-actions, nodejs, yarn
- Language: JavaScript
- Homepage:
- Size: 65.4 KB
- Stars: 16
- Watchers: 4
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Yarn Setup
> GitHub Action for setting up a Yarn environment. Caches dependencies for reduced execution times.
## Features
- π½ Performs a **checkout** using [actions/checkout](https://github.com/actions/checkout).
- βοΈ Sets up a **Node.js environment** using the specified `node-version` with [actions/setup-node](https://github.com/actions/setup-node).
- π½ **Caches** and retrieves `node_modules` for reduced execution time. Based on [actions/cache](https://github.com/actions/cache).
- β Runs `yarn install` with the cached `node_modules`.## Usage
```yml
steps:
- name: Yarn setup
uses: DerYeger/yarn-setup-action@master
with:
node-version: 16
```### Inputs
- `node-version`: The version of Node.js that will be used.
### Outputs
- `cache-hit`: Indicates a cache hit.
### Example
Splitting long jobs into multiple allows for parallel execution and thus faster workflow execution.
However, every job requires its own setup and environment initialization.
This Action allows for easy installation of dependencies while maintaining fast execution times thanks to built-in caching.The following example workflow demonstrates parallel execution of three jobs (`build`, `lint` and `test`), which run in parallel.
They all depend on the `prepare` job, which either validates that dependencies are cached or installs (then caches) them itself.
This setup ensures that each of the following jobs has access to Node.js and dependencies with minimal overhead (usually in the order of 3 to 5 seconds, depending on the project and `postinstall` setup).```yml
name: CIon: [pull_request, push]
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
steps:
- uses: DerYeger/yarn-setup-action@master
with:
node-version: 16
build:
name: Build
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: DerYeger/yarn-setup-action@master
with:
node-version: 16
- run: yarn build
lint:
name: Lint
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: DerYeger/yarn-setup-action@master
with:
node-version: 16
- run: yarn lint
test:
name: Test
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: DerYeger/yarn-setup-action@master
with:
node-version: 16
- run: yarn test
```## License
[MIT](./LICENSE) - Copyright Β© Jan MΓΌller