#10 optimize CI build test

This commit is contained in:
neil 2022-11-22 13:31:22 +08:00
parent 3eff7961bb
commit 9610be6d05
3 changed files with 61 additions and 14 deletions

View file

@ -1,13 +1,65 @@
name: "test"
on: [pull_request]
jobs:
test-tauri:
changes:
runs-on: ubuntu-latest
outputs:
svelte: ${{steps.svelte.outputs.src}}
tauri: ${{steps.sls.outputs.sls}}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: svelte
with:
filters: |
src:
- 'src/packages/gui/src/**'
- 'src/packages/ui/**'
- uses: dorny/paths-filter@v2
id: tauri
with:
filters: |
sls:
- 'src/packages/gui/src-tauri/**'
build_svelte:
needs: changes
if: needs.validation.outputs.svelte == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 16
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install app dependencies and build it
run: pnpm install && pnpm --filter gui build
build_tauri:
needs: changes
if: needs.validation.outputs.tauri == 'true'
strategy:
fail-fast: false
matrix:
# platform: [macos-latest, ubuntu-20.04, windows-latest]
platform: [macos-latest]
platform: [macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
@ -31,15 +83,8 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install app dependencies
run: pnpm install
- name: install app dependencies and build it
run: pnpm install && pnpm --filter gui build
# - name: test build tauri
# run: pnpm --filter gui tauri build
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: ./packages/gui
- name: test build tauri
run: pnpm --filter gui tauri build

View file

@ -5,7 +5,7 @@
"scripts": {
"tauri": "tauri",
"dev": "vite dev --port 8080",
"build": "vite build",
"build": "vite build && cp build/app.html build/index.html",
"preview": "vite preview",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",

View file

@ -0,0 +1,2 @@
export const prerender = true
export const ssr = false