mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-22 09:01:45 +03:00
Use composite actions in push.yaml
- to use cache effectively we need a re-usable node setup
This commit is contained in:
parent
cdd24f1f81
commit
8b22246206
@ -25,3 +25,6 @@ yarn.lock
|
||||
/histoire.config.ts
|
||||
/postcss.config.cjs
|
||||
/tailwind.config.cjs
|
||||
|
||||
# Written to disk when using `act`
|
||||
.pnpm-store
|
43
.github/actions/pnpm-install/action.yml
vendored
Normal file
43
.github/actions/pnpm-install/action.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
name: 'pnpm install'
|
||||
description: 'Runs the pnpm install process'
|
||||
inputs:
|
||||
file-type: # id of input
|
||||
description: 'What file types to consider'
|
||||
default: 'all'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v2
|
||||
if: ${{ inputs.file-type == 'all' || steps.changes.outputs[inputs.file-type] == 'true' }}
|
||||
name: Install pnpm
|
||||
with:
|
||||
version: 8.6.12
|
||||
run_install: false
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
if: ${{ inputs.file-type == 'all' || steps.changes.outputs[inputs.file-type] == 'true' }}
|
||||
name: Setup node
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'pnpm'
|
||||
|
||||
|
||||
- name: Get pnpm store directory
|
||||
if: ${{ inputs.file-type == 'all' || steps.changes.outputs[inputs.file-type] == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v3
|
||||
if: ${{ inputs.file-type == 'all' || steps.changes.outputs[inputs.file-type] == 'true' }}
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
if: ${{ inputs.file-type == 'all' || steps.changes.outputs[inputs.file-type] == 'true' }}
|
||||
shell: bash
|
||||
run: pnpm install
|
100
.github/workflows/push.yaml
vendored
100
.github/workflows/push.yaml
vendored
@ -8,20 +8,14 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
run_install: |
|
||||
args: ["--frozen-lockfile"]
|
||||
uses: ./.github/actions/pnpm-install
|
||||
|
||||
- name: Lint frontend
|
||||
run: pnpm lint
|
||||
|
||||
run: |
|
||||
export NODE_OPTIONS="--max_old_space_size=4096"
|
||||
pnpm lint
|
||||
|
||||
check-frontend:
|
||||
runs-on: ubuntu-latest
|
||||
@ -29,17 +23,8 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
run_install: |
|
||||
args: ["--frozen-lockfile"]
|
||||
uses: ./.github/actions/pnpm-install
|
||||
|
||||
- name: check frontend
|
||||
run: |
|
||||
@ -51,17 +36,8 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
run_install: |
|
||||
args: ["--frozen-lockfile"]
|
||||
uses: ./.github/actions/pnpm-install
|
||||
|
||||
- name: check frontend
|
||||
run: |
|
||||
@ -100,33 +76,8 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install pnpm dependencies
|
||||
run: pnpm install
|
||||
- name: Setup pnpm
|
||||
uses: ./.github/actions/pnpm-install
|
||||
|
||||
- name: Build storybook
|
||||
run: pnpm story:build
|
||||
@ -146,38 +97,11 @@ jobs:
|
||||
rust:
|
||||
- 'src-tauri/**'
|
||||
|
||||
- name: Setup node
|
||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||
uses: actions/setup-node@v3
|
||||
- name: Setup pnpm
|
||||
uses: ./.github/actions/pnpm-install
|
||||
with:
|
||||
node-version: 18
|
||||
file-type: 'rust'
|
||||
|
||||
- name: Install pnpm
|
||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install pnpm dependencies
|
||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||
run: pnpm install
|
||||
|
||||
- name: Install latest stable rust
|
||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -36,3 +36,6 @@ src-tauri/data.txt
|
||||
|
||||
|
||||
/.histoire
|
||||
|
||||
# Written to disk when using `act`
|
||||
.pnpm-store
|
@ -19,3 +19,6 @@ yarn.lock
|
||||
/src-tauri
|
||||
|
||||
/.histoire
|
||||
|
||||
# Written to disk when using `act`
|
||||
.pnpm-store
|
Loading…
Reference in New Issue
Block a user