Add border and format #283
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Canary" | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: Select branch | |
required: true | |
default: main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
quality: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
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 | |
run: pnpm install | |
- name: Check format | |
run: pnpm check:format | |
- name: Lint | |
run: pnpm lint | |
build-tauri: | |
name: Build (${{ matrix.settings.os }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: universal-apple-darwin | |
toolchain: aarch64-apple-darwin,x86_64-apple-darwin | |
bundles: dmg | |
os: mac | |
- host: windows-latest | |
target: x86_64-pc-windows-msvc | |
toolchain: x86_64-pc-windows-msvc | |
bundles: nsis | |
os: windows | |
- host: ubuntu-22.04 | |
target: x86_64-unknown-linux-gnu | |
toolchain: x86_64-unknown-linux-gnu | |
bundles: deb,appimage | |
os: linux | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
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 Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: "${{ matrix.settings.toolchain }}" | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: "apps/desktop/src-tauri/target" | |
- name: Install dependencies (ubuntu only) | |
if: matrix.settings.host == 'ubuntu-22.04' | |
run: | | |
# https://tauri.app/v1/guides/building/linux/#limitations | |
sudo apt-get update | |
sudo apt install \ | |
build-essential \ | |
curl \ | |
wget \ | |
file \ | |
libssl-dev \ | |
libgtk-3-dev \ | |
libayatana-appindicator3-dev \ | |
libwebkit2gtk-4.1-dev \ | |
librsvg2-dev | |
- name: Install dependencies | |
run: pnpm install | |
- name: Patch canary version | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const path = require("path"); | |
const { script } = await import("file://" + path.resolve('./scripts/actions/patch-canary-version.js')); | |
await script({ github, context }); | |
- uses: tauri-apps/tauri-action@dev | |
id: build_os | |
with: | |
projectPath: apps/desktop | |
args: --config "src-tauri/tauri.conf.canary.json" --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}" | |
TAURI_SIGNING_PUBLIC_KEY: "${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}" | |
VITE_AXIOM_TOKEN: "${{ secrets.VITE_AXIOM_TOKEN }}" | |
- name: Upload canary ${{ matrix.setting.os }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "overlayed-canary-${{ matrix.settings.os }}" | |
path: "${{ join(fromJSON(steps.build_os.outputs.artifactPaths), '\n') }}" | |
upload-to-r2: | |
needs: build-tauri | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch }} | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
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 | |
run: pnpm install --filter=overlayed-root | |
- name: Upload Canary Binary to R2 | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const path = require("path"); | |
const { script } = await import("file://" + path.resolve('./scripts/actions/upload-to-r2.js')); | |
await script({ github, context }, "canary" ); | |
env: | |
R2_BUCKET: ${{ secrets.R2_BUCKET }} | |
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} | |
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} |