Skip to content

Commit 37c3779

Browse files
authored
Merge pull request #30 from mbsantiago/refactor/improve_build
Refactor/improve build
2 parents a96b703 + ee5aeff commit 37c3779

33 files changed

+182
-669
lines changed

.github/workflows/build_user_guide.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up uv
1919
run: curl -LsSf https://astral.sh/uv/install.sh | sh
2020

21-
- name: Set up Python ${{ matrix.python-version }}
21+
- name: Set up Python 3.12
2222
run: uv python install 3.12
2323

2424
- name: Restore uv cache

.github/workflows/bundle.yml

+26-17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Bundle App
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
67

78
jobs:
89
build-user-guide:
@@ -22,19 +23,26 @@ jobs:
2223
python-version:
2324
- "3.12"
2425
os:
25-
- ubuntu-latest
26+
- ubuntu-20.04
2627
- windows-latest
27-
- macos-11
28+
- macos-12
2829

2930
runs-on: ${{ matrix.os }}
3031

3132
steps:
32-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3334

34-
- name: Setup python
35-
uses: actions/setup-python@v4
36-
with:
37-
python-version: ${{ matrix.python-version }}
35+
- name: Set up uv
36+
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
37+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
38+
39+
- name: Set up uv
40+
if: ${{ matrix.os == 'windows-latest' }}
41+
run: irm https://astral.sh/uv/install.ps1 | iex
42+
shell: powershell
43+
44+
- name: Set up Python ${{ matrix.python-version }}
45+
run: uv python install ${{ matrix.python-version }}
3846

3947
- name: Retrieve built frontend
4048
uses: actions/download-artifact@v4
@@ -56,21 +64,22 @@ jobs:
5664
mkdir dist/
5765
mv "back/dist/whombat.zip" "dist/whombat-${{ matrix.os }}-${{ github.ref_name }}.zip"
5866
59-
- name: Bundle app (Linux)
60-
if: ${{ matrix.os == 'linux-latest' }}
67+
- name: Bundle app (Linux/macOS)
68+
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == "macos-12" }}
6169
run: |
6270
bash scripts/bundle_linux.sh
63-
mkdir dist/
64-
mv back/dist/whombat.zip "dist/whombat-${{ matrix.os }}-${{ github.ref_name }}.zip"
71+
mv dist/whombat.zip "dist/whombat-${{ matrix.os }}-${{ github.ref_name }}.zip"
6572
66-
- name: Bundle app (macOS)
67-
if: ${{ matrix.os == 'macos-11' }}
68-
run: |
69-
bash scripts/bundle_macos.sh
70-
mkdir dist/
71-
mv back/dist/whombat.zip "dist/whombat-${{ matrix.os }}-${{ github.ref_name }}.zip"
73+
# Only run if triggered by user
74+
- uses: actions/upload-artifact@v4
75+
if: ${{ github.event_name == 'workflow_dispatch' }}
76+
with:
77+
name: "${{ matrix.os }}-${{ github.ref_name }}" # Include ref_name for better organization
78+
path: "dist/whombat-${{ matrix.os }}-${{ github.ref_name }}.zip"
7279

80+
# Only run if release
7381
- name: Upload release
82+
if: ${{ github.event_name == 'release' }}
7483
uses: shogo82148/actions-upload-release-asset@v1
7584
with:
7685
upload_url: ${{ github.event.release.upload_url }}

.github/workflows/docs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
- name: Set up Python
2626
run: uv python install 3.12
2727

28-
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
28+
- name: Create cache key
29+
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
2930

3031
- name: Restore mkdocs cache
3132
uses: actions/cache@v3
@@ -47,7 +48,7 @@ jobs:
4748
- name: Install the project dependencies
4849
run: |
4950
cd back
50-
uv sync --all-extras --dev
51+
uv sync --dev
5152
5253
- name: Build and Deploy Docs
5354
run: |

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ front/tests-examples
77
front/playwright-report
88
front/test-results
99
.backups
10+
build/whombat
11+
dist

Makefile

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
SHELL := /bin/bash
22

