Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web-based dashboard for managing sounds #34

Merged
merged 22 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e26da98
feat(dashboard): add dashboard scaffolding
klevente Jul 21, 2024
2da9216
feat(bot): move bot to separate dir, update build
klevente Jul 21, 2024
58b9363
chore(dashboard): run prettier
klevente Jul 21, 2024
6e049e5
chore(dockerfile): add consistent casing in dockerfile
klevente Jul 23, 2024
a193e47
feat(dashboard): Use shadcn/ui components
klevente Jul 24, 2024
bc3c1b1
deploy(app): update fly config
klevente Jul 24, 2024
484fe41
fix(dashboard): properly use `key` when iterating over sound files
klevente Jul 24, 2024
f5c2b9b
ci(project): adapt gh actions files to new structure
klevente Jul 24, 2024
c436266
ci(project): add dashboard checks
klevente Jul 24, 2024
d8c09ae
chore(dashboard): update npm packages
klevente Jul 24, 2024
c39eeba
feat(healthcheck): return json on error
klevente Jul 24, 2024
cbfecfe
chore(bot): update deps to latest versions
klevente Jul 25, 2024
aa9efc6
feat(dashboard): add admin login
klevente Jul 27, 2024
e7b2e68
feat(dashboard): add toasts for actions
klevente Jul 27, 2024
b882c22
feat(dashboard): add spinner to login
klevente Jul 27, 2024
dfb110e
feat(dashboard): allow concurrent deletion
klevente Jul 28, 2024
4ef3812
feat(dashboard): use table component for rendering sounds
klevente Jul 29, 2024
1b83811
feat(users): work on user handling
klevente Aug 8, 2024
31cb383
feat(users): implement full registration flow
klevente Aug 11, 2024
e15aa36
feat(dashboard): add reusable header
klevente Aug 11, 2024
758d5e6
ci(actions): fix formatting
klevente Aug 11, 2024
ff4c46a
ci(eslint): add prettier plugin
klevente Aug 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ Dockerfile
# Git files
.git
.github
.gitignore
**/.gitignore
LICENSE
README.md

# Cargo files
**/*.rs.bk
/target
bot/*.rs.bk
bot/target

# Node files
dashboard/node_modules/
dashboard/.cache
dashboard/public/build
dashboard/build
dashboard/public/sounds


# Fly files
fly.toml
Expand All @@ -21,4 +29,8 @@ fly.toml
/scripts

# Env
.env
.env

# Random
.DS_Store
*.log
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
DISCORD_TOKEN=<xxx>

# [Optional] Default value is `./sounds`
SOUNDS_PATH=./sounds
SOUNDS_PATH=bot/sounds
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
25 changes: 23 additions & 2 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,53 @@ jobs:
bump:
name: Bump version
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install Toolchain
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: '**/package-lock.json'

- name: Install deps
run: npm ci
working-directory: ./dashboard

- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: bot

- name: Install cargo-bump
run: cargo install cargo-bump

- name: Bump Cargo version
run: cargo-bump bump ${{ github.event.inputs.version }}
working-directory: ./bot

- name: Bump Cargo.lock
run: cargo build
working-directory: ./bot

- name: Get latest version
id: get_version
run: echo "VERSION=$(cargo pkgid | cut -d# -f2)" >> $GITHUB_OUTPUT
working-directory: ./bot

- name: Bump npm version
run: npm version ${{ github.event.inputs.version }}
working-directory: ./dashboard

- name: Create bump PR
uses: peter-evans/create-pull-request@v5
Expand All @@ -60,4 +81,4 @@ jobs:
branch: bump/${{ steps.get_version.outputs.VERSION }}
base: main
delete-branch: true
labels: 'release'
labels: 'release'
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml → .github/workflows/ci-bot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI (Bot)

on:
push:
Expand All @@ -16,6 +16,9 @@ jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./bot

steps:
- name: Checkout sources
Expand All @@ -32,16 +35,22 @@ jobs:

- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: bot


- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D clippy::all -D warnings
args: --manifest-path bot/Cargo.toml -- -D clippy::all -D warnings

rustfmt:
name: Format
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./bot

steps:
- name: Checkout sources
Expand All @@ -61,6 +70,9 @@ jobs:
build:
name: Build
runs-on: ${{ matrix.arch.os }}
defaults:
run:
working-directory: ./bot

strategy:
matrix:
Expand All @@ -78,6 +90,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.arch.target }}
profile: minimal
override: true

Expand All @@ -89,10 +102,12 @@ jobs:

- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: bot

- name: Build Binary
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --locked --target ${{ matrix.arch.target }}
args: --manifest-path bot/Cargo.toml --locked --target ${{ matrix.arch.target }}
83 changes: 83 additions & 0 deletions .github/workflows/ci-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI (Dashboard)

on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dashboard

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: '**/package-lock.json'

- name: Install deps
run: npm ci

- name: Run tsc
run: npm run typecheck

prettier:
name: Prettier
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dashboard

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: '**/package-lock.json'

- name: Install deps
run: npm ci

- name: Run Prettier
run: npm run prettier:check

eslint:
name: ESLint
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dashboard

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "npm"
cache-dependency-path: '**/package-lock.json'

- name: Install deps
run: npm ci

- name: Run ESLint
run: npm run lint
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ jobs:

- name: Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: bot

- name: Build release binary
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --locked --target ${{ matrix.arch.target }}
args: --manifest-path bot/Cargo.toml --release --locked --target ${{ matrix.arch.target }}

- name: Package
uses: vimtor/action-zip@v1.1
with:
files: target/${{ matrix.arch.target }}/release/mememachine-rs${{ matrix.arch.suffix }}
files: bot/target/${{ matrix.arch.target }}/release/mememachine-rs${{ matrix.arch.suffix }}
dest: mememachine-rs-${{ matrix.arch.target }}.zip

- name: Publish
Expand Down Expand Up @@ -92,7 +94,7 @@ jobs:
- name: Build & push Docker image
uses: docker/build-push-action@v4
with:
context: .
context: ./bot
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 2 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
- name: Get version from Cargo.toml
id: get-version
run: echo "VERSION=v$(cargo pkgid | cut -d# -f2)" >> $GITHUB_OUTPUT
working-directory: ./bot

- name: Push tag
shell: "bash"
run: git tag ${{ steps.get-version.outputs.VERSION }} && git push --tags
run: git tag ${{ steps.get-version.outputs.VERSION }} && git push --tags
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/.idea
/target
/sounds
**/.idea
bot/sounds
.env
Loading
Loading