Skip to content

Commit

Permalink
Add CI config (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
imxeno authored May 18, 2024
1 parent 532299e commit b00cdd1
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 16 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build
biome:
runs-on: ubuntu-latest

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

- name: Set up Node.js
uses: actions/setup-node@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run biome
run: pnpm lint
6 changes: 2 additions & 4 deletions apps/bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"scripts": {
"build": "tsc",
"dev": "nodemon -e js,mjs,cjs,ts,mts,cts,json --ignore dist --exec 'rimraf dist && tsc && node dist/main.js'",
"format": "biome check . ./src",
"format:fix": "biome format --write ./src",
"lint": "biome lint ./src",
"lint:fix": "biome lint --apply ./src",
"lint": "biome check ./src",
"lint:fix": "biome check --apply ./src",
"start": "node dist/main.js"
},
"keywords": [],
Expand Down
6 changes: 3 additions & 3 deletions apps/bot/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import "@sapphire/plugin-logger/register";
import "@sapphire/plugin-subcommands/register";

import { container, SapphireClient } from "@sapphire/framework";
import { getRootData } from "@sapphire/pieces";
import { join } from "node:path";
import { PrismaClient } from "@mist/database";
import { SapphireClient, container } from "@sapphire/framework";
import { getRootData } from "@sapphire/pieces";
import { IntentsBitField } from "discord.js";
import { join } from "node:path";

declare module "@sapphire/pieces" {
interface Container {
Expand Down
2 changes: 1 addition & 1 deletion apps/bot/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { container } from "@sapphire/pieces";
import * as dotenv from "dotenv";
import { z } from "zod";
import { coerceBooleanSchema, coerceableTrue } from "./utils/schemas.js";
import { container } from "@sapphire/pieces";

dotenv.config({ path: [".env", "../../.env"] });

Expand Down
4 changes: 2 additions & 2 deletions apps/bot/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from "./env.js";
import { MistSapphireClient } from "./client.js";
import { ApplicationCommandRegistries } from "@sapphire/framework";
import { MistSapphireClient } from "./client.js";
import { env } from "./env.js";

ApplicationCommandRegistries.setDefaultGuildIds(["889120629763235850"]);

Expand Down
2 changes: 1 addition & 1 deletion apps/bot/src/modules/boards/commands/board-debug.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Command, CommandOptionsRunTypeEnum } from "@sapphire/framework";
import { TagBitsetOption, getBoardChannelConfig } from "../functions/config.js";
import { PermissionFlagsBits } from "discord.js";
import { TagBitsetOption, getBoardChannelConfig } from "../functions/config.js";

export class BoardDebugCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
Expand Down
2 changes: 1 addition & 1 deletion apps/bot/src/modules/boards/listeners/thread-update.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BoardTagConfig } from "@mist/database";
import { Listener } from "@sapphire/framework";
import { type AnyThreadChannel, ChannelType } from "discord.js";
import { assert } from "../../../utils/assert.js";
import { TagBitsetOption, getBoardChannelConfig } from "../functions/config.js";
import { BoardTagConfig } from "@mist/database";

export class BoardsThreadUpdateListener extends Listener<"threadUpdate"> {
public constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Command, CommandOptionsRunTypeEnum, none } from "@sapphire/framework";
import { PermissionFlagsBits } from "discord.js";
import { getManagedRolesConfig } from "../functions/config.js";
import { assert } from "../../../utils/assert.js";
import { localizedReply } from "../../../utils/localized-reply.js";
import { getManagedRolesConfig } from "../functions/config.js";

/**
* This doesn't extend Subcommand because most logic is shared.
Expand Down
2 changes: 1 addition & 1 deletion apps/bot/src/modules/tickets/commands/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { type Command, CommandOptionsRunTypeEnum } from "@sapphire/framework";
import { Subcommand } from "@sapphire/plugin-subcommands";
import type { GuildChannel, Options, TextChannel } from "discord.js";
import { assert } from "../../../utils/assert.js";
import { getTicketsConfig } from "../functions/config.js";
import { localizedReply } from "../../../utils/localized-reply.js";
import { getTicketsConfig } from "../functions/config.js";

export class TicketCommand extends Subcommand {
constructor(context: Subcommand.LoaderContext, options: Options) {
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"scripts": {
"build": "turbo build",
"dev": "turbo dev",
"format": "turbo format",
"format:fix": "turbo format:fix",
"lint": "turbo lint",
"lint:fix": "turbo lint:fix"
},
Expand Down

0 comments on commit b00cdd1

Please sign in to comment.