Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
Somfic committed Jun 6, 2024
2 parents f51d1a9 + 0f35289 commit 0a4e476
Show file tree
Hide file tree
Showing 52 changed files with 2,546 additions and 553 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/cd.yml

This file was deleted.

110 changes: 0 additions & 110 deletions .github/workflows/ci.yml

This file was deleted.

124 changes: 124 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
permissions:
contents: write

on:
push:
branches:
- main
#- next
pull_request:

concurrency:
group: ${{ github.workflow }}

name: ci/cd
jobs:
cicd:
runs-on: ${{ matrix.platform }}
name: ${{ matrix.label }}
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
label: macos (silicon)
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
label: macos (intel)
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
label: ubuntu
- platform: "windows-latest"
args: ""
label: windows
steps:
- name: checkout codebase
uses: actions/checkout@v4
with:
submodules: true

### Install languages ###
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: setup rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview

### Install language dependencies ###
- name: install yarn
run: npm install --global yarn

- name: install script dependencies
run: yarn install --frozen-lockfile

- name: install rust development tools
uses: taiki-e/install-action@cargo-llvm-cov

- name: install rust dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: install macos intel target
if: matrix.platform == 'macos-latest' && matrix.args == '--target x86_64-apple-darwin'
run: |
rustup target add x86_64-apple-darwin
### Apply cache ###
- name: generate Cargo.lock
run: cargo generate-lockfile
working-directory: ./src/core

- name: cache rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: "./src/core -> target"

- name: configure rust compiler cache
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
- name: cache rust compiler
uses: mozilla-actions/[email protected]

### Tag new version ###
- name: fetch all tags
run: git fetch --tags --unshallow --force

- name: tag new version
run: yarn tag:version

### Build and test ###
- name: install node dependencies
run: yarn install --frozen-lockfile
working-directory: ./src/ui

- name: build ui
run: yarn run build
working-directory: ./src/ui

- name: test core
run: cargo test --release ${{ matrix.args }}
working-directory: ./src/core

- name: publish release
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next')
uses: tauri-apps/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__
releaseName: "__VERSION__"
releaseBody: "."
releaseDraft: false
prerelease: ${{ github.ref != 'refs/heads/main' }}
projectPath: ./src/core
args: ${{ matrix.args }}
76 changes: 76 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
push:
pull_request:

jobs:
linting:
runs-on: ubuntu-latest
name: linting
steps:
- name: checkout codebase
uses: actions/checkout@v4
with:
submodules: true

### Install languages ###
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: setup rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview

### Install language dependencies ###
- name: install yarn
run: npm install --global yarn

- name: install script dependencies
run: yarn install --frozen-lockfile

- name: install rust development tools
uses: taiki-e/install-action@cargo-llvm-cov

- name: install rust dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
### Apply cache ###
- name: generate Cargo.lock
run: cargo generate-lockfile
working-directory: ./src/core

- name: cache rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: "./src/core -> target"

- name: configure rust compiler cache
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
- name: cache rust compiler
uses: mozilla-actions/[email protected]

### Build client ###
- name: install node dependencies
run: yarn install --frozen-lockfile
working-directory: ./src/ui

- name: build ui
run: yarn run build
working-directory: ./src/ui

### Linting ###
- name: run clippy
run: cargo clippy --all-targets --all-features
working-directory: ./src/core

- name: run eslint
run: yarn run lint
working-directory: ./src/ui
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -602,3 +602,4 @@ speech-recognition.bin
test-results.json
src-client/build
.DS_Store
/__keys
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"name": "@somfic/vla",
"author": "somfic",
"version": "0.3.0",
"version": "0.1.0-next.12",
"scripts": {
"tauri": "cd src && cd packager && tauri",
"tag:version": "npx tsx scripts/tag-version.ts"
"tauri": "cd src && cd core && tauri",
"tag:version": "npx tsx scripts/tag-version.ts",
"test": "cd src && cd core && cargo test",
"dev": "yarn tauri dev",
"build": "yarn tauri build",
"generate:types": "cd src && cd core && cargo run -- --generate-type-schemas && cd .. && cd .. && npx tsx scripts/generate-types.ts"
},
"license": "ISC",
"private": true,
"devDependencies": {
"glob": "^10.3.16"
"@tauri-apps/cli": "^1.5.13",
"glob": "^10.3.12",
"json-schema-to-typescript": "^14.0.4",
"tsx": "^4.9.3"
}
}
}
16 changes: 16 additions & 0 deletions scripts/generate-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { compile, compileFromFile } from "json-schema-to-typescript";
import { glob } from "glob";
import { writeFileSync } from "fs";
import { resolve } from "path";

const files = glob.sync("src/*.schema.json");

console.log("Found", files.length, "files to process: ", files);

files.forEach(async (file) => {
const ts = await compileFromFile(file);
const tsFile = file.replace(".schema.json", ".d.ts").split("\\").pop();
const path = resolve("src", "ui", "src", "lib", "models", tsFile);

writeFileSync(path, ts);
});
Loading

0 comments on commit 0a4e476

Please sign in to comment.