Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
TwanLuttik committed Sep 28, 2023
1 parent e09df50 commit aab182e
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 39 deletions.
File renamed without changes.
25 changes: 25 additions & 0 deletions .github/actions/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup Node.js, pnpm and dependencies
description: Setup Node.js, pnpm and dependencies
inputs:
token:
description: Github token
required: false
default: ''
runs:
using: 'composite'
steps:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x.x

- name: Install Node.js
uses: actions/setup-node@v3
with:
token: ${{ inputs.token }}
check-latest: true
node-version-file: '.nvmrc'

- name: Install pnpm deps
shell: ${{ runner.os == 'Windows' && 'powershell' || 'bash' }}
run: pnpm i --frozen-lockfile
48 changes: 48 additions & 0 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Setup Rust and Prisma
description: Setup Rust and Prisma
inputs:
targets:
description: Comma-separated list of target triples to install for this toolchain
required: false
save-cache:
description: Whether to save the Rust cache
required: false
default: 'false'
runs:
using: 'composite'
steps:
- name: Install Rust
id: toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.targets }}
toolchain: stable
components: clippy, rustfmt

- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ inputs.save-cache }}
prefix-key: 'v0-rust-deps'
shared-key: ${{ inputs.targets }}

- name: Restore cached Prisma codegen
id: cache-prisma-restore
uses: actions/cache/restore@v3
with:
key: prisma-1-${{ runner.os }}-${{ hashFiles('./core/prisma/*', './crates/sync-generator/*', './Cargo.toml') }}
path: crates/prisma/src/**/*.rs

- name: Generate Prisma client
working-directory: core
if: ${{ steps.cache-prisma-restore.outputs.cache-hit != 'true' }}
shell: bash
run: cargo prisma generate

- name: Save Prisma codegen
id: cache-prisma-save
if: ${{ inputs.save-cache == 'true' }}
uses: actions/cache/save@v3
with:
key: ${{ steps.cache-prisma-restore.outputs.cache-primary-key }}
path: crates/prisma/src/**/*.rs
65 changes: 65 additions & 0 deletions .github/actions/setup-system/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Setup System and Rust
description: Setup System and Rust
inputs:
token:
description: Github token
required: false
default: ''
targets:
description: Comma-separated list of target triples to install for this toolchain
required: false
setup-arg:
description: Argument for the system setup script
required: false
default: ''
save-cache:
description: Whether to save the System cache
required: false
default: 'false'
runs:
using: 'composite'
steps:
- name: Restore cached LLVM and Clang
if: ${{ runner.os == 'Windows' }}
id: cache-llvm-restore
uses: actions/cache/restore@v3
with:
key: llvm-15
path: C:/Program Files/LLVM

- name: Install LLVM and Clang
if: ${{ runner.os == 'Windows' }}
uses: KyleMayes/install-llvm-action@v1
with:
cached: ${{ steps.cache-llvm-restore.outputs.cache-hit }}
version: '15'

- name: Save LLVM and Clang
if: ${{ runner.os == 'Windows' && inputs.save-cache == 'true' }}
id: cache-llvm-save
uses: actions/cache/save@v3
with:
key: ${{ steps.cache-llvm-restore.outputs.cache-primary-key }}
path: C:/Program Files/LLVM

- name: Setup Rust and Dependencies
uses: ./.github/actions/setup-rust
with:
targets: ${{ inputs.targets }}
save-cache: ${{ inputs.save-cache }}

- name: Run 'setup-system.sh' script
shell: bash
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: ./.github/scripts/setup-system.sh ${{ inputs.setup-arg }}
env:
TARGET: ${{ inputs.targets }}
GITHUB_TOKEN: ${{ inputs.token }}
APPLE_SIGNING_IDENTITY: ${{ env.APPLE_SIGNING_IDENTITY }}

- name: Run 'setup-system.ps1' script
shell: powershell
if: ${{ runner.os == 'Windows' }}
run: ./.github/scripts/setup-system.ps1
env:
GITHUB_TOKEN: ${{ inputs.token }}
59 changes: 20 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

# NOTE: For Linux builds, we can only build with Ubuntu. It should be the oldest base system we intend to support. See PR-759 & https://tauri.app/v1/guides/building/linux for reference.

jobs:
release:
desktop-main:
strategy:
fail-fast: true
matrix:
pnpm-version: [8.8.0]
node-version: [18]
settings:
- host: macos-latest
target: x86_64-apple-darwin
Expand All @@ -22,10 +20,11 @@ jobs:
- host: windows-latest
target: x86_64-pc-windows-msvc
bundles: msi

- host: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bundles: appimage

name: Desktop - Main ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
steps:
- name: Maximize build space
Expand All @@ -49,43 +48,25 @@ jobs:
New-Item -ItemType Directory -Force -Path C:\ollama_target
New-Item -Path target -ItemType Junction -Value C:\ollama_target
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
# You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
- name: Remove 32-bit libs
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
dpkg -l | grep i386
sudo apt-get purge --allow-remove-essential libc6-i386 ".*:i386"
sudo dpkg --remove-architecture i386
- name: Rust cache
uses: swatinem/rust-cache@v2
- name: Setup Node.js, pnpm and dependencies
uses: ./.github/actions/setup-pnpm
with:
workspaces: './src-tauri -> target'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Pnpm install
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm-version }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
check-latest: true
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

- name: Sync node version and setup cache
uses: actions/setup-node@v3
- name: Setup System and Rust
uses: ./.github/actions/setup-system
env:
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
with:
node-version: 'lts/*'
cache: 'pnpm' # Set this to npm, yarn or pnpm.

- name: Install frontend dependencies
# If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
run: pnpm i # Change this to npm, yarn or pnpm.
token: ${{ secrets.GITHUB_TOKEN }}
targets: ${{ matrix.settings.target }}

- name: Build
run: |
Expand Down

0 comments on commit aab182e

Please sign in to comment.