-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: バックエンドをHonoへ移行し、新たにruntimeを生成 (#70)
Co-authored-by: rai <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,226 additions
and
849 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: Runtime CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
changes: | ||
name: Changes | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
runtime: ${{ steps.changes.outputs.runtime }} | ||
workflows: ${{ steps.changes.outputs.workflows }} | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Check runtime files changed | ||
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
id: changes | ||
with: | ||
filters: | | ||
runtime: | ||
- 'runtime/**' | ||
workflows: | ||
- '.github/workflows/runtime-ci.yml' | ||
format: | ||
name: Format | ||
runs-on: ubuntu-24.04 | ||
needs: changes | ||
if: needs.changes.outputs.runtime == 'true' || needs.changes.outputs.workflows == 'true' | ||
defaults: | ||
run: | ||
working-directory: ./runtime | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Cache dependencies | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
- name: Install Rust toolchain | ||
run: rustup toolchain install stable | ||
- name: Install rustfmt | ||
run: rustup component add rustfmt | ||
- name: Check formatting | ||
run: cargo fmt --all -- --check | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-24.04 | ||
needs: changes | ||
if: needs.changes.outputs.runtime == 'true' || needs.changes.outputs.workflows == 'true' | ||
defaults: | ||
run: | ||
working-directory: ./runtime | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Cache dependencies | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
- name: Install Rust toolchain | ||
run: rustup toolchain install stable | ||
- name: Install clippy | ||
run: rustup component add clippy | ||
- name: Check linting | ||
run: cargo clippy -- -D warnings | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-24.04 | ||
needs: changes | ||
if: needs.changes.outputs.runtime == 'true' || needs.changes.outputs.workflows == 'true' | ||
defaults: | ||
run: | ||
working-directory: ./runtime | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Cache dependencies | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
- name: Install Rust toolchain | ||
run: rustup toolchain install stable | ||
- name: Build | ||
run: cargo build | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-24.04 | ||
needs: changes | ||
if: needs.changes.outputs.runtime == 'true' || needs.changes.outputs.workflows == 'true' | ||
defaults: | ||
run: | ||
working-directory: ./runtime | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Cache dependencies | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
- name: Install Rust toolchain | ||
run: rustup toolchain install stable | ||
- name: Test | ||
run: cargo test | ||
|
||
machete: | ||
name: Machete | ||
runs-on: ubuntu-24.04 | ||
needs: changes | ||
if: needs.changes.outputs.runtime == 'true' || needs.changes.outputs.workflows == 'true' | ||
defaults: | ||
run: | ||
working-directory: ./runtime | ||
steps: | ||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | ||
- name: Cache dependencies | ||
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | ||
- name: Install Rust toolchain | ||
run: rustup toolchain install stable | ||
- name: Install machete | ||
run: cargo install cargo-machete | ||
- name: Run machete | ||
run: cargo machete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
### rust ### | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
# dev | ||
.yarn/ | ||
!.yarn/releases | ||
.vscode/* | ||
!.vscode/launch.json | ||
!.vscode/*.code-snippets | ||
.idea/workspace.xml | ||
.idea/usage.statistics.xml | ||
.idea/shelf | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
# deps | ||
node_modules/ | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
# env | ||
.env | ||
.env.production | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
# logs | ||
logs/ | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
# misc | ||
.DS_Store |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,8 @@ | ||
# Program Grading System Backend | ||
|
||
## Development | ||
|
||
### Pre-requisites | ||
|
||
- [Rust](https://www.rust-lang.org) | ||
- [Node.js](https://nodejs.org) | ||
- [Bun](https://bun.sh/) | ||
|
||
### Commands | ||
|
||
#### 開発サーバーの起動 | ||
|
||
```sh | ||
bun run dev | ||
``` | ||
|
||
#### OpenAPIのスキーマと型定義の生成 | ||
|
||
```sh | ||
bun run generate | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
> [!important] | ||
> バックエンドのコードを変更した場合は、必ずOpenAPIのスキーマと型定義を生成し、変更を反映させてください。 | ||
#### ビルドの実行 | ||
|
||
```sh | ||
bun run build | ||
``` | ||
|
||
#### テストの実行 | ||
|
||
```sh | ||
bun run test | ||
open http://localhost:3000 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { build } from "esbuild" | ||
|
||
const b = () => | ||
build({ | ||
banner: { | ||
js: "#!/usr/bin/env node", | ||
}, | ||
bundle: true, | ||
entryPoints: ["./src/index.ts"], | ||
format: "cjs", | ||
// For debug | ||
minify: false, | ||
outfile: "bin", | ||
platform: "node", | ||
}) | ||
|
||
Promise.all([b()]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @ts-check | ||
import js from "@eslint/js" | ||
import gitignore from "eslint-config-flat-gitignore" | ||
import prettier from "eslint-config-prettier" | ||
import jsxA11y from "eslint-plugin-jsx-a11y" | ||
import perfectionist from "eslint-plugin-perfectionist" | ||
import globals from "globals" | ||
import tseslint from "typescript-eslint" | ||
|
||
export default tseslint.config( | ||
gitignore(), | ||
{ | ||
languageOptions: { | ||
globals: globals.browser, | ||
}, | ||
}, | ||
js.configs.recommended, | ||
...tseslint.configs.strict, | ||
...tseslint.configs.stylistic, | ||
perfectionist.configs["recommended-natural"], | ||
jsxA11y.flatConfigs.recommended, | ||
prettier, | ||
) |
Oops, something went wrong.