diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b0f9300 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI +run-name: Running continuous integration on ${{ github.actor }}'s commits + +on: + push: + branches: + - main + pull_request: + +jobs: + backend-ci: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Java + uses: actions/setup-java@v5 + with: + distribution: "temurin" + java-version: "25" + + frontend-ci: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up node + uses: actions/setup-node@v6 + with: + node-version: "24" diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..109ff6e --- /dev/null +++ b/Justfile @@ -0,0 +1,75 @@ +set shell := ["bash", "-uc"] + +# Migrate to local DB +migrate *args: + dotenvx run -- ./mvnw flyway:migrate -Dflyway.locations=filesystem:./db {{args}} + +# Drop local DB +drop *args: + dotenvx run -- ./mvnw flyway:clean -Dflyway.locations=filesystem:./db -Dflyway.cleanDisabled=false {{args}} + +# Run the backend Spring server +backend-dev *args: + dotenvx run -f .env -- ./mvnw -Dspring-boot.run.profiles=dev spring-boot:run {{args}} + +# Run the backend Spring server with an exposed debugger at :5005 +backend-dev-debug *args: + dotenvx run -- ./mvnw \ + -Dspring-boot.run.profiles=dev \ + -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005" \ + spring-boot:run {{args}} + +# Builds and installs Spring backend +backend-install *args: + ./mvnw install -DskipTests=true {{args}} + +# Run backend formatter (check only) +backend-spotless *args: + ./mvnw spotless:check + +# Run backend formatter (check & write) +backend-spotless-fix *args: + ./mvnw spotless:apply + +# Run backend linter, formatter, & tests +backend-test *args: + just backend-spotless && dotenvx run -f .env -- ./mvnw checkstyle:check verify -Dspring.profiles.active=ci {{args}} + +# Run backend tests with a debugger +backend-testd *args: + just backend-spotless && dotenvx run -f .env -- ./mvnw checkstyle:check verify -Dspring.profiles.active=ci -Dmaven.surefire.debug {{args}} + +# Run the frontend +frontend-dev *args: + cd js && pnpm i && pnpm run dev {{args}} + +# Builds and installs frontend packages +frontend-install *args: + cd js && pnpm i + +# Frontend tests +frontend-test *args: + cd js && pnpm run test + +## Generate types through OpenAPI +#type-gen *args: +# cd js && pnpm run generate {{args}} +# +## Run the react-email development server +#email-dev *args: +# cd email && pnpm i && pnpm email dev --dir emails {{args}} +# +## Generate HTML output of react-email and copy to backend static folder +#email-gen *args: +# cd email && bash email.sh {{args}} + +# Run the dev servers (backend & frontend) +dev *args: + #cp internal/pre-commit .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit && + npx concurrently "just backend-dev" "just frontend-dev" {{args}} + +# Run the dev servers (backend & frontend) but the backend will launch a debugger server. +devd *args: + npx concurrently "just backend-dev-debug" "just frontend-dev" {{args}} + +