Skip to content

Commit d21df4d

Browse files
authored
Scraper (#487)
<!--変更したい場合は、`/.github/pull_request_template.md` を修正して下さい。--> # PRの概要 closes #486 <!-- 変更の目的 もしくは 関連する Issue 番号 --> <!-- 以下のように書くと Issue にリンクでき、マージ時に自動で Issue を閉じられる--> <!-- closes #1 --> ## 具体的な変更内容 <!-- ビューの変更がある場合はスクショによる比較などがあるとわかりやすい --> 後期学部はカバー 大学院はカバーしていない ## 影響範囲 <!-- この関数を変更したのでこの機能にも影響がある、など --> ## 動作要件 <!-- 動作に必要な 環境変数 / 依存関係 / DBの更新 など --> ## 補足 <!-- レビューをする際に見てほしい点、ローカル環境で試す際の注意点、など --> ## レビューリクエストを出す前にチェック! - [ ] 改めてセルフレビューしたか - [ ] 手動での動作検証を行ったか - [ ] server の機能追加ならば、テストを書いたか - 理由: 書いた | server の機能追加ではない - [ ] 間違った使い方が存在するならば、それのドキュメントをコメントで書いたか - 理由: 書いた | 間違った使い方は存在しない - [ ] わかりやすいPRになっているか <!-- レビューリクエスト後は、Slackでもメンションしてお願いすることを推奨します。 -->
1 parent 6a4fe05 commit d21df4d

File tree

20 files changed

+2360
-15
lines changed

20 files changed

+2360
-15
lines changed

.cspell.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"qiita",
1616
"safify",
1717
"supabase",
18-
"swiper"
18+
"swiper",
19+
"reqwest",
20+
"chrono"
1921
],
2022
"dictionaries": [
2123
"softwareTerms",
@@ -31,6 +33,7 @@
3133
],
3234
"ignorePaths": [
3335
"flake.*",
36+
"nix/*",
3437
"**/.git/**",
3538
"**/node_modules/**",
3639
"server/target/**",
@@ -39,6 +42,9 @@
3942
"**/bun.lockb",
4043
"**/*.svg",
4144
"**/migration.sql",
42-
"**/data.json"
45+
"**/data.json",
46+
"**/Cargo.*",
47+
"scraper/target",
48+
"**/rust-toolchain.toml"
4349
]
4450
}

.github/workflows/rust.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Rust
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
all:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
env:
12+
RUSTFLAGS: -D warnings
13+
defaults:
14+
run:
15+
working-directory: scraper
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/cache@v4
19+
with:
20+
path: |
21+
~/.cargo/
22+
~/.rustup/
23+
scraper/target
24+
key: cargo-cache-${{ github.job }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
25+
- uses: actions-rust-lang/setup-rust-toolchain@v1
26+
with:
27+
components: clippy,rustfmt
28+
- run: cargo build
29+
- run: cargo build --release
30+
- run: cargo test
31+
- run: cargo clippy
32+
- run: cargo fmt --check

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"useIgnoreFile": true
1111
},
1212
"files": {
13-
"ignore": ["bun.lockb", "server/target", "data.json"]
13+
"ignore": ["bun.lockb", "server/target", "data.json", "scraper/target"]
1414
}
1515
}

flake.lock

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@
44
nixpkgs.url = "github:NixOS/nixpkgs/master";
55
flake-utils.url = "github:numtide/flake-utils";
66
prisma-utils.url = "github:VanCoding/nix-prisma-utils";
7+
fenix = {
8+
url = "github:nix-community/fenix/monthly";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
711
};
812

9-
outputs = { nixpkgs, flake-utils, prisma-utils, ... }:
13+
outputs = { nixpkgs, flake-utils, prisma-utils, fenix, ... }:
1014
flake-utils.lib.eachDefaultSystem (system:
1115
let
1216
pkgs = import nixpkgs { inherit system; };
13-
14-
prisma = (prisma-utils.lib.prisma-factory {
15-
nixpkgs = pkgs;
16-
prisma-fmt-hash = "sha256-atD5GZfmeU86mF1V6flAshxg4fFR2ews7EwaJWZZzbc="; # just copy these hashes for now, and then change them when nix complains about the mismatch
17-
query-engine-hash = "sha256-8FTZaKmQCf9lrDQvkF5yWPeZ7TSVfFjTbjdbWWEHgq4=";
18-
libquery-engine-hash = "sha256-USIdaum87ekGY6F6DaL/tKH0BAZvHBDK7zjmCLo//kM=";
19-
schema-engine-hash = "sha256-k5MkxXViEqojbkkcW/4iBFNdfhb9PlMEF1M2dyhfOok=";
20-
}).fromNpmLock
21-
./server/package-lock.json; # <--- path to our package-lock.json file that contains the version of prisma-engines
17+
prisma = import ./nix/prisma.nix { inherit prisma-utils pkgs; };
18+
rust-pkgs = import ./nix/rust-toolchain.nix { inherit fenix system; };
2219
in
2320
{
2421
devShell = pkgs.mkShell {
@@ -28,10 +25,14 @@
2825
gnumake
2926
bun
3027
biome
28+
pkg-config
29+
openssl
30+
] ++ [
31+
rust-pkgs
3132
];
3233
shellHook = ''
3334
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.stdenv.cc.cc.lib}/lib
34-
'' + (if pkgs.system == "x86_64-linux" then prisma.shellHook else "");
35+
'' + prisma.shellHook;
3536
};
3637
});
3738
}

nix/prisma.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ prisma-utils, pkgs }: rec {
2+
prisma = (prisma-utils.lib.prisma-factory {
3+
nixpkgs = pkgs;
4+
prisma-fmt-hash = "sha256-atD5GZfmeU86mF1V6flAshxg4fFR2ews7EwaJWZZzbc="; # just copy these hashes for now, and then change them when nix complains about the mismatch
5+
query-engine-hash = "sha256-8FTZaKmQCf9lrDQvkF5yWPeZ7TSVfFjTbjdbWWEHgq4=";
6+
libquery-engine-hash = "sha256-USIdaum87ekGY6F6DaL/tKH0BAZvHBDK7zjmCLo//kM=";
7+
schema-engine-hash = "sha256-k5MkxXViEqojbkkcW/4iBFNdfhb9PlMEF1M2dyhfOok=";
8+
}).fromNpmLock
9+
./../server/package-lock.json; # <--- path to our package-lock.json file that contains the version of prisma-engines
10+
11+
shellHook = (if pkgs.system == "x86_64-linux" then prisma.shellHook else "");
12+
}

nix/rust-toolchain.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{ fenix, system }:
2+
fenix.packages.${system}.fromToolchainFile {
3+
file = ../scraper/rust-toolchain.toml;
4+
sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk=";
5+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
"zod": "^3.23.8"
2323
},
2424
"lint-staged": {
25-
"*.{js,jsx,ts,tsx}": ["biome check --write"]
25+
"*.{js,jsx,ts,tsx,json}": ["biome check --write"]
2626
}
2727
}

scraper/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/target
2+
/data.json
3+
.cache
4+
/course-mate-scraper
5+

0 commit comments

Comments
 (0)