From 944ee14b3661f4923977f1f8e3c6304a219fcb42 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Thu, 13 Aug 2026 09:36:56 +0700 Subject: [PATCH] chore: merge the 2016 and 2017 lookups into one repository and one Pages site Each year keeps its full pipeline under its directory; vite bases move to /thptqg// (2017 keeps its old and old2 generations), one deploy workflow builds both years' databases and bundles behind a root index. --- .../workflows/deploy-pages.yml | 54 +++++++++----- 2016/.github/workflows/deploy.yml | 70 ------------------- 2016/README.md | 2 +- 2016/vite.config.js | 2 +- 2017/vite.config.js | 6 +- README.md | 19 +++++ index.html | 26 +++++++ 7 files changed, 85 insertions(+), 94 deletions(-) rename 2017/.github/workflows/deploy.yml => .github/workflows/deploy-pages.yml (53%) delete mode 100644 2016/.github/workflows/deploy.yml create mode 100644 README.md create mode 100644 index.html diff --git a/2017/.github/workflows/deploy.yml b/.github/workflows/deploy-pages.yml similarity index 53% rename from 2017/.github/workflows/deploy.yml rename to .github/workflows/deploy-pages.yml index 5f7849f..f37762e 100644 --- a/2017/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-pages.yml @@ -24,45 +24,61 @@ jobs: - uses: Swatinem/rust-cache@v2 with: - workspaces: tools/xlsxread + workspaces: | + 2016/tools/xlsxread + 2017/tools/xlsxread - uses: pnpm/action-setup@v4 + with: + package_json_file: 2017/package.json - uses: actions/setup-node@v4 with: node-version: '24' cache: 'pnpm' + cache-dependency-path: | + 2016/pnpm-lock.yaml + 2017/pnpm-lock.yaml - - name: Build xlsxread binary - run: cargo build --release --manifest-path tools/xlsxread/Cargo.toml - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build all databases + - name: Build 2016 site + working-directory: '2016' run: | + set -euo pipefail + cargo build --release --manifest-path tools/xlsxread/Cargo.toml + ./tools/xlsxread/target/release/xlsxread build \ + --schema tools/xlsxread/configs/thptqg2016-data.toml \ + --input data --output public/thptqg2016.db + pnpm install --frozen-lockfile + gzip -k -9 public/thptqg2016.db + pnpm build + rm -f dist/thptqg2016.db + + - name: Build 2017 site variants + working-directory: '2017' + run: | + set -euo pipefail + cargo build --release --manifest-path tools/xlsxread/Cargo.toml ./tools/xlsxread/target/release/xlsxread build --schema tools/xlsxread/configs/thptqg2017-data.toml --input data --output public/thptqg2017.db ./tools/xlsxread/target/release/xlsxread build --schema tools/xlsxread/configs/thptqg2017-data-old.toml --input data-old --output public-old/thptqg2017.db ./tools/xlsxread/target/release/xlsxread build --schema tools/xlsxread/configs/thptqg2017-data-old2.toml --input data-old2 --output public-old2/thptqg2017.db - - - name: Compress databases - run: | + pnpm install --frozen-lockfile gzip -kf -9 public/thptqg2017.db gzip -kf -9 public-old/thptqg2017.db gzip -kf -9 public-old2/thptqg2017.db + pnpm build:all + rm -f dist/thptqg2017.db dist/old/thptqg2017.db dist/old2/thptqg2017.db - - name: Build all site variants - run: pnpm build:all - - - name: Drop uncompressed DB files from dist + - name: Assemble site run: | - rm -f dist/thptqg2017.db - rm -f dist/old/thptqg2017.db - rm -f dist/old2/thptqg2017.db + set -euo pipefail + mkdir -p _site + cp index.html _site/ + cp -r 2016/dist _site/2016 + cp -r 2017/dist _site/2017 - uses: actions/upload-pages-artifact@v3 with: - path: dist + path: _site deploy: needs: build diff --git a/2016/.github/workflows/deploy.yml b/2016/.github/workflows/deploy.yml deleted file mode 100644 index 9d9fb6d..0000000 --- a/2016/.github/workflows/deploy.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Deploy to GitHub Pages - -on: - push: - branches: [main] - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -concurrency: - group: pages - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - with: - workspaces: tools/xlsxread - - - name: Build xlsxread binary - run: cargo build --release --manifest-path tools/xlsxread/Cargo.toml - - - name: Build database - run: > - ./tools/xlsxread/target/release/xlsxread build - --schema tools/xlsxread/configs/thptqg2016-data.toml - --input data - --output public/thptqg2016.db - - - uses: pnpm/action-setup@v4 - - - uses: actions/setup-node@v4 - with: - node-version: '24' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Compress database - run: gzip -k -9 public/thptqg2016.db - - - name: Build site - run: pnpm build - - - name: Remove uncompressed db from dist - run: rm -f dist/thptqg2016.db - - - uses: actions/upload-pages-artifact@v3 - with: - path: dist - - deploy: - needs: build - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - id: deployment - uses: actions/deploy-pages@v4 diff --git a/2016/README.md b/2016/README.md index 7ba96f6..a086341 100644 --- a/2016/README.md +++ b/2016/README.md @@ -14,7 +14,7 @@ Fully static app running entirely in the browser (SQLite via `sql.js`). No backe ## Demo - + ## Development diff --git a/2016/vite.config.js b/2016/vite.config.js index 6a08b20..e6ac920 100644 --- a/2016/vite.config.js +++ b/2016/vite.config.js @@ -3,5 +3,5 @@ import react from "@vitejs/plugin-react"; export default defineConfig({ plugins: [react()], - base: "/thptqg2016/", + base: "/thptqg/2016/", }); diff --git a/2017/vite.config.js b/2017/vite.config.js index 8ba7a53..87e0811 100644 --- a/2017/vite.config.js +++ b/2017/vite.config.js @@ -7,9 +7,9 @@ import react from "@vitejs/plugin-react"; // old2 → at /thptqg2017/old2/ using public-old2/ const VARIANT = process.env.VARIANT || ""; const VARIANT_CONFIG = { - "": { base: "/thptqg2017/", publicDir: "public", outDir: "dist" }, - old: { base: "/thptqg2017/old/", publicDir: "public-old", outDir: "dist/old" }, - old2: { base: "/thptqg2017/old2/", publicDir: "public-old2", outDir: "dist/old2" }, + "": { base: "/thptqg/2017/", publicDir: "public", outDir: "dist" }, + old: { base: "/thptqg/2017/old/", publicDir: "public-old", outDir: "dist/old" }, + old2: { base: "/thptqg/2017/old2/", publicDir: "public-old2", outDir: "dist/old2" }, }; const cfg = VARIANT_CONFIG[VARIANT]; if (!cfg) throw new Error(`Unknown VARIANT: ${VARIANT}`); diff --git a/README.md b/README.md new file mode 100644 index 0000000..a50ca4a --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# thptqg + +Tra cứu điểm thi THPT Quốc gia — exam-score lookup for Vietnam's national high +school graduation exam. Client-side SQL (sql.js) over a SQLite database built +from the ministry's raw `.xls` score files by the Rust `xlsxread` CLI. + +Served as one site at **[tiennm99.github.io/thptqg](https://tiennm99.github.io/thptqg/)**. + +| Directory | Year | Size | Site | +| --- | --- | --- | --- | +| [`2016/`](./2016/) | THPT QG 2016 — 877,461 candidates | ~50 MB raw data | [/2016/](https://tiennm99.github.io/thptqg/2016/) | +| [`2017/`](./2017/) | THPT QG 2017 — ~861,000 candidates | ~117 MB raw data | [/2017/](https://tiennm99.github.io/thptqg/2017/) (+ [old](https://tiennm99.github.io/thptqg/2017/old/), [old2](https://tiennm99.github.io/thptqg/2017/old2/) generations) | + +Each year was a standalone repository (`thptqg2016`, `thptqg2017`), merged here +with full history. Each keeps its own `tools/xlsxread` copy because the raw +data formats differ per year. + +The `Deploy to GitHub Pages` workflow builds both years' databases and site +bundles and publishes them behind a root index. diff --git a/index.html b/index.html new file mode 100644 index 0000000..adbaed1 --- /dev/null +++ b/index.html @@ -0,0 +1,26 @@ + + + + + + Tra cứu điểm thi THPT Quốc gia + + + +

Tra cứu điểm thi THPT Quốc gia

+

Tra cứu điểm thi tốt nghiệp THPT Quốc gia theo số báo danh — truy vấn SQL + chạy hoàn toàn trên trình duyệt (sql.js).

+ +

Phiên bản cũ của trang 2017: old · + old2

+ +