ci: build all crates at once and then distribute separately

This commit is contained in:
Brendan Allan 2022-04-24 00:14:00 +08:00
parent 6d45e6316f
commit 09b482c65b
2 changed files with 87 additions and 67 deletions

View file

@ -0,0 +1,44 @@
name: Install deskop dependencies
description: Installs OS-specific dependencies for desktop builds
runs:
using: "composite"
steps:
- name: Install ffmpeg & tauri deps (Ubuntu)
if: matrix.platform == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libssl-dev \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavresample-dev \
libavutil-dev \
libswscale-dev \
libswresample-dev \
ffmpe \
libgtk-3-dev \
webkit2gtk-4.0 \
libappindicator3-dev \
librsvg2-dev \
patchelfg
- name: Install ffmpeg (macOS)
if: matrix.platform == 'macos-latest'
shell: bash
run: brew install ffmpeg
- name: Install vcpkg & ffmpeg (Windows)
if: matrix.platform == 'windows-latest'
shell: powershell
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z
7z x ffmpeg-release-full-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"

View file

@ -1,4 +1,4 @@
name: CI
name: CI (Desktop)
on:
pull_request:
push:
@ -58,47 +58,9 @@ jobs:
- name: Build Web
run: pnpm web build
build-core:
name: Build core (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install ffmpeg
uses: ./.github/actions/install-ffmpeg
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, rust-src
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c
with:
sharedKey: ${{ matrix.platform }}
- name: Build prisma-cli
run: cargo build -p prisma-cli --release
- name: Generate Primsa client
working-directory: core
run: cargo prisma generate
- name: Build sdcore
run: cargo build -p sdcore --release
build-desktop:
build-all:
name: Build desktop (${{ matrix.platform }})
needs: build-core
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: true
@ -107,15 +69,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install vcpkg (Windows)
if: matrix.platform == 'windows-latest'
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
- name: Install ffmpeg
uses: ./.github/actions/install-ffmpeg
- name: Install desktop dependencies
uses: ./.github/actions/install-desktop-deps
- name: Setup Node
uses: actions/setup-node@v1
@ -133,24 +89,50 @@ jobs:
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c
with:
sharedKey: ${{ matrix.platform }}
sharedKey: all-${{ matrix.platform }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --release
build-desktop:
name: Build desktop (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install desktop dependencies
uses: ./.github/actions/install-desktop-deps
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 17
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, rust-src
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c
with:
sharedKey: all-${{ matrix.platform }}
- name: Install pnpm
uses: pnpm/action-setup@v2.2.1
with:
version: 6.32.6
- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libgtk-3-dev \
webkit2gtk-4.0 \
libappindicator3-dev \
librsvg2-dev \
patchelf
- name: Install pnpm dependencies
run: pnpm i --frozen-lockfile
@ -160,12 +142,6 @@ jobs:
- name: Build frontend
run: pnpm desktop build
- name: Build sdcore
run: cargo build -p sdcore --release
- name: Build desktop
run: cargo build -p spacedrive --release
- name: Build
uses: tauri-apps/tauri-action@v0