Skip to content

Commit

Permalink
DRY the github workflows by making composite setup action
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkvon committed Nov 1, 2024
1 parent 2911691 commit c1828a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
19 changes: 19 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup environment
description: 'Set up the repository to run yarn commands on it etc...'

runs:
using: 'composite'

steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Enable corepack for yarn berry
shell: bash
run: corepack enable

- name: Install NPM packages
shell: bash
run: yarn install --frozen-lockfile
16 changes: 2 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Enable corepack for yarn berry
run: corepack enable

- name: Install NPM packages
run: yarn install --frozen-lockfile

- name: 'Setup'
run: './.github/workflows/setup.yml'
- name: Build the packages
run: yarn lerna run build
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install NPM packages
run: yarn install --frozen-lockfile
- name: setup
uses: './.github/actions/setup'

- name: Run tests
run: yarn lerna run test

0 comments on commit c1828a3

Please sign in to comment.