Files
spacedrive/.github/workflows/ci.yml
Brendan Allan 162f3d7782 Improve CI Speed (#398)
* use different cache

* cache prisma client in rustfmt

* cleanup prettier config

* build server image in sub-action

* server image + prisma client custom actions

* remove lefthoook checks that are in ci

* fix build-server-image

* rename Clippy job

* rename build core job

* use custom rust caching action

* fix rust cache shared key

* cleanup custom action job names

* remove platform check in clippy ci

* setup pnpm in clippy ci

* update mobile package name

* make ios compiling conditional

* use pnpm cache

* run clippy in release

* force use release for all jobs
2022-10-04 18:45:54 -07:00

170 lines
4.2 KiB
YAML

name: CI
on:
pull_request:
push:
branches:
- main
paths-ignore:
- '**/.md'
workflow_dispatch:
env:
SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends
jobs:
typescript:
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7.x.x
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 17
cache: 'pnpm'
- name: Install pnpm dependencies
run: pnpm i --frozen-lockfile
- name: Perform typechecks
run: pnpm typecheck
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Cache Rust dependencies
uses: ./.github/actions/cache-rust-deps
- name: Generate Prisma client
uses: ./.github/actions/generate-prisma-client
- name: Run rustfmt
run: cargo fmt --all -- --check
clippy_check:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: clippy
- name: Cache Rust dependencies
uses: ./.github/actions/cache-rust-deps
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 17
- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 7
run_install: false
- name: Run 'setup-system.sh' script
run: ./.github/scripts/setup-system.sh
- name: Generate Prisma client
uses: ./.github/actions/generate-prisma-client
- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --release
build-and-publish:
name: Build and Publish (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: true
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Log in to the Container registry
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v3
- 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: ./.github/actions/cache-rust-deps
- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7.x.x
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 17
cache: 'pnpm'
- name: Install pnpm dependencies
run: pnpm i --frozen-lockfile
- name: Run 'setup-system.sh' script
if: matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest'
run: ./.github/scripts/setup-system.sh
- name: Run 'setup-system.ps1' script
if: matrix.platform == 'windows-latest'
run: ./.github/scripts/setup-system.ps1 -ci
- name: Generate Prisma client
uses: ./.github/actions/generate-prisma-client
- name: Build everything
run: cargo build --release
- name: Bundle Desktop
run: pnpm desktop tauri build
- name: Publish server Docker image
if: matrix.platform == 'ubuntu-latest' && github.event_name != 'pull_request'
uses: ./.github/actions/publish-server-image
- name: Publish artifacts
uses: ./.github/actions/publish-artifacts