3+
FRONT_DIR := front
4+
BACK_DIR := back
5+
6+
.PHONY: dev-front dev-back dev-docs storybook install-dev build-frontend build-guide bundle publish clean
7+
38
dev-front:
4-
cd front && npm run dev
9+
cd $(FRONT_DIR) && npm run dev
10+
11+
storybook:
12+
cd $(FRONT_DIR) && npm run storybook
513

614
dev-back:
7-
cd back && make serve-dev
15+
cd $(BACK_DIR) && make serve-dev
816

917
dev-docs:
10-
cd back && make serve-docs
18+
cd $(BACK_DIR) && make serve-docs
1119

1220
install-dev:
1321
bash scripts/install_dev.sh
@@ -18,11 +26,11 @@ build-frontend:
1826
build-guide:
1927
bash scripts/update_guide.sh
2028

21-
bundle-pyinstaller:
29+
bundle:
2230
bash scripts/bundle_linux.sh
2331

2432
publish:
2533
bash scripts/publish_pypi.sh
2634

27-
storybook:
28-
cd front && npm run storybook
35+
clean:
36+
rm -rf dist/ build/

assets/splash.png

-13.6 KB
Binary file not shown.

back/uv.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/src/app/(base)/exploration/sound_events/scatterplot/page.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import dynamic from "next/dynamic";
34
import { useState } from "react";
45

56
import Pagination from "@/app/components/Pagination";
@@ -12,7 +13,6 @@ import Error from "@/app/error";
1213

1314
import ExplorationLayout from "@/lib/components/layouts/Exploration";
1415
import ListCounts from "@/lib/components/lists/ListCounts";
15-
import SoundEventAnnotationsScatterPlot from "@/lib/components/sound_event_annotations/SoundEventAnnotationsScatterPlot";
1616
import Empty from "@/lib/components/ui/Empty";
1717
import Loading from "@/lib/components/ui/Loading";
1818

@@ -21,6 +21,14 @@ import usePagedQuery from "@/lib/hooks/utils/usePagedQuery";
2121

2222
import type { ScatterPlotData, SoundEventAnnotationFilter } from "@/lib/types";
2323

24+
const SoundEventAnnotationsScatterPlot = dynamic(
25+
() =>
26+
import(
27+
"@/lib/components/sound_event_annotations/SoundEventAnnotationsScatterPlot"
28+
),
29+
{ ssr: false },
30+
);
31+
2432
export default function Page() {
2533
const [selectedSoundEvent, setSelectedSoundEvent] =
2634
useState<ScatterPlotData | null>(null);

front/src/lib/components/annotation_projects/AnnotationProjectImport.tsx

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { zodResolver } from "@hookform/resolvers/zod";
22
import { useCallback } from "react";
33
import { useForm } from "react-hook-form";
4-
import { z } from "zod";
54

65
import { UploadIcon } from "@/lib/components/icons";
7-
import { Input, Group, Submit } from "@/lib/components/inputs/index";
6+
import { Group, Input, Submit } from "@/lib/components/inputs/index";
7+
import { AnnotationProjectImportSchema } from "@/lib/schemas";
8+
import type { AnnotationProjectImport } from "@/lib/types";
89

910
export default function AnnotationProjectImport({
1011
onImportAnnotationProject,
@@ -33,7 +34,7 @@ export default function AnnotationProjectImport({
3334
name="annotation_project"
3435
label="Select a project file to import"
3536
help="The file must be in AOEF format"
36-
error={errors.annotation_project?.message}
37+
error={errors.annotation_project?.message?.toString()}
3738
>
3839
<Input type="file" {...register("annotation_project")} required />
3940
</Group>
@@ -44,11 +45,3 @@ export default function AnnotationProjectImport({
4445
</form>
4546
);
4647
}
47-
48-
export const AnnotationProjectImportSchema = z.object({
49-
annotation_project: z.instanceof(FileList),
50-
});
51-
52-
export type AnnotationProjectImport = z.infer<
53-
typeof AnnotationProjectImportSchema
54-
>;

front/src/lib/components/clip_predictions/ClipPredictionDisplay.tsx

-24
This file was deleted.

0 commit comments

Comments
 (0)