Skip to content
Open
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
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
work
.git
.env
*.log
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PORT=3000
HOST=0.0.0.0
DOCKER_RUNTIME=runc
PRINT_VM_LOG=0
15 changes: 0 additions & 15 deletions .eslintrc.json

This file was deleted.

30 changes: 17 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
name: Test

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Enable Docker IPv6
run: |
echo '{ "ipv6": true }' | sudo tee -a /etc/docker/daemon.json
sudo systemctl reload docker
- name: Install required operating system packages

- name: Install required OS packages
run: sudo apt-get install -y build-essential moreutils zstd
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
with:
version: latest

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Pull required docker images
run: docker pull eu.gcr.io/moocfi-public/tmc-sandbox-tmc-langs-rust

- name: Run tests
run: npm test
run: pnpm test
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
node_modules
dist
uploads
work
.eslintcache
node_modules/
dist/
work/
.DS_Store
*.log
.env
.env.local
coverage/
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm exec lint-staged
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.15.0
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.15.0
5 changes: 5 additions & 0 deletions .oxfmt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"indent_width": 2,
"use_tabs": false,
"max_line_length": 120
}
88 changes: 88 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["eslint", "typescript", "unicorn", "oxc", "import", "promise", "vitest"],
"options": {
"typeAware": true
},
"categories": {
"correctness": "error",
"suspicious": "error",
"perf": "warn"
},
"rules": {
"no-console": "error",
"curly": ["error", "all"],
"eqeqeq": ["error", "always"],
"no-var": "error",
"prefer-const": "error",
"no-shadow": "error",
"radix": "error",
"require-await": "error",
"no-promise-executor-return": "error",
"no-implicit-coercion": "warn",
"no-else-return": "warn",
"no-param-reassign": ["warn", { "props": true }],

"promise/prefer-await-to-then": ["error", { "strict": true }],

"typescript/no-floating-promises": "error",
"typescript/no-misused-promises": "error",
"typescript/await-thenable": "error",

"typescript/no-explicit-any": "warn",
"typescript/consistent-type-imports": ["warn", { "prefer": "type-imports" }],
"typescript/no-unused-vars": "error",
"typescript/parameter-properties": "off",
"typescript/array-type": "off",
"typescript/no-inferrable-types": "off",

"import/no-duplicates": "error",

"unicorn/prefer-node-protocol": "error",
"unicorn/catch-error-name": "error",
"unicorn/prefer-optional-catch-binding": "warn",
"unicorn/text-encoding-identifier-case": "warn",
"unicorn/no-useless-undefined": "warn",
"unicorn/numeric-separators-style": "warn",
"unicorn/no-await-expression-member": "warn",
"unicorn/prefer-ternary": "warn",
"unicorn/prefer-set-has": "warn",
"unicorn/custom-error-definition": "off",
"unicorn/prefer-import-meta-properties": "off",
"unicorn/no-null": "off",

"promise/param-names": "error",

"vitest/prefer-strict-equal": "warn",
"vitest/require-mock-type-parameters": "off",
"vitest/prefer-to-be-falsy": "off",
"vitest/prefer-to-be-truthy": "off",
"vitest/no-conditional-in-test": "off",
"vitest/prefer-spy-on": "off",
"vitest/no-importing-vitest-globals": "off",
"vitest/prefer-importing-vitest-globals":"off",
"vitest/prefer-expect-type-of": "off",
"vitest/prefer-describe-function-title": "off",
"vitest/no-hooks": "off",
"vitest/prefer-expect-assertions": "off",
"vitest/require-hook": "off",
"vitest/require-top-level-describe": "off",
"vitest/max-expects": "off",
"vitest/prefer-lowercase-title": "off",
"vitest/prefer-hooks-in-order": "off"
},
"overrides": [
{
"files": ["**/*.test.ts", "**/tests/**/*.ts"],
"rules": {
"no-console": "off",
"typescript/unbound-method": "off",
"typescript/no-unsafe-type-assertion": "off"
}
}
],
"env": {
"builtin": true,
"node": true
}
}
40 changes: 23 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
FROM node:11-alpine
FROM node:24.15.0-alpine AS builder

RUN apk --no-cache add bash

RUN apk --no-cache add \
bash \
g++ \
ca-certificates \
lz4-dev \
musl-dev \
cyrus-sasl-dev \
openssl-dev \
make \
python
RUN corepack enable && corepack prepare pnpm@latest --activate

COPY --chown=node package.json package-lock.json /app/
COPY --chown=node package.json pnpm-lock.yaml pnpm-workspace.yaml /app/

USER node
WORKDIR /app
RUN npm ci
RUN pnpm install --frozen-lockfile

COPY --chown=node . /app

ENV BASE_PATH /v2
RUN pnpm build
RUN pnpm prune --prod --ignore-scripts

RUN npm run build
FROM node:24.15.0-alpine

EXPOSE 3003
RUN apk --no-cache add bash

CMD [ "npm", "run", "start" ]
RUN corepack enable && corepack prepare pnpm@latest --activate

USER node
WORKDIR /app

COPY --from=builder --chown=node /app/package.json /app/pnpm-lock.yaml /app/
COPY --from=builder --chown=node /app/node_modules /app/node_modules
COPY --from=builder --chown=node /app/dist /app/dist
COPY --from=builder --chown=node /app/init /app/tmc-run /app/
RUN mkdir -p /app/work

EXPOSE 3000

CMD [ "node", "dist/index.js" ]
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

## Development environment

Requirements: Node and docker, tar, zstd, ts (from moreutils)
Requirements: pnpm (nodejs 22+), docker, tar, zstd, ts (from moreutils).

```bash
npm ci
npm run dev
pnpm install
export DOCKER_RUNTIME=runc
pnpm dev
```

`DOCKER_RUNTIME` is required. Use `runc` for the standard Docker runtime or `runsc` for gVisor.

If you wish to see the VM Log in the terminal, run:

```bash
Expand All @@ -18,5 +21,5 @@ export PRINT_VM_LOG=1
## Running tests

```bash
npm run test
pnpm test
```
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

Loading
Loading