Skip to content

Commit

Permalink
ci: extract prepare actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gbicou committed Nov 21, 2024
1 parent 3b4498d commit 15d5f3c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 52 deletions.
28 changes: 28 additions & 0 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Prepare
description: Install dependencies and build
inputs:
build:
description: Build
required: false
default: 'true'

runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile

- name: Build
if: inputs.build == 'true'
shell: bash
run: pnpm build
16 changes: 2 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,5 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build
- name: Prepare and Build
uses: ./.github/actions/prepare
13 changes: 3 additions & 10 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
- name: Prepare
uses: ./.github/actions/prepare
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile
build: false

- name: Install ESLint SARIF
run: pnpm install @microsoft/eslint-formatter-sarif
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build
- name: Prepare and Build
uses: ./.github/actions/prepare

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build
- name: Prepare and Build
uses: ./.github/actions/prepare

- name: Start services using Docker Compose
run: docker compose -f docker-compose.test.yml up -d
Expand Down

0 comments on commit 15d5f3c

Please sign in to comment.