From 72e1784c04ced38bbddfeffc816eda8037543fb7 Mon Sep 17 00:00:00 2001 From: Claudia Pellegrino Date: Tue, 3 Oct 2023 13:14:18 +0200 Subject: [PATCH] CI: have workflow install Yarn if not present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is useful e.g. for act [1] if using the medium-sized image. Taken from user @francis-switcho’s comment on actions/setup-node. [2] [1]: https://github.com/nektos/act#default-runners-are-intentionally-incomplete [2]: https://github.com/actions/setup-node/issues/182#issuecomment-1565453717 --- .github/workflows/unit-tests.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 355037c..42a5513 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -7,12 +7,23 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Install yarn if not present + run: |- + if which yarn; then + exit + fi + curl -fsSL --create-dirs -o ~/bin/yarn \ + https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js + chmod +x ~/bin/yarn + echo ~/bin >> "${GITHUB_PATH}" - name: Use specified Node.js version - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version-file: .nvmrc + cache: yarn - name: Install dependencies run: yarn install