ci: restore cache in js build steps

This commit is contained in:
Brendan Allan 2022-04-22 19:43:15 +08:00
parent 72386a69f6
commit 3c5f29c90d
2 changed files with 135 additions and 0 deletions

119
.github/workflows/_ci copy.yaml vendored Normal file
View file

@ -0,0 +1,119 @@
name: CI
on:
pull_request:
push:
branches:
- main
- new-ci
paths-ignore:
- "**/.md"
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
env:
FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z
RUST_CACHE_VERSION: 0
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
# from https://github.com/zmwangx/rust-ffmpeg/blob/master/.github/workflows/build.yml
- name: Install ffmpeg (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"
Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -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"
- name: Install CMake (Windows)
uses: lukka/get-cmake@latest
if: matrix.platform == 'windows-latest'
# Optimisation for windows
- name: Rename existing rust toolchain (Windows)
if: matrix.platform == 'windows-latest'
run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
- 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: ${{ env.RUST_CACHE_VERSION }}
- name: Cache pnpm dependencies
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- 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 \
libssl-dev \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavresample-dev \
libavutil-dev \
libswscale-dev \
libswresample-dev \
pkg-config \
ffmpeg
- name: Install dependencies (macOS)
if: matrix.platform == 'macos-latest'
run: |
brew install ffmpeg
- name: Install pnpm dependencies
run: pnpm i
- name: Build codegen
run: pnpm prep:ci
- name: Build frontend
run: pnpm desktop build:vite
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
with:
projectPath: apps/desktop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -51,6 +51,14 @@ jobs:
with:
node-version: 17
- name: Cache pnpm dependencies
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-
- name: Install pnpm
uses: pnpm/action-setup@v2.2.1
with:
@ -75,6 +83,14 @@ jobs:
with:
node-version: 17
- name: Cache pnpm dependencies
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-
- name: Install pnpm
uses: pnpm/action-setup@v2.2.1
with: