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
59 changes: 49 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- opened
- synchronize
- reopened
workflow_dispatch:

defaults:
run:
Expand All @@ -17,13 +18,26 @@ env:
CACHE_NUMBER: 1

jobs:
unit-test-frontend:
name: Frontend linting / unit tests
frontend-readiness:
name: Frontend linting / readiness checks
# Defines the type of runner the job runs on
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout to the repository
uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-dev.yml') }}
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v2.2.0
with:
environment-file: environment-dev.yml
activate-environment: galaxy
use-only-tar-bz2: true
- name: Set up NodeJS environment
uses: actions/setup-node@v3
with:
Expand All @@ -43,23 +57,27 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install package dependencies
run: npm install
run: npm ci
working-directory: ./frontend
- name: Check linting and formatting
# Custom script for checking the linting and formatting being in place
run: npm run lint
working-directory: ./frontend
# Run test cases and this could ensure minimum coverage as well if set
# This section should be un-commented when our frontend implements unit testing
# - name: Execute test cases
# run: npm run test
# working-directory: ./frontend
- name: Check TypeScript types
run: npx tsc --noEmit
working-directory: ./frontend
- name: Verify generated types are up-to-date
run: |
# Run the type generation script (conda environment 'galaxy' is already activated)
./generate_types.sh
# Check if any files were modified
git diff --exit-code src/api/_autogen/ || (echo "ERROR: Generated TypeScript types are out of date. Please run ./generate_types.sh and commit the changes." && exit 1)
working-directory: ./frontend
lint:
name: Linter (pre-commit)
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout branch
uses: actions/checkout@v3.1.0
Expand All @@ -72,7 +90,28 @@ jobs:
uses: conda-incubator/setup-miniconda@v2.2.0
with:
environment-file: environment-dev.yml
activate-environment: galaxy
use-only-tar-bz2: true
- name: Set up NodeJS environment
uses: actions/setup-node@v3
with:
node-version: '20.12.2'
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install frontend dependencies for pre-commit
run: npm ci
working-directory: ./frontend
- name: Run linter
run: |
pre-commit install
Expand All @@ -82,7 +121,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout branch
uses: actions/checkout@v3.1.0
Expand All @@ -95,6 +133,7 @@ jobs:
uses: conda-incubator/setup-miniconda@v2.2.0
with:
environment-file: environment-dev.yml
activate-environment: galaxy
use-only-tar-bz2: true
- name: Initialize migrations
run: ./manage.py makemigrations
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,17 @@ repos:
require_serial: true
types_or: [python, pyi]
exclude: ^backend/.*/migrations

- id: tsc-frontend
name: tsc-frontend
entry: bash -c 'cd frontend && npx --no-install tsc --noEmit'
language: system
files: ^frontend/src/.*\.(ts|tsx)$
pass_filenames: false

- id: eslint-frontend
name: eslint-frontend
entry: bash -c 'cd frontend && npx --no-install eslint'
language: system
files: ^frontend/src/.*\.(ts|tsx)$
pass_filenames: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 MIT Battlecode
Copyright (c) 2025 MIT Battlecode

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ dependencies:
- google-cloud-storage=2.5.0
- isort=5.10.1
- mypy=0.942
- nodejs=18.11.0
- nodejs=20
- openjdk=11
- openssl=3.0.5
- openssl>=3.0.15
- pillow=9.0.1
- pip=22.3
- pre_commit=2.20.0
Expand Down
8 changes: 7 additions & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import eslint from "vite-plugin-eslint";
// https://vitejs.dev/config/
export default defineConfig({
base: "/",
plugins: [react(), svgr(), tsconfigPaths(), eslint()],
plugins: [
react(),
svgr(),
tsconfigPaths(),
// Show ESLint warnings/errors in overlay without blocking interaction
eslint({ failOnError: false, failOnWarning: false }),
],
server: {
port: 3000,
open: true,
Expand Down
Loading