Skip to content

Commit c798138

Browse files
authored
Install course dependencies from manifest pins (#95)
* Use course manifest pins for installation and updates * Verify older project pins remain isolated from public latest
1 parent 2482ab3 commit c798138

14 files changed

Lines changed: 138 additions & 83 deletions

File tree

‎.github/workflows/fresh-install.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ jobs:
218218
include-hidden-files: true
219219

220220
released-course:
221-
name: Published d2x install route (main only)
222-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && inputs.candidate_run == ''
221+
name: d2x download and pinned install
222+
if: ${{ !inputs.diagnose && inputs.candidate_run == '' }}
223223
runs-on: ubuntu-24.04
224224
timeout-minutes: 60
225225
steps:
226226
- uses: actions/checkout@v4
227-
- name: Follow the README using the public course download
228-
run: python3 scripts/ci/readme.py --published
227+
- name: Verify the documented existing-d2x download route
228+
run: python3 scripts/ci/readme.py --d2x-download ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && '--published' || '' }}
229229
- uses: actions/upload-artifact@v4
230230
if: always()
231231
with:
@@ -265,7 +265,7 @@ jobs:
265265
include-hidden-files: true
266266

267267
latest-stable:
268-
if: github.ref == 'refs/heads/main' && inputs.candidate_run == ''
268+
if: ${{ !inputs.diagnose && inputs.candidate_run == '' }}
269269
runs-on: ${{ matrix.os }}
270270
strategy:
271271
fail-fast: false
@@ -280,7 +280,7 @@ jobs:
280280
if: runner.os == 'Windows'
281281
shell: powershell
282282
run: ./scripts/install-xlings.ps1
283-
- name: Check stable release, public latest and course pin
283+
- name: Check public latest and independently restore course pins
284284
shell: bash
285285
env:
286286
GH_TOKEN: ${{ github.token }}

‎.github/workflows/online-ebook.yml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ jobs:
4545
run:
4646
working-directory: book
4747

48-
env:
49-
MDBOOK_VERSION: 0.4.43
50-
5148
steps:
5249
- uses: actions/checkout@v4
5350

@@ -57,8 +54,8 @@ jobs:
5754
- name: Install the shared xlings baseline
5855
run: bash ../scripts/install-xlings.sh
5956

60-
- name: Install mdBook
61-
run: xlings install mdbook@${MDBOOK_VERSION} -y
57+
- name: Install the course dependencies from .xlings.json
58+
run: xlings install -y
6259

6360
- name: Setup Pages
6461
if: github.event_name != 'pull_request'

‎README.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,24 @@ Wait for the environment to be ready, then run `d2x checker` in the terminal.
4343

4444
### Practice locally
4545

46-
**1. Install the tools**
46+
**1. Get the course**
4747

48-
Install [xlings](docs/environment.md#install-xlings), reopen your terminal, then run:
48+
Install [xlings](docs/environment.md#install-xlings) and Git, then reopen your terminal.
4949

5050
```bash
51-
xlings update
52-
xlings install --use d2x@latest mcpp@latest -y
51+
git clone https://github.com/mcpp-community/d2mcpp.git
52+
cd d2mcpp
5353
```
5454

55-
**2. Get the course**
55+
**2. Install the course versions**
5656

5757
```bash
58-
d2x install d2mcpp
59-
cd d2mcpp
58+
xlings update
59+
xlings install -y
6060
```
6161

62+
Run these commands from the course directory. `xlings install` installs the versions declared in `.xlings.json`; after updating the course with Git, run the same two commands again.
63+
6264
**3. Verify and practice**
6365

6466
```bash

‎README.zh.hant.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,24 @@
4343

4444
### 建立本地練習環境
4545

46-
**第一步:安裝工具**
46+
**第一步:取得課程**
4747

48-
安裝 [xlings](docs/environment.zh.md#install-xlings),重新開啟終端後執行:
48+
安裝 [xlings](docs/environment.zh.md#install-xlings) 和 Git,然後重新開啟終端。
4949

5050
```bash
51-
xlings update
52-
xlings install --use d2x@latest mcpp@latest -y
51+
git clone https://github.com/mcpp-community/d2mcpp.git
52+
cd d2mcpp
5353
```
5454

55-
**第二步:取得課程**
55+
**第二步:安裝課程版本**
5656

5757
```bash
58-
d2x install d2mcpp
59-
cd d2mcpp
58+
xlings update
59+
xlings install -y
6060
```
6161

62+
在課程目錄執行上述命令。`xlings install` 安裝 `.xlings.json` 宣告的版本;透過 Git 更新課程後,再次執行這兩條命令。
63+
6264
**第三步:驗證並開始練習**
6365

6466
```bash

‎README.zh.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,24 @@
4343

4444
### 搭建本地练习环境
4545

46-
**第一步:安装工具**
46+
**第一步:获取课程**
4747

48-
安装 [xlings](docs/environment.zh.md#install-xlings),重新打开终端后执行:
48+
安装 [xlings](docs/environment.zh.md#install-xlings) 和 Git,然后重新打开终端。
4949

5050
```bash
51-
xlings update
52-
xlings install --use d2x@latest mcpp@latest -y
51+
git clone https://github.com/mcpp-community/d2mcpp.git
52+
cd d2mcpp
5353
```
5454

55-
**第二步:获取课程**
55+
**第二步:安装课程版本**
5656

5757
```bash
58-
d2x install d2mcpp
59-
cd d2mcpp
58+
xlings update
59+
xlings install -y
6060
```
6161

62+
在课程目录执行上述命令。`xlings install` 安装 `.xlings.json` 声明的版本;通过 Git 更新课程后,再次执行这两条命令。
63+
6264
**第三步:验证并开始练习**
6365

6466
```bash

‎book/en/src/base/chapter_1.md‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,18 @@ $env:Path = "$env:USERPROFILE\.xlings\subos\current\bin;$env:Path"
4040
The PATH command makes the installed tools available in this terminal. For future sessions, reopen your terminal after installation. Preparation can be repeated and preserves your exercise files and progress.
4141

4242
<details>
43-
<summary>Alternative: download with d2x install</summary>
43+
<summary>Alternative: download with an existing d2x</summary>
4444

45-
Install [xlings](https://github.com/openxlings/xlings) first:
45+
If d2x is already installed, use the commands below. After downloading, run `xlings install -y` from the course directory to install the `.xlings.json` dependencies. There is no need to preinstall mcpp or select latest.
4646

4747
```bash
48-
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/v2026.10.18.1/tools/other/quick_install.sh | bash -s v2026.10.18.1
49-
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
50-
```
51-
52-
Or on Windows PowerShell:
53-
54-
```powershell
55-
irm https://raw.githubusercontent.com/mcpp-community/d2mcpp/main/scripts/install-xlings.ps1 | iex
56-
$env:Path = "$env:USERPROFILE\.xlings\subos\current\bin;$env:Path"
57-
```
58-
59-
Then, on either system:
60-
61-
```text
62-
xlings update
63-
xlings install --use d2x@latest mcpp@latest -y
6448
d2x install d2mcpp
6549
cd d2mcpp
50+
xlings update
51+
xlings install -y
6652
```
6753

68-
Continue with the preparation script for your system in step 2; both download routes use the same verification below.
54+
Then continue with the preparation script in step 2. Apply project pins again after updating the course.
6955

7056
</details>
7157

‎book/en/src/changelog.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
## 2026/10
1212

13+
**Install dependencies from the course manifest**
14+
15+
Get the course before running `xlings install -y` to install the versions pinned in `.xlings.json`. Align update instructions and verify both Git and d2x downloads in CI. Check upstream latest independently of course dependency upgrades.
16+
17+
- `Book`: [zh](https://mcpp-community.github.io/d2mcpp/base/chapter_1.html) / [en](https://mcpp-community.github.io/d2mcpp/en/base/chapter_1.html) - 2026/10/21
18+
- `Code`: [first-use CI](https://github.com/mcpp-community/d2mcpp/blob/main/.github/workflows/fresh-install.yml) - 2026/10/21
19+
1320
**d2x upgrade and cold-start diagnostics**
1421

1522
Upgrade d2x to 2026.10.21.1 and verify the selected executable; bound first Provider startup separately, show preparation and retain raw logs.

‎book/src/base/chapter_1.md‎

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,18 @@ $env:Path = "$env:USERPROFILE\.xlings\subos\current\bin;$env:Path"
4040
PATH 命令让当前终端立即找到工具;安装后重新打开终端即可供后续会话使用。准备脚本可重复执行,不会改动练习文件或学习进度。
4141

4242
<details>
43-
<summary>可选:通过 d2x install 下载课程</summary>
43+
<summary>可选:通过已有 d2x 下载课程</summary>
4444

45-
先安装 [xlings](https://github.com/openxlings/xlings):
45+
如果已经安装 d2x,可以使用以下方式。下载后在课程目录执行 `xlings install -y`,按 `.xlings.json` 安装依赖,无需提前安装 mcpp 或选择 latest。
4646

4747
```bash
48-
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/v2026.10.18.1/tools/other/quick_install.sh | bash -s v2026.10.18.1
49-
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
50-
```
51-
52-
Windows PowerShell 使用:
53-
54-
```powershell
55-
irm https://raw.githubusercontent.com/mcpp-community/d2mcpp/main/scripts/install-xlings.ps1 | iex
56-
$env:Path = "$env:USERPROFILE\.xlings\subos\current\bin;$env:Path"
57-
```
58-
59-
然后在任一系统执行:
60-
61-
```text
62-
xlings update
63-
xlings install --use d2x@latest mcpp@latest -y
6448
d2x install d2mcpp
6549
cd d2mcpp
50+
xlings update
51+
xlings install -y
6652
```
6753

68-
继续执行第二步中对应系统的准备脚本;两种下载方式共用下面的验证步骤。
54+
之后继续第二步的准备脚本。更新课程后同样按项目配置安装依赖。
6955

7056
</details>
7157

‎book/src/changelog.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010

1111
## 2026/10
1212

13+
**按课程配置安装依赖**
14+
15+
默认先获取课程,再由 `xlings install -y` 安装 `.xlings.json` 固定的版本;统一更新说明,并在 CI 验证 Git 与 d2x 下载路径。上游 latest 检查独立于课程版本升级。
16+
17+
- `Book`: [zh](https://mcpp-community.github.io/d2mcpp/base/chapter_1.html) / [en](https://mcpp-community.github.io/d2mcpp/en/base/chapter_1.html) - 2026/10/21
18+
- `Code`: [first-use CI](https://github.com/mcpp-community/d2mcpp/blob/main/.github/workflows/fresh-install.yml) - 2026/10/21
19+
1320
**d2x 最新版联动与冷启动诊断**
1421

1522
升级 d2x 至 2026.10.21.1,核对实际执行版本;首次 Provider 构建单独限时,显示准备进度并保留原始日志。

‎docs/environment.md‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Continue with the README. If a command is not found, reopen your terminal or app
2626

2727
## Git installation and updates
2828

29-
After installing xlings, you can also clone the course. Replace the URL with your fork if needed:
29+
After installing xlings, clone the course as shown in the README. Replace the URL with your fork if needed:
3030

3131
```bash
3232
git clone https://github.com/mcpp-community/d2mcpp.git
@@ -104,6 +104,22 @@ limit. Preparation messages do not extend the startup deadline. On failure, keep
104104
`.d2x/provider.stdout.log`, `.d2x/provider.stderr.log` and the command output.
105105
Startup/transport errors exit nonzero; an unfinished exercise verdict is expected.
106106

107-
For an existing tool installation, use `xlings install --use d2x@latest mcpp@latest -y` after `xlings update`. `@latest` selects the newest stable index entry; `--use` activates it even when already installed. Bare install commands can retain the previously selected version.
107+
From an existing course directory, install or restore the versions declared in `.xlings.json` with the commands below. `xlings update` refreshes the package index; `xlings install -y` installs the project dependencies. Use the course pins rather than `@latest`. Dependency upgrades belong in `.xlings.json` and must pass CI before publication.
108+
109+
```bash
110+
xlings update
111+
xlings install -y
112+
```
108113

109114
User cancellation returns 130 and a `cancelled` event without a Provider-failure warning or a failed exercise verdict.
115+
116+
## Download with an existing d2x
117+
118+
If d2x is already available, you can use this download route. The installer applies the downloaded course dependencies; running `xlings install -y` from the course directory explicitly reapplies its pins. There is no need to preinstall mcpp or select latest.
119+
120+
```bash
121+
d2x install d2mcpp
122+
cd d2mcpp
123+
xlings update
124+
xlings install -y
125+
```

0 commit comments

Comments
 (0)