gitbutler/.github/workflows/push.yaml

221 lines
6.7 KiB
YAML
Raw Normal View History

2023-02-20 15:12:24 +03:00
name: "Test"
on: [push]
jobs:
2023-05-31 10:35:32 +03:00
lint-frontend:
2023-07-21 17:46:11 +03:00
runs-on: ubuntu-latest
2023-02-27 12:50:57 +03:00
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"]
2023-03-07 19:11:49 +03:00
- name: Lint frontend
2023-07-31 15:12:05 +03:00
run: pnpm lint
2023-03-07 19:11:49 +03:00
2023-05-31 10:35:32 +03:00
check-frontend:
2023-07-21 18:14:02 +03:00
runs-on: ubuntu-latest
2023-03-07 19:11:49 +03:00
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: |
2023-02-27 12:50:57 +03:00
pnpm check
2023-06-22 15:33:03 +03:00
unittest-frontend:
2023-07-21 17:46:11 +03:00
runs-on: ubuntu-latest
2023-06-22 15:33:03 +03:00
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
2023-05-31 10:35:32 +03:00
lint-rust:
2023-07-21 17:46:11 +03:00
runs-on: ubuntu-latest
2023-05-31 10:35:32 +03:00
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/**'
2023-06-02 15:02:39 +03:00
- name: Install latest stable rust
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-06-02 15:02:39 +03:00
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable
components: rustfmt
2023-05-31 10:35:32 +03:00
- run: cargo fmt --check
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-31 10:35:32 +03:00
working-directory: src-tauri
2023-05-12 13:22:41 +03:00
story:
2023-07-21 17:46:11 +03:00
runs-on: ubuntu-latest
2023-02-20 15:12:24 +03:00
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
2023-02-28 10:59:02 +03:00
- name: Install pnpm
2023-02-20 15:12:24 +03:00
uses: pnpm/action-setup@v2
with:
version: 7.x.x
2023-02-28 10:59:02 +03:00
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') }}
2023-05-12 13:22:41 +03:00
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install pnpm dependencies
run: pnpm install
- name: Build storybook
run: pnpm story:build
test:
2023-07-21 17:46:11 +03:00
runs-on: ubuntu-latest
2023-05-12 13:22:41 +03:00
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/**'
2023-05-12 13:22:41 +03:00
- name: Setup node
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-12 13:22:41 +03:00
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install pnpm
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-12 13:22:41 +03:00
uses: pnpm/action-setup@v2
with:
version: 7.x.x
run_install: false
- name: Get pnpm store directory
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-12 13:22:41 +03:00
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-12 13:22:41 +03:00
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
2023-02-28 10:59:02 +03:00
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install pnpm dependencies
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-02-28 10:59:02 +03:00
run: pnpm install
2023-02-20 15:12:24 +03:00
2023-06-02 15:02:39 +03:00
- name: Install latest stable rust
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-06-02 15:02:39 +03:00
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable
components: rustfmt, clippy
2023-02-20 16:14:28 +03:00
- name: Cache rust dependencies
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-03-28 16:30:07 +03:00
uses: Swatinem/rust-cache@v2
2023-02-20 16:14:28 +03:00
with:
2023-03-28 16:30:07 +03:00
workspaces: src-tauri
2023-02-28 10:59:02 +03:00
2023-05-16 14:04:56 +03:00
- run: sudo apt-get update
if: runner.os == 'Linux'
2023-02-28 10:42:17 +03:00
- name: Install system dependencies
2023-02-20 16:14:28 +03:00
uses: daaku/gh-action-apt-install@v4
2023-02-28 10:42:17 +03:00
if: runner.os == 'Linux'
2023-02-20 16:14:28 +03:00
with:
2023-02-20 16:29:10 +03:00
# 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
2023-02-20 15:12:24 +03:00
2023-02-28 10:42:17 +03:00
- name: Build frontend
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-02-28 10:42:17 +03:00
run: pnpm build
2023-02-20 16:41:52 +03:00
2023-05-31 10:35:32 +03:00
- name: Install clippy
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-31 10:35:32 +03:00
run: rustup component add clippy
- run: cargo clippy --all-features
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-05-31 10:35:32 +03:00
working-directory: src-tauri
2023-02-20 15:12:24 +03:00
- name: Test rust
if: ${{ steps.changes.outputs.rust == 'true' }}
2023-02-20 15:12:24 +03:00
working-directory: src-tauri
run: cargo test --locked