Skip to content

Commit

Permalink
Merge branch 'master' into studio-aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
InfiniteStash committed Dec 9, 2024
2 parents 771686e + d7951da commit 89ccc33
Show file tree
Hide file tree
Showing 245 changed files with 51,070 additions and 22,693 deletions.
42 changes: 24 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ concurrency:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

services:
postgres:
image: postgres:16.1
image: postgres:17.1
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -33,40 +33,51 @@ jobs:
--health-retries 5
steps:

- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libvips-dev libhdf5-dev
version: 1.0

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x

- name: Install Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'

- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 9

- name: Cache node modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node_modules
with:
path: frontend/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('frontend/yarn.lock') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('frontend/pnpm-lock.yaml') }}

- name: Cache UI build
uses: actions/cache@v2
uses: actions/cache@v4
id: cache-ui
env:
cache-name: cache-ui
with:
path: frontend/build
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('frontend/yarn.lock', 'frontend/vite.config.js', 'frontend/src/**', 'graphql/**/*.graphql') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('frontend/pnpm-lock.yaml', 'frontend/vite.config.js', 'frontend/src/**', 'graphql/**/*.graphql') }}

- name: Cache go build
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-go-cache-2
with:
Expand All @@ -85,11 +96,6 @@ jobs:
git add --intent-to-add .
git diff --stat --exit-code
- name: Validate UI
# skip UI validation for pull requests if UI is unchanged
if: ${{ github.event_name != 'pull_request' || steps.cache-ui.outputs.cache-hit != 'true' }}
run: make ui-validate

- name: Build UI
# skip UI build for pull requests if UI is unchanged (UI was cached)
# this means that the build version/time may be incorrect if the UI is
Expand Down Expand Up @@ -169,7 +175,7 @@ jobs:

- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/frontend-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint (frontend)
on:
push:
pull_request:

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

jobs:
build:
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install PNPM
uses: pnpm/action-setup@v4
with:
version: 9

- name: Cache node packages
uses: actions/cache@v4
env:
cache-name: cache-node_modules
with:
path: frontend/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('frontend/pnpm-lock.yaml') }}

- name: Install node packages
run: make pre-ui

- name: Validate UI
run: make ui-validate
9 changes: 6 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ on:
jobs:
golangci:
name: lint
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
# Silence embed linting error
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libvips-dev
version: 1.0
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.x
go-version: 1.23.x
- run: mkdir frontend/build && touch frontend/build/dummy
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
run:
timeout: 3m
go: 1.22
go: 1.23

issues:
skip-files:
Expand Down
20 changes: 12 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
LDFLAGS := $(LDFLAGS)
export CGO_ENABLED = 0

.PHONY: \
stash-box \
Expand Down Expand Up @@ -58,7 +57,7 @@ generate-backend:
@ go generate

generate-ui:
cd frontend && yarn generate
cd frontend && pnpm generate

generate-dataloaders:
cd pkg/dataloader; \
Expand All @@ -75,6 +74,9 @@ generate-dataloaders:
go run github.com/vektah/dataloaden TagCategoryLoader github.com/gofrs/uuid.UUID "*github.com/stashapp/stash-box/pkg/models.TagCategory"; \
go run github.com/vektah/dataloaden SiteLoader github.com/gofrs/uuid.UUID "*github.com/stashapp/stash-box/pkg/models.Site"; \
go run github.com/vektah/dataloaden StudioLoader github.com/gofrs/uuid.UUID "*github.com/stashapp/stash-box/pkg/models.Studio"; \
go run github.com/vektah/dataloaden EditLoader github.com/gofrs/uuid.UUID "*github.com/stashapp/stash-box/pkg/models.Edit"; \
go run github.com/vektah/dataloaden EditCommentLoader github.com/gofrs/uuid.UUID "*github.com/stashapp/stash-box/pkg/models.EditComment"; \
go run github.com/vektah/dataloaden SceneLoader github.com/gofrs/uuid.UUID "*github.com/stashapp/stash-box/pkg/models.Scene"; \
go run github.com/vektah/dataloaden BoolsLoader github.com/gofrs/uuid.UUID "bool";

test:
Expand All @@ -94,33 +96,35 @@ lint:
golangci-lint run

pre-ui:
cd frontend && yarn install --frozen-lockfile
cd frontend && pnpm install

ui:
cd frontend && yarn build
cd frontend && pnpm build

ui-start:
cd frontend && yarn start
cd frontend && pnpm start

ui-fmt:
cd frontend && yarn format
cd frontend && pnpm format

# runs tests and checks on the UI and builds it
ui-validate:
cd frontend && yarn run validate
cd frontend && pnpm run validate

# cross-compile- targets should be run within the compiler docker container
cross-compile-windows: export GOOS := windows
cross-compile-windows: export GOARCH := amd64
cross-compile-windows: export CC := x86_64-w64-mingw32-gcc
cross-compile-windows: export CXX := x86_64-w64-mingw32-g++
cross-compile-windows: export CGO_ENABLED = 0
cross-compile-windows: OUTPUT := -o dist/stash-box-windows.exe
cross-compile-windows: build-release-static

cross-compile-linux: export GOOS := linux
cross-compile-linux: export GOARCH := amd64
cross-compile-linux: OUTPUT := -o dist/stash-box-linux
cross-compile-linux: build-release-static
cross-compile-linux: export CGO_ENABLED = 1
cross-compile-linux: build

cross-compile:
make cross-compile-windows
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ If you already have PostgreSQL installed, you can install stash-box on its own f

Stash-box supports macOS, Windows, and Linux. Releases for Windows and Linux can be found [here](https://github.com/stashapp/stash-box/releases).

## Prerequisites
To build stash-box on linux [libvips](https://www.libvips.org/) must be installed, as well as gcc.

## Initial setup

1. Run `make` to build the application.
Expand Down Expand Up @@ -76,6 +79,7 @@ There are two ways to authenticate a user in Stash-box: a session or an API key.
| `voting_period` | `345600` | Time, in seconds, before a voting period is closed. |
| `min_destructive_voting_period` | `172800` | Minimum time, in seconds, that needs to pass before a destructive edit can be immediately applied with sufficient positive votes. |
| `vote_cron_interval` | `5m` | Time between runs to close edits whose voting periods have ended. |
| `edit_update_limit` | `1` | Number of times an edit can be updated by the creator. |
| `email_host` | (none) | Address of the SMTP server. Required to send emails for activation and recovery purposes. |
| `email_port` | `25` | Port of the SMTP server. Only STARTTLS is supported. Direct TLS connections are not supported. |
| `email_user` | (none) | Username for the SMTP server. Optional. |
Expand All @@ -84,9 +88,9 @@ There are two ways to authenticate a user in Stash-box: a session or an API key.
| `host_url` | (none) | Base URL for the server. Used when sending emails. Should be in the form of `https://hostname.com`. |
| `image_location` | (none) | Path to store images, for local image storage. An error will be displayed if this is not set when creating non-URL images. |
| `image_backend` | (`file`) | Storage solution for images. Can be set to either `file` or `s3`. |
| `image_max_size` | (none) | Max size of image, if no size is specified. Omit to return full size. |
| `userLogFile` | (none) | Path to the user log file, which logs user operations. If not set, then these will be output to stderr. |
| `s3.endpoint` | (none) | Hostname to s3 endpoint used for image storage. |
| `s3.base_url` | (none) | Base URL to access images in S3. Should be in the form of `https://hostname.com`. |
| `s3.bucket` | (none) | Name of S3 bucket used to store images. |
| `s3.access_key` | (none) | Access key used for authentication. |
| `s3.secret ` | (none) | Secret Access key used for authentication. |
Expand All @@ -99,6 +103,7 @@ There are two ways to authenticate a user in Stash-box: a session or an API key.
| `postgres.max_open_conns` | (0) | Maximum number of concurrent open connections to the database. |
| `postgres.max_idle_conns` | (0) | Maximum number of concurrent idle database connections. |
| `postgres.conn_max_lifetime` | (0) | Maximum lifetime in minutes before a connection is released. |
| `require_scene_draft` | false | Whether to allow scene creation outside of draft submissions. |

## SSL (HTTPS)

Expand All @@ -125,11 +130,11 @@ Suppose you install the extension after you've run the migrations. In that case,

## Install

* [Go](https://golang.org/dl/), minimum version 1.17.
* [Go](https://golang.org/dl/), minimum version 1.22.
* [golangci-lint](https://golangci-lint.run/) - Linter aggregator
* Follow instructions for your platform from [https://golangci-lint.run/usage/install/](https://golangci-lint.run/usage/install/).
* Run the linters with `make lint`.
* [Yarn](https://yarnpkg.com/en/docs/install) - Yarn package manager
* [PNPM](https://pnpm.io/installation) - PNPM package manager

## Commands

Expand All @@ -146,7 +151,7 @@ Suppose you install the extension after you've run the migrations. In that case,

## Frontend development

To run the frontend in development mode, run `yarn start` from the frontend directory.
To run the frontend in development mode, run `pnpm start` from the frontend directory.

When developing, the API key can be set in `frontend/.env.development.local` to avoid having to log in.
When `is_production` is enabled on the server, this is the only way to authorize in the frontend development environment. If the server uses https or runs on a custom port, this also needs to be configured in `.env.development.local`.
Expand Down
60 changes: 0 additions & 60 deletions frontend/.eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
22
Loading

0 comments on commit 89ccc33

Please sign in to comment.