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
4 changes: 3 additions & 1 deletion .github/scripts/copy-prod-db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ async function main() {
};

console.log("Cleaning staging database...");
await $.env(flywayEnv)`./mvnw flyway:clean -Dflyway.cleanDisabled=false`;
await $.env(
flywayEnv,
)`./mvnw -B -ntp flyway:clean -Dflyway.cleanDisabled=false`;

console.log("Copying production database to staging...");
// extensions are provisioned by `platform-infra`,
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/redeploy/db/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export async function _migrateDb({
await $.env({
...migratorEnv,
DATABASE_NAME,
})`./mvnw flyway:migrate -Dflyway.locations=filesystem:./db/migration`;
})`./mvnw -B -ntp flyway:migrate -Dflyway.locations=filesystem:./db/migration`;
return "success";
}
4 changes: 2 additions & 2 deletions .github/scripts/test/run-backend-compile-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { $ } from "bun";

async function main() {
// fmt
await $`./mvnw spotless:check`;
await $`./mvnw -B -ntp spotless:check`;

// lint
await $`./mvnw checkstyle:check`;
await $`./mvnw -B -ntp checkstyle:check`;

// compile
await $`./mvnw -B verify -Dmaven.test.skip=true --no-transfer-progress`;
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/test/run-backend-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ async function main() {

await $`./mvnw -B install -D skipTests --no-transfer-progress`;

await $`./mvnw -B exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"`;
await $`./mvnw -B -ntp exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"`;

await $`cd email && pnpm i --frozen-lockfile && ./email.sh && cd ..`;

await $$`./mvnw clean verify -Dspring.profiles.active=ci`;
await $$`./mvnw -B -ntp clean verify -Dspring.profiles.active=ci`;

if (shouldUploadCoverage) {
const { sonarToken } = parseCiEnv(process.env);
Expand Down
8 changes: 7 additions & 1 deletion .github/scripts/utils/run-backend-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ async function start(env: Record<string, string>) {

const logFile = Bun.file("backend.log");
be = Bun.spawn(
["./mvnw", "-Dspring-boot.run.profiles=ci", "spring-boot:run"],
[
"./mvnw",
"-B",
"-ntp",
"-Dspring-boot.run.profiles=ci",
"spring-boot:run",
],
{
env: { ...process.env, ...env },
stdout: logFile,
Expand Down
4 changes: 3 additions & 1 deletion .github/scripts/utils/run-local-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ async function start() {

console.log("postres started, running migrations...");

await $.env(env)`./mvnw flyway:migrate -Dflyway.locations=filesystem:./db`;
await $.env(
env,
)`./mvnw -B -ntp flyway:migrate -Dflyway.locations=filesystem:./db`;

console.log("postgres ready");

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/validate-db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function main() {
await $.env({
...process.env,
...appEnv,
})`bash -c "./mvnw flyway:validate -Dflyway.locations=filesystem:./db/migration -Dflyway.ignoreMigrationPatterns='*:pending'"`;
})`bash -c "./mvnw -B -ntp flyway:validate -Dflyway.locations=filesystem:./db/migration -Dflyway.ignoreMigrationPatterns='*:pending'"`;
}

main()
Expand Down
2 changes: 1 addition & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ email-gen *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}}
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:
Expand Down
6 changes: 3 additions & 3 deletions infra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ WORKDIR /app
COPY mvnw pom.xml ./
COPY .mvn/ .mvn/

RUN ./mvnw dependency:resolve -B
RUN ./mvnw -B -ntp dependency:resolve

COPY src ./src
COPY --from=frontend-build /js/dist/ src/main/resources/static/
RUN mkdir -p src/main/resources/static/email && rm -f src/main/resources/static/email/*.html
COPY --from=email-build /email/out/*.html src/main/resources/static/email/

ARG COMMIT_SHA
RUN ./mvnw package -DskipTests -Dcommit.sha="${COMMIT_SHA}"
RUN ./mvnw -B -ntp package -DskipTests -Dcommit.sha="${COMMIT_SHA}"

FROM mirror.gcr.io/library/eclipse-temurin:25-jre-jammy

WORKDIR /app

COPY mvnw pom.xml ./
COPY .mvn/ .mvn/
RUN ./mvnw -B exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"
RUN ./mvnw -B -ntp exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"
COPY --from=backend-build /app/target/*.jar app.jar

ARG SERVER_PROFILES=prod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.achievements;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.time.OffsetDateTime;
import java.util.List;
Expand All @@ -14,6 +15,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class AchievementSqlRepository implements AchievementRepository {

private static final RowMapper<Achievement> ACHIEVEMENT_ROW_MAPPER = (rs, rowNum) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.announcement;

import io.micrometer.core.annotation.Timed;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.UUID;
Expand All @@ -9,6 +10,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class AnnouncementSqlRepository implements AnnouncementRepository {

private static final RowMapper<Announcement> ANNOUNCEMENT_ROW_MAPPER = (rs, rowNum) -> Announcement.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.api;

import io.micrometer.core.annotation.Timed;
import java.sql.Timestamp;
import java.util.List;
import java.util.Optional;
Expand All @@ -11,6 +12,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class ApiKeySqlRepository implements ApiKeyRepository {

private static final RowMapper<ApiKey> API_KEY_ROW_MAPPER = (rs, rowNum) -> ApiKey.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.api.access;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.util.ArrayList;
import java.util.UUID;
Expand All @@ -10,6 +11,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class ApiKeyAccessSqlRepository implements ApiKeyAccessRepository {

private static final RowMapper<ApiKeyAccess> API_KEY_ACCESS_ROW_MAPPER = (rs, rowNum) -> ApiKeyAccess.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.auth;

import io.micrometer.core.annotation.Timed;
import java.time.OffsetDateTime;
import java.util.UUID;
import org.patinanetwork.codebloom.common.db.models.auth.Auth;
Expand All @@ -9,6 +10,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class AuthSqlRepository implements AuthRepository {

private static final RowMapper<Auth> AUTH_ROW_MAPPER = (rs, rowNum) -> Auth.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.club;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.util.UUID;
import org.patinanetwork.codebloom.common.db.models.club.Club;
Expand All @@ -9,6 +10,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class ClubSqlRepository implements ClubRepository {

private static final RowMapper<Club> CLUB_ROW_MAPPER = (rs, rowNum) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.discord.club;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.time.OffsetDateTime;
import java.util.List;
Expand All @@ -14,6 +15,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class DiscordClubSqlRepository implements DiscordClubRepository {

private final DiscordClubMetadataSqlRepository discordClubMetadataSqlRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.discord.club.metadata;

import io.micrometer.core.annotation.Timed;
import java.util.Optional;
import java.util.UUID;
import org.patinanetwork.codebloom.common.db.models.discord.DiscordClubMetadata;
Expand All @@ -8,6 +9,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class DiscordClubMetadataSqlRepository implements DiscordClubMetadataRepository {

private static final RowMapper<DiscordClubMetadata> DISCORD_CLUB_METADATA_ROW_MAPPER = (rs, rowNum) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.feedback;

import io.micrometer.core.annotation.Timed;
import java.time.OffsetDateTime;
import java.util.Optional;
import java.util.UUID;
Expand All @@ -9,6 +10,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class FeedbackSqlRepository implements FeedbackRepository {

private static final RowMapper<Feedback> FEEDBACK_ROW_MAPPER = (rs, rowNum) -> Feedback.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.job;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.time.OffsetDateTime;
import java.util.List;
Expand All @@ -11,6 +12,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class JobSqlRepository implements JobRepository {

private static final RowMapper<Job> JOB_ROW_MAPPER = (rs, rowNum) -> Job.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.leaderboard;

import io.micrometer.core.annotation.Timed;
import java.sql.Array;
import java.sql.Connection;
import java.sql.SQLException;
Expand Down Expand Up @@ -27,6 +28,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class LeaderboardSqlRepository implements LeaderboardRepository {

private static final String SHOULD_EXPIRE_BY = "shouldExpireBy";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.lobby;

import io.micrometer.core.annotation.Timed;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Optional;
Expand All @@ -10,6 +11,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class LobbyQuestionSqlRepository implements LobbyQuestionRepository {

private static final RowMapper<LobbyQuestion> LOBBY_QUESTION_ROW_MAPPER = (rs, rowNum) -> LobbyQuestion.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.lobby;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.time.OffsetDateTime;
import java.util.List;
Expand All @@ -13,6 +14,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class LobbySqlRepository implements LobbyRepository {

private static final RowMapper<Lobby> LOBBY_ROW_MAPPER = (rs, rowNum) -> Lobby.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.lobby.player;

import io.micrometer.core.annotation.Timed;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
Expand All @@ -9,6 +10,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class LobbyPlayerSqlRepository implements LobbyPlayerRepository {

private static final RowMapper<LobbyPlayer> LOBBY_PLAYER_ROW_MAPPER = (rs, rowNum) -> LobbyPlayer.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.lobby.player.question;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.util.List;
import java.util.Optional;
Expand All @@ -10,6 +11,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class LobbyPlayerQuestionSqlRepository implements LobbyPlayerQuestionRepository {

private static final RowMapper<LobbyPlayerQuestion> LOBBY_PLAYER_QUESTION_ROW_MAPPER =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.potd;

import io.micrometer.core.annotation.Timed;
import java.util.ArrayList;
import java.util.Optional;
import java.util.UUID;
Expand All @@ -9,6 +10,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class POTDSqlRepository implements POTDRepository {

private static final RowMapper<POTD> POTD_ROW_MAPPER = (rs, rowNum) -> POTD.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.question;

import io.micrometer.core.annotation.Timed;
import java.sql.Array;
import java.sql.Connection;
import java.sql.ResultSet;
Expand All @@ -24,6 +25,7 @@
import org.springframework.stereotype.Component;

@Component
@Timed(value = "repository.execution")
public class QuestionSqlRepository implements QuestionRepository {

private final DataSource ds;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.patinanetwork.codebloom.common.db.repos.question.questionbank;

import io.micrometer.core.annotation.Timed;
import java.sql.Types;
import java.time.OffsetDateTime;
import java.util.List;
Expand All @@ -17,6 +18,7 @@
import org.springframework.transaction.annotation.Transactional;

@Component
@Timed(value = "repository.execution")
public class QuestionBankSqlRepository implements QuestionBankRepository {

private final JdbcClient jdbcClient;
Expand Down
Loading
Loading