mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-30 11:32:04 +03:00
221 lines
6.7 KiB
YAML
221 lines
6.7 KiB
YAML
name: "Test"
|
|
on: [push]
|
|
|
|
jobs:
|
|
lint-frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
run_install: |
|
|
args: ["--frozen-lockfile"]
|
|
|
|
- name: Lint frontend
|
|
run: pnpm lint
|
|
|
|
check-frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
run_install: |
|
|
args: ["--frozen-lockfile"]
|
|
|
|
- name: check frontend
|
|
run: |
|
|
pnpm check
|
|
|
|
unittest-frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
run_install: |
|
|
args: ["--frozen-lockfile"]
|
|
|
|
- name: check frontend
|
|
run: |
|
|
pnpm test
|
|
|
|
lint-rust:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
# Filter on steps instead of on jobs, so that we can keep GitHub branch protection for this job
|
|
- name: Getting changes
|
|
id: changes
|
|
uses: dorny/paths-filter@v2
|
|
with:
|
|
filters: |
|
|
rust:
|
|
- 'src-tauri/**'
|
|
|
|
- name: Install latest stable rust
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
override: true
|
|
toolchain: stable
|
|
components: rustfmt
|
|
- run: cargo fmt --check
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
working-directory: src-tauri
|
|
|
|
|
|
story:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
id: pnpm-cache
|
|
shell: bash
|
|
run: |
|
|
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v3
|
|
name: Setup pnpm cache
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install pnpm dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build storybook
|
|
run: pnpm story:build
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
# Filter on steps instead of on jobs, so that we can keep GitHub branch protection for this job
|
|
- name: Getting changes
|
|
id: changes
|
|
uses: dorny/paths-filter@v2
|
|
with:
|
|
filters: |
|
|
rust:
|
|
- 'src-tauri/**'
|
|
|
|
- name: Setup node
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install pnpm
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 7.x.x
|
|
run_install: false
|
|
|
|
- name: Get pnpm store directory
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
id: pnpm-cache
|
|
shell: bash
|
|
run: |
|
|
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/cache@v3
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
name: Setup pnpm cache
|
|
with:
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
- name: Install pnpm dependencies
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
run: pnpm install
|
|
|
|
- name: Install latest stable rust
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
override: true
|
|
toolchain: stable
|
|
components: rustfmt, clippy
|
|
|
|
- name: Cache rust dependencies
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- run: sudo apt-get update
|
|
if: runner.os == 'Linux'
|
|
- name: Install system dependencies
|
|
uses: daaku/gh-action-apt-install@v4
|
|
if: runner.os == 'Linux'
|
|
with:
|
|
# https://tauri.app/v1/guides/getting-started/prerequisites#setting-up-linux
|
|
packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
|
|
|
|
- name: Build frontend
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
run: pnpm build
|
|
|
|
- name: Install clippy
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
run: rustup component add clippy
|
|
|
|
- run: cargo clippy --all-features
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
working-directory: src-tauri
|
|
|
|
- name: Test rust
|
|
if: ${{ steps.changes.outputs.rust == 'true' }}
|
|
working-directory: src-tauri
|
|
run: cargo test --locked
|