diff --git a/.github/workflows/on_commit_build.yml b/.github/workflows/on_commit_build.yml index 59f3dd34..4393f9d2 100644 --- a/.github/workflows/on_commit_build.yml +++ b/.github/workflows/on_commit_build.yml @@ -64,7 +64,8 @@ jobs: uses: tj-actions/changed-files@v34 with: files: | - front-end/** + back-end/api/** + bacl-end/realtime/** lib/** - name: Use Node.js 18.x @@ -91,4 +92,49 @@ jobs: - name: Build backend if: steps.changed.outputs.any_changed == 'true' run: | - npm run build:backend \ No newline at end of file + npm run build:backend + + build-frc-fms: + name: Build FRC FMS + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Detect changes + id: changed + uses: tj-actions/changed-files@v34 + with: + files: | + back-end/frc-fms/** + lib/** + + - name: Use Node.js 18.x + if: steps.changed.outputs.any_changed == 'true' + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: Install lib dependencies + if: steps.changed.outputs.any_changed == 'true' + run: | + npm run install:lib + + - name: Build libs + if: steps.changed.outputs.any_changed == 'true' + run: | + npm run build:lib + + - name: Install backend dependencies + if: steps.changed.outputs.any_changed == 'true' + run: | + cd back-end/frc-fms + npm i + + - name: Build backend + if: steps.changed.outputs.any_changed == 'true' + run: | + cd back-end/frc-fms + npm run build \ No newline at end of file diff --git a/back-end/frc-fms/src/devices/plc.ts b/back-end/frc-fms/src/devices/plc.ts index 0997085c..dd9fb970 100644 --- a/back-end/frc-fms/src/devices/plc.ts +++ b/back-end/frc-fms/src/devices/plc.ts @@ -2,7 +2,7 @@ import log from "../logger.js"; import { PlcInputs } from "../models/PlcInputs.js"; import PlcOutputCoils, { EStop, RobotStatus, StackLight } from "../models/PlcOutputCoils.js"; import { EmsFrcFms } from "../server.js"; -import { MatchMode, MatchSocketEvents } from "@toa-lib/models"; +import { MatchMode, MatchSocketEvent } from "@toa-lib/models"; import ModbusRTU from "modbus-serial"; import { Socket } from "socket.io-client"; import { sleep } from "../helpers/generic.js"; @@ -137,7 +137,7 @@ export class PlcSupport { // Field E-STOP if (this.plc.inputs.fieldEstop) { - SocketSupport.getInstance().socket?.emit(MatchSocketEvents.ABORT); + SocketSupport.getInstance().socket?.emit(MatchSocketEvent.ABORT); logger.info("🛑 Field E-STOP Pressed! This can't be good!"); } else if (!this.plc.inputs.fieldEstop && this.plc.oldInputs.fieldEstop) { logger.info("🟢 Field E-STOP Released!"); diff --git a/back-end/frc-fms/src/devices/socket.ts b/back-end/frc-fms/src/devices/socket.ts index e5f74689..85d195b5 100644 --- a/back-end/frc-fms/src/devices/socket.ts +++ b/back-end/frc-fms/src/devices/socket.ts @@ -3,7 +3,7 @@ import { Socket } from "socket.io-client"; import { SocketOptions, createSocket } from "@toa-lib/client"; import { getToken } from "../helpers/ems.js"; import { getIPv4 } from "@toa-lib/server"; -import { AvaliableHardware, DriverstationMonitor, DriverstationStatus, MatchKey, MatchSocketEvents, PrestartState, PrestartStatus } from "@toa-lib/models"; +import { AvaliableHardware, DriverstationMonitor, DriverstationStatus, MatchKey, MatchSocketEvent, PrestartState, PrestartStatus } from "@toa-lib/models"; import { SettingsSupport } from "./settings.js"; import { EmsFrcFms } from "../server.js"; @@ -56,7 +56,7 @@ export class SocketSupport { }); // Setup Prestart - this.socket?.on(MatchSocketEvents.PRESTART, (matchKey: MatchKey) => { + this.socket?.on(MatchSocketEvent.PRESTART, (matchKey: MatchKey) => { this.prestartStatus = { hardware: [], matchKey: matchKey,