Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 20 deletions .githooks/commit-msg

This file was deleted.

26 changes: 13 additions & 13 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env bash
# some (*)nix distros dont have /bin/bash
#!/bin/sh
set -euo pipefail

echo "Frontend linting"
(cd vinvoor && pnpm --silent run precommit:lint)
if [ $? -ne 0 ]; then
echo "Frontend linting failed. Please fix the errors before committing."
exit 1
fi
if git diff --staged --name-only | grep -q "^vinvoor"; then
echo "Frontend linting"
if ! (cd vinvoor && pnpm --silent run precommit:lint); then
echo "Frontend linting failed. Please fix the errors before committing."
exit 1
fi

echo "Frontend typecheck"
(cd vinvoor && pnpm --silent run precommit:typecheck)
if [ $? -ne 0 ]; then
echo "Frontend type checking failed. Please fix the errors before committing."
exit 1
echo "Frontend typecheck"
if ! (cd vinvoor && pnpm --silent run precommit:typecheck); then
echo "Frontend type checking failed. Please fix the errors before committing."
exit 1
fi
fi
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Note: please review your commit messages and make sure each contains:
- The affected *scope* (e.g. vingo, vinvoor, vinscant, zess...)
- The *type* of changes made
- The specific *changes* made
See [the conventional commits standard](https://conventionalcommits.org) and/or [the gnu coding standards](https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html).
45 changes: 0 additions & 45 deletions .github/workflows/build.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/commit_message_check.yml

This file was deleted.

51 changes: 24 additions & 27 deletions .github/workflows/vingo.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
---
name: Vingo format and clipy check
name: "vingo: check style"

on:
push:
branches:
- main
paths:
- .github/workflows/vingo.yml
- 'vingo/**/*.rs'
- ".github/workflows/vingo.yml"
- "vingo/**"
pull_request:
paths:
- .github/workflows/vingo.yml
- 'vingo/**/*.rs'
- ".github/workflows/vingo.yml"
- "vingo/**"
workflow_dispatch:

jobs:

formatting:
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1.0.6
- uses: "actions/checkout@v4"

- uses: "actions-rs/toolchain@v1.0.6"
with:
toolchain: stable
components: rustfmt
toolchain: "stable"
components: "rustfmt"
override: true

- name: Check formatting
working-directory: vingo/
run: cargo fmt -- --check
- name: "cargo fmt"
working-directory: "vingo/"
run: "cargo fmt -- --check"

clipy:
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1.0.6
- uses: "actions/checkout@v4"

- uses: "actions-rs/toolchain@v1.0.6"
with:
toolchain: stable
components: clippy
toolchain: "stable"
components: "clippy"
override: true
- name: Clippy check
working-directory: vingo/
run: cargo clippy --locked --all-targets --all-features

- name: "cargo clippy"
working-directory: "vingo/"
run: "cargo clippy --locked --all-targets --all-features"
46 changes: 22 additions & 24 deletions .github/workflows/vinvoor.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
name: Vinvoor Format, Lint & Typecheck
name: "vinvoor: format, lint and typecheck"

on:
push:
branches:
- main
paths:
- ".github/workflows/vinvoor.yml"
- "vinvoor/**"
pull_request:
paths:
- ".github/workflows/vinvoor.yml"
- "vinvoor/**"
workflow_dispatch:

jobs:
format-and-lint:
runs-on: ubuntu-latest

format-lint-typecheck:
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
- uses: "actions/checkout@v4"
- uses: "actions/setup-node@v3"
with:
node-version: 22.8.0

- name: Install pnpm
run: npm install -g pnpm
node-version: "22.8.0"
- run: "npm install -g pnpm"

- name: Install dependencies
run: pnpm install
working-directory: vinvoor/
- run: "pnpm install"
working-directory: "vinvoor/"

- name: Run format & lint
run: pnpm eslint .
working-directory: vinvoor/
- name: "format and lint"
working-directory: "vinvoor/"
run: "pnpm eslint ."

- name: Run typecheck
run: pnpm tsc --noEmit
working-directory: vinvoor/
- name: "typecheck"
working-directory: "vinvoor/"
run: "pnpm tsc --noEmit"
50 changes: 50 additions & 0 deletions .github/workflows/zess_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "zess: docker build and (main only) push"

on:
push:
paths:
- ".github/workflows/zess_docker.yml"
- "vingo/**"
- "vinvoor/**"
- "Dockerfile"
pull_request:
paths:
- ".github/workflows/zess_docker.yml"
- "Dockerfile"
- "vingo/**"
- "vinvoor/**"
workflow_dispatch:

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

jobs:
build-and-push:
runs-on: "ubuntu-latest"
permissions:
contents: "read"
packages: "write"
steps:
- uses: "actions/checkout@v4"

- uses: "docker/setup-buildx-action@v3"

- name: "docker build"
run: "docker build . -t ghcr.io/zeuswpi/zess:pr-${{ github.sha }}"

- name: "docker login"
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"

- name: "docker tag latest"
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: "docker tag ghcr.io/zeuswpi/zess:pr-${{ github.sha }} ghcr.io/zeuswpi/zess:latest"

- name: "docker push latest"
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: "docker push --all-tags ghcr.io/zeuswpi/zess"
46 changes: 23 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# Build backend
FROM rust:1.81-alpine3.20 as build_backend

FROM docker.io/rust:1.81-alpine3.20 AS base-rust
RUN apk add upx musl-dev
RUN cargo install cargo-chef@0.1.72
WORKDIR /build

FROM docker.io/node:20.15.1-alpine3.20 AS base-node
RUN npm install -g pnpm
WORKDIR /build

WORKDIR /

COPY vingo/Cargo.* ./
FROM base-rust AS vingo-recipe

COPY vingo/migration migration/
COPY vingo/ ./
RUN cargo chef prepare --recipe-path=recipe.json

COPY vingo/src src/

FROM base-rust AS vingo-build

COPY --from=vingo-recipe /build/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path=recipe.json

COPY vingo/ ./
RUN cargo build --release

RUN upx --best --lzma target/release/vingo

# Build frontend
FROM node:20.15.1-alpine3.20 as build_frontend

WORKDIR /
FROM base-node AS vinvoor-build

RUN npm install -g pnpm
WORKDIR /build

COPY vinvoor/package.json package.json

COPY vinvoor/pnpm-lock.yaml pnpm-lock.yaml

RUN pnpm install
RUN pnpm i

COPY vinvoor/ ./

COPY vinvoor/production.env .env

RUN pnpm run build

# End container
FROM alpine:3.20

WORKDIR /
FROM alpine:3.20 AS runner

COPY --from=build_backend target/release/vingo .
COPY --from=build_frontend /dist public
WORKDIR /work
COPY --from=vingo-build /build/target/release/vingo vingo
COPY --from=vinvoor-build /build/dist/ public/

ENV DEVELOPMENT=FALSE

EXPOSE 4000

ENTRYPOINT ["./vingo"]
Loading