diff --git a/.github/actions/arxiv-records/action.yml b/.github/actions/arxiv-records/action.yml new file mode 100644 index 00000000000..53078c8277f --- /dev/null +++ b/.github/actions/arxiv-records/action.yml @@ -0,0 +1,42 @@ +name: add the arXiv records +description: Unpack the arXiv records that manifests/records-arxiv.yaml pins from tamnd/math2-records (corpus arxiv AQ11). + +inputs: + root: + description: The math2 tree. + default: . + m2: + description: An m2 with the command corpus records. With none, the action installs m2 v0.6.23, which has it. Go must be set up. + default: "" + +runs: + using: composite + steps: + # The mentions of arXiv, the records of understand and the rows of the research layer are in tamnd/math2-records. The checks and the site read the tree with them, as the pipeline does. + - name: unpack the arXiv records + shell: bash + env: + ROOT: ${{ inputs.root }} + M2: ${{ inputs.m2 }} + run: | + pin="$ROOT/manifests/records-arxiv.yaml" + if [ ! -f "$pin" ]; then + echo "no pin of the arXiv records" + exit 0 + fi + commit=$(sed -n 's/^commit: *//p' "$pin") + if ! printf '%s' "$commit" | grep -Eq '^[0-9a-f]{40}$'; then + echo "::error file=manifests/records-arxiv.yaml::the pin of the arXiv records is not a commit: $commit" + exit 1 + fi + out="$RUNNER_TEMP/records-arxiv" + git init -q "$out" + git -C "$out" fetch -q --depth 1 https://github.com/tamnd/math2-records "$commit" + git -C "$out" checkout -q FETCH_HEAD + if [ -z "$M2" ]; then + GOBIN="$RUNNER_TEMP/m2-records" go install github.com/tamnd/math2-agent/cmd/m2@v0.6.23 + M2="$RUNNER_TEMP/m2-records/m2" + fi + "$M2" corpus records unpack -root "$ROOT" -out "$out" + # The unpacked directories are not changes of the tree, so m2 audit -changed does not take them as new files. + printf '%s\n' /records/mentions/arxiv/ /records/understand/arxiv/ >> "$(git -C "$ROOT" rev-parse --git-path info/exclude)" diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index c01ba2771d6..0f5cd6167bd 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -36,6 +36,7 @@ jobs: persist-credentials: false fetch-depth: 0 - uses: ./.github/actions/m2 + - uses: ./.github/actions/arxiv-records - uses: ./.github/actions/lean - name: m2 build run: m2 build diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b627e7e9989..2b64b0e84ba 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -154,6 +154,7 @@ jobs: fetch-depth: 0 # The m2 version is in manifests/releases/next.yaml. - uses: ./.github/actions/m2 + - uses: ./.github/actions/arxiv-records - name: m2 check run: m2 check # Each volume must pass the pack checks PC1 to PC10 of corpus K11.6. The check writes no file. diff --git a/.github/workflows/import.yml b/.github/workflows/import.yml index c67d2657e79..6b4feb0c687 100644 --- a/.github/workflows/import.yml +++ b/.github/workflows/import.yml @@ -47,10 +47,18 @@ jobs: - name: build m2 working-directory: toolchain run: go build -trimpath -o "$RUNNER_TEMP/m2" ./cmd/m2 + - uses: ./content/.github/actions/arxiv-records + with: + root: content + m2: ${{ runner.temp }}/m2 + # The import keeps the ids of the rows of the research layer, so it runs on the tree with the arXiv records. Then only the pin stays (corpus arxiv AQ11). - name: m2 corpus import working-directory: content run: | "$RUNNER_TEMP/m2" corpus import -plan corpus/plan.yaml -root . -commit "$GITHUB_SHA" -cache "$RUNNER_TEMP/cache" -summary "$RUNNER_TEMP/summary.md" + if [ -f manifests/records-arxiv.yaml ]; then + "$RUNNER_TEMP/m2" corpus records keep -root . + fi - name: open and merge the pull request working-directory: content env: diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3bd360e0c56..e019f94fccd 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -46,6 +46,10 @@ jobs: - name: build m2 working-directory: toolchain run: go build -trimpath -o "$RUNNER_TEMP/m2" ./cmd/m2 + - uses: ./content/.github/actions/arxiv-records + with: + root: content + m2: ${{ runner.temp }}/m2 # The full catalogue of resources is in tamnd/math2-records at the commit of manifests/records.yaml (RS12.3). The site needs each resource, not only the tiers that math2 keeps. - name: add the full catalogue run: | @@ -121,6 +125,10 @@ jobs: - name: build m2 working-directory: toolchain run: go build -trimpath -o "$RUNNER_TEMP/m2" ./cmd/m2 + - uses: ./content/.github/actions/arxiv-records + with: + root: content + m2: ${{ runner.temp }}/m2 - name: build the site env: COMMIT: ${{ github.sha }} diff --git a/scripts/deploy-cloudflare.sh b/scripts/deploy-cloudflare.sh index 08401764565..711f443256b 100755 --- a/scripts/deploy-cloudflare.sh +++ b/scripts/deploy-cloudflare.sh @@ -53,6 +53,16 @@ fi echo "$(date -u +%FT%TZ) deploy math2 $content, math2-agent $toolchain, wikipedia-math $wikipedia" (cd "$dir/toolchain" && go build -trimpath -o "$dir/m2" ./cmd/m2) +# The arXiv records are in tamnd/math2-records at the commit of manifests/records-arxiv.yaml (corpus arxiv AQ11). The site reads the tree with them. The records of an earlier deploy go first, since unpack adds nothing to a tree that has them. +recpin=$(sed -n 's/^commit: *//p' "$dir/content/manifests/records-arxiv.yaml" 2>/dev/null || true) +if [ -n "$recpin" ]; then + git -C "$dir/content" clean -fdq records + git -C "$dir/content" checkout -q -- records + [ -d "$dir/records-arxiv/.git" ] || git init -q "$dir/records-arxiv" + git -C "$dir/records-arxiv" fetch -q --depth 1 https://github.com/tamnd/math2-records "$recpin" + git -C "$dir/records-arxiv" checkout -q -f FETCH_HEAD + "$dir/m2" corpus records unpack -root "$dir/content" -out "$dir/records-arxiv" +fi rm -rf "$dir/site" GOMEMLIMIT=${M2_BUILD_MEMORY:-2GiB} "$dir/m2" site build -content "$dir/content" -spec "$dir/toolchain/spec" -wikipedia "$dir/wikipedia" -out "$dir/site" -url "$url" -commit "$content" -date now -cloudflare -cache "$dir/cache/math.gob.gz" -social-packs "$dir/social-packs" files=$(find "$dir/site" -type f | wc -l)