mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-22 17:11:43 +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
|
/histoire.config.ts
|
||||||
/postcss.config.cjs
|
/postcss.config.cjs
|
||||||
/tailwind.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
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: ./.github/actions/pnpm-install
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
run_install: |
|
|
||||||
args: ["--frozen-lockfile"]
|
|
||||||
|
|
||||||
- name: Lint frontend
|
- name: Lint frontend
|
||||||
run: pnpm lint
|
|
||||||
|
run: |
|
||||||
|
export NODE_OPTIONS="--max_old_space_size=4096"
|
||||||
|
pnpm lint
|
||||||
|
|
||||||
check-frontend:
|
check-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -29,17 +23,8 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: ./.github/actions/pnpm-install
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
run_install: |
|
|
||||||
args: ["--frozen-lockfile"]
|
|
||||||
|
|
||||||
- name: check frontend
|
- name: check frontend
|
||||||
run: |
|
run: |
|
||||||
@ -51,17 +36,8 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
- name: Setup pnpm
|
||||||
uses: pnpm/action-setup@v2
|
uses: ./.github/actions/pnpm-install
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
run_install: |
|
|
||||||
args: ["--frozen-lockfile"]
|
|
||||||
|
|
||||||
- name: check frontend
|
- name: check frontend
|
||||||
run: |
|
run: |
|
||||||
@ -100,33 +76,8 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup pnpm
|
||||||
uses: actions/setup-node@v3
|
uses: ./.github/actions/pnpm-install
|
||||||
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: Build storybook
|
- name: Build storybook
|
||||||
run: pnpm story:build
|
run: pnpm story:build
|
||||||
@ -146,38 +97,11 @@ jobs:
|
|||||||
rust:
|
rust:
|
||||||
- 'src-tauri/**'
|
- 'src-tauri/**'
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup pnpm
|
||||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
uses: ./.github/actions/pnpm-install
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
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
|
- name: Install latest stable rust
|
||||||
if: ${{ steps.changes.outputs.rust == 'true' }}
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -36,3 +36,6 @@ src-tauri/data.txt
|
|||||||
|
|
||||||
|
|
||||||
/.histoire
|
/.histoire
|
||||||
|
|
||||||
|
# Written to disk when using `act`
|
||||||
|
.pnpm-store
|
@ -19,3 +19,6 @@ yarn.lock
|
|||||||
/src-tauri
|
/src-tauri
|
||||||
|
|
||||||
/.histoire
|
/.histoire
|
||||||
|
|
||||||
|
# Written to disk when using `act`
|
||||||
|
.pnpm-store
|
Loading…
Reference in New Issue
Block a user