Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32e1dc1101
|
||
|
|
28d63c14e3
|
+1
-1
@@ -1,5 +1,5 @@
|
||||
[tool.bumpversion]
|
||||
current_version = "26.8.0"
|
||||
current_version = "0.0.0"
|
||||
parse = """(?x)
|
||||
(?P<release>
|
||||
(?:[1-9][0-9]?)\\. # YY short year, no leading zero
|
||||
|
||||
@@ -9,6 +9,8 @@ on:
|
||||
jobs:
|
||||
check:
|
||||
runs-on: pixi-build-rust
|
||||
env:
|
||||
CARGO_TARGET_DIR: /opt/cargo-target/${{ gitea.repository }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ env:
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: pixi-build-rust
|
||||
env:
|
||||
CARGO_TARGET_DIR: /opt/cargo-target/${{ gitea.repository }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -23,8 +25,9 @@ jobs:
|
||||
pixi install --locked
|
||||
pixi run doc-build
|
||||
|
||||
- name: Flatten so the crate sits at the channel root
|
||||
run: bash scripts/flatten-docs.sh
|
||||
- name: Redirect the channel root to the crate page
|
||||
run: |
|
||||
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${CRATE}/\">" > target/doc/index.html
|
||||
|
||||
- name: Publish the channel to /srv/www
|
||||
run: |
|
||||
|
||||
@@ -13,6 +13,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
CARGO_TARGET_DIR: /opt/cargo-target/${{ gitea.repository }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TAG: nightly
|
||||
@@ -21,6 +22,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Install the pinned toolchain
|
||||
run: pixi install
|
||||
|
||||
@@ -11,6 +11,7 @@ jobs:
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
CARGO_TARGET_DIR: /opt/cargo-target/${{ gitea.repository }}
|
||||
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TAG: ${{ gitea.ref_name }}
|
||||
|
||||
@@ -12,8 +12,7 @@ jobs:
|
||||
sync:
|
||||
runs-on: github-readme-sync
|
||||
steps:
|
||||
- name: Check out the Gitea repo
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build the combined README
|
||||
run: |
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "coursebank"
|
||||
version = "26.8.0"
|
||||
version = "0.0.0"
|
||||
edition = "2024"
|
||||
rust-version = "1.85"
|
||||
description = "Author, assemble, administer, and analyze leveled course assessments from YAML item banks"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: Prosperity-3.0.0
|
||||
// Copyright Scientific Computing Studio
|
||||
// Source: https://git.scient.ing/education/coursebank
|
||||
|
||||
//! Chooses the version string compiled into the binary.
|
||||
//!
|
||||
//! Normal and release builds use the version from `Cargo.toml`. Nightly builds
|
||||
//! set `COURSEBANK_VERSION` (to a git-derived string; see
|
||||
//! `scripts/nightly-version.sh`) so `coursebank --version` reflects how far the
|
||||
//! build is past the last release rather than an unreleased number.
|
||||
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let version = match env::var("COURSEBANK_VERSION") {
|
||||
Ok(v) if !v.trim().is_empty() => v,
|
||||
_ => env::var("CARGO_PKG_VERSION").expect("cargo always sets CARGO_PKG_VERSION"),
|
||||
};
|
||||
println!("cargo:rustc-env=COURSEBANK_VERSION={version}");
|
||||
println!("cargo:rerun-if-env-changed=COURSEBANK_VERSION");
|
||||
println!("cargo:rerun-if-env-changed=CARGO_PKG_VERSION");
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[workspace]
|
||||
name = "coursebank"
|
||||
version = "26.8.0"
|
||||
version = "0.0.0"
|
||||
authors = ["Scientific Computing Studio <opensource@scient.ing>"]
|
||||
channels = ["conda-forge"]
|
||||
platforms = ["linux-64", "osx-arm64", "osx-64"]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<div style="padding:.4rem .75rem;font:0.85rem/1.4 sans-serif;border-bottom:1px solid var(--border-color,#ddd);background:var(--sidebar-background-color,#f7f7f7);color:var(--main-color,#000)">
|
||||
Docs channel:
|
||||
<a id="ch-release" href="#" style="margin:0 .35rem">release</a>|
|
||||
<a id="ch-nightly" href="#" style="margin:0 .35rem">nightly</a>
|
||||
<div id="cb-channel-switch" style="position:fixed;bottom:0.75rem;right:0.75rem;z-index:1000;padding:.3rem .6rem;font:0.8rem/1.3 sans-serif;border:1px solid var(--border-color,#ccc);border-radius:6px;background:var(--main-background-color,#fff);color:var(--main-color,#000);box-shadow:0 1px 4px rgba(0,0,0,.2)">
|
||||
<a id="ch-release" href="#" style="margin:0 .25rem">release</a>|
|
||||
<a id="ch-nightly" href="#" style="margin:0 .25rem">nightly</a>
|
||||
<script>
|
||||
(function () {
|
||||
var m = location.pathname.match(/^(.*\/)(release|nightly)\//);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Flatten rustdoc output so the crate serves at the doc root rather than under
|
||||
# <crate>/. Moves the crate's pages up to the doc root and drops one ../ from
|
||||
# each page's references to the shared assets (CSS/JS, search index, source),
|
||||
# scaled to the page's depth.
|
||||
# Env: DOCROOT (default target/doc), CRATE (default coursebank).
|
||||
set -euo pipefail
|
||||
docroot="${DOCROOT:-target/doc}"
|
||||
crate="${CRATE:-coursebank}"
|
||||
[ -d "$docroot/$crate" ] || { echo "no $docroot/$crate; did you build the docs?" >&2; exit 1; }
|
||||
cp -a "$docroot/$crate/." "$docroot/"
|
||||
rm -rf "${docroot:?}/${crate:?}"
|
||||
resources='static\.files/\|crates\.js\|search-index\|search\.desc/\|src/\|settings\.html\|help\.html\|trait\.impl/\|type\.impl/'
|
||||
while IFS= read -r -d '' f; do
|
||||
rel="${f#"$docroot"/}"
|
||||
depth=$(printf '%s' "$rel" | tr -cd '/' | wc -c)
|
||||
pat=''; for ((i=0; i<=depth; i++)); do pat="\\.\\./$pat"; done
|
||||
rep=''; for ((i=0; i<depth; i++)); do rep="../$rep"; done
|
||||
sed -i "s#${pat}\(${resources}\)#${rep}\1#g" "$f"
|
||||
done < <(find "$docroot" -name '*.html' -print0)
|
||||
echo "flattened $crate into $docroot"
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Print an auto-generated nightly version string derived from git history:
|
||||
#
|
||||
# <last-release-tag>+<commits-since>.g<short-sha> e.g., 26.8.0+14.gb1a2c3d4
|
||||
#
|
||||
# When no release has been tagged yet, the base is 0.0.0 and the count is the
|
||||
# total number of commits:
|
||||
#
|
||||
# 0.0.0+<total-commits>.g<short-sha> e.g., 0.0.0+57.gb1a2c3d4
|
||||
#
|
||||
# The `+...` part is SemVer build metadata, so the string stays a valid version
|
||||
# and never sorts ahead of the release it is based on. Needs full history and
|
||||
# tags (check out with fetch-depth: 0 and fetch-tags: true). Release tags are
|
||||
# matched as N.N.N; the moving `nightly` tag is ignored.
|
||||
set -euo pipefail
|
||||
sha="$(git rev-parse --short=8 HEAD)"
|
||||
if desc="$(git describe --tags --long \
|
||||
--match '[0-9]*.[0-9]*.[0-9]*' --exclude nightly 2>/dev/null)"; then
|
||||
# desc is <tag>-<n>-g<hash>; the tag itself has no '-', so strip from the right.
|
||||
rest="${desc%-g*}" # <tag>-<n>
|
||||
n="${rest##*-}" # <n>
|
||||
tag="${rest%-*}" # <tag>
|
||||
echo "${tag}+${n}.g${sha}"
|
||||
else
|
||||
n="$(git rev-list --count HEAD)"
|
||||
echo "0.0.0+${n}.g${sha}"
|
||||
fi
|
||||
@@ -1,8 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Point the site root at the latest release, falling back to nightly.
|
||||
# Env: WWW_ROOT (default /srv/www), SITE_SLUG (default coursebank).
|
||||
# rustdoc serves the crate under <crate>/, so the target includes that segment.
|
||||
# Env: WWW_ROOT (default /srv/www), SITE_SLUG (default coursebank),
|
||||
# CRATE (default coursebank).
|
||||
set -euo pipefail
|
||||
root="${WWW_ROOT:-/srv/www}/${SITE_SLUG:-coursebank}"
|
||||
if [ -e "$root/release/index.html" ]; then target="release/"; else target="nightly/"; fi
|
||||
crate="${CRATE:-coursebank}"
|
||||
if [ -e "$root/release/$crate/index.html" ]; then
|
||||
target="release/$crate/"
|
||||
else
|
||||
target="nightly/$crate/"
|
||||
fi
|
||||
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${target}\">" > "$root/index.html"
|
||||
echo "site root -> $target"
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ use coursebank::store;
|
||||
|
||||
/// Manage course item banks, assessments, and the analysis that comes back.
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "coursebank", version, about, long_about = None)]
|
||||
#[command(name = "coursebank", version = env!("COURSEBANK_VERSION"), about, long_about = None)]
|
||||
pub(crate) struct Cli {
|
||||
/// Course directory, the one holding course.yaml.
|
||||
#[arg(long, short = 'C', global = true, default_value = ".")]
|
||||
@@ -584,4 +584,4 @@ mod tests {
|
||||
fn the_cli_rejects_an_unknown_subcommand() {
|
||||
assert!(Cli::try_parse_from(["coursebank", "frobnicate"]).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
//! ## The loop
|
||||
//!
|
||||
//! ```text
|
||||
//! author items ──▶ validate ──▶ lint ──▶ assemble ──▶ export ──┐
|
||||
//! author items ──▶ validate ──▶ lint ──▶ assemble ──▶ export ───┐
|
||||
//! ▲ │
|
||||
//! │ administer
|
||||
//! │ │
|
||||
|
||||
Reference in New Issue
Block a user