diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index afd85ab..07e1029 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,22 +46,3 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run tests run: cargo test --workspace - - # Empaquette les crates publiées et les recompile depuis leur tarball. Aucun - # `cargo test` ne fait ça, et c'est la seule étape qui voit ce qui manque au - # paquet : la release 0.6.0 s'est arrêtée sur 65 `include_str!` visant un - # dossier situé hors de la crate, donc absent de l'archive. Sans ce job, cette - # famille de défaut ne se découvre qu'en publiant — et une publication - # crates.io ne se défait pas, elle se yanke. - package: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Install system dependencies - run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - name: Package publishable crates - # studio et cli ne sont pas publiées ; les exclure évite d'installer la - # pile GTK/WebKit ici pour rien. - run: cargo package --workspace --exclude rustmotion-studio --exclude rustmotion-cli diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 51c614a..5a2a02e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -22,9 +22,15 @@ jobs: - uses: dtolnay/rust-toolchain@stable + # La version se lit via `cargo metadata`, pas en grepant un manifeste : elle + # est déclarée dans `[workspace.package]` et héritée, donc un `grep + # '^version'` sur la crate tomberait sur `version.workspace = true` et + # comparerait le tag à cette chaîne. cargo répond la version résolue, où + # qu'elle soit écrite. - name: Verify tag matches Cargo.toml version run: | - CARGO_VERSION=$(grep '^version' crates/rustmotion/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') + CARGO_VERSION=$(cargo metadata --format-version 1 --no-deps \ + | jq -r '.packages[] | select(.name=="rustmotion") | .version') TAG_VERSION=${GITHUB_REF#refs/tags/} if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then echo "Tag $TAG_VERSION does not match Cargo.toml version $CARGO_VERSION" @@ -34,58 +40,28 @@ jobs: - name: Run tests run: cargo test --workspace - - name: Publish rustmotion-core - run: cargo publish -p rustmotion-core --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + # Repetition deliberee : l'etape suivante empaquette et verifie deja tout + # avant de televerser, donc ce dry-run recompile les quatre crates une + # seconde fois et n'attrape rien de plus. Ce qu'il achete est un signal, pas + # une garantie — un echec ici arrive avant que la commande de publication + # soit lancee, donc le log dit sans ambiguite que rien n'a pu partir. Apres + # 0.6.0, qui s'est arretee avec une crate deja publiee, la distinction vaut + # le temps de compilation. + - name: Dry-run the workspace publish + run: cargo publish --workspace --dry-run - - name: Wait for rustmotion-core on crates.io - run: | - VERSION=$(grep '^version' crates/rustmotion-core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') - for i in $(seq 1 30); do - if curl -sf "https://crates.io/api/v1/crates/rustmotion-core/$VERSION" > /dev/null; then - echo "rustmotion-core $VERSION available" - exit 0 - fi - echo "Waiting... ($i)" - sleep 5 - done - echo "Timeout waiting for rustmotion-core" && exit 1 - - - name: Publish rustmotion-components - run: cargo publish -p rustmotion-components --token ${{ secrets.CARGO_REGISTRY_TOKEN }} - - - name: Wait for rustmotion-components on crates.io - run: | - VERSION=$(grep '^version' crates/rustmotion-components/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') - for i in $(seq 1 30); do - if curl -sf "https://crates.io/api/v1/crates/rustmotion-components/$VERSION" > /dev/null; then - echo "rustmotion-components $VERSION available" - exit 0 - fi - echo "Waiting... ($i)" - sleep 5 - done - echo "Timeout waiting for rustmotion-components" && exit 1 - - # rustmotion dépend de rustmotion-html au même titre que de core et - # components. Sans cette étape, `cargo publish -p rustmotion` échoue sur une - # dépendance introuvable — mais en troisième position, core et components - # étant alors déjà publiées. Une publication crates.io ne se défait pas : - # l'échec obligerait à repasser tout le workspace en version suivante. - - name: Publish rustmotion-html - run: cargo publish -p rustmotion-html --token ${{ secrets.CARGO_REGISTRY_TOKEN }} - - - name: Wait for rustmotion-html on crates.io - run: | - VERSION=$(grep '^version' crates/rustmotion-html/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') - for i in $(seq 1 30); do - if curl -sf "https://crates.io/api/v1/crates/rustmotion-html/$VERSION" > /dev/null; then - echo "rustmotion-html $VERSION available" - exit 0 - fi - echo "Waiting... ($i)" - sleep 5 - done - echo "Timeout waiting for rustmotion-html" && exit 1 - - - name: Publish rustmotion - run: cargo publish -p rustmotion --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + # Un seul appel, et c'est ce qui porte la garantie : cargo empaquette et + # recompile les quatre crates depuis leur propre tarball AVANT de televerser + # quoi que ce soit. Si une seule ne se construit pas, rien ne part. Il + # televerse ensuite dans l'ordre des dependances et attend lui-meme la + # propagation de l'index. + # + # Les sept etapes manuelles qui precedaient interrogeaient + # https://crates.io/api/v1/crates// pour attendre chaque crate. + # Cet endpoint refuse une requete sans User-Agent identifiant : la boucle ne + # pouvait donc jamais reussir, et la release 0.6.0 s'est arretee la — apres + # avoir publie rustmotion-core, definitivement. + # + # studio et cli portent `publish = false` : cargo les saute tout seul. + - name: Publish all crates + run: cargo publish --workspace --token ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index f4aeb04..061d4b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5051,7 +5051,7 @@ dependencies = [ [[package]] name = "rustmotion" -version = "0.6.0" +version = "0.6.1" dependencies = [ "gif 0.13.3", "image", @@ -5079,7 +5079,7 @@ dependencies = [ [[package]] name = "rustmotion-cli" -version = "0.6.0" +version = "0.6.1" dependencies = [ "clap", "clap_complete", @@ -5098,7 +5098,7 @@ dependencies = [ [[package]] name = "rustmotion-components" -version = "0.6.0" +version = "0.6.1" dependencies = [ "dashmap", "gif 0.13.3", @@ -5119,7 +5119,7 @@ dependencies = [ [[package]] name = "rustmotion-core" -version = "0.6.0" +version = "0.6.1" dependencies = [ "cosmic-text", "dashmap", @@ -5143,7 +5143,7 @@ dependencies = [ [[package]] name = "rustmotion-html" -version = "0.6.0" +version = "0.6.1" dependencies = [ "html5ever 0.39.0", "markup5ever_rcdom", @@ -5153,7 +5153,7 @@ dependencies = [ [[package]] name = "rustmotion-studio" -version = "0.6.0" +version = "0.6.1" dependencies = [ "clap", "dioxus", diff --git a/Cargo.toml b/Cargo.toml index df2fe97..498dbb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,21 @@ members = [ "crates/rustmotion-html", ] +# Les six crates avancent ensemble. La version se change ici, et nulle part +# ailleurs : elle était auparavant répétée dix fois — une par manifeste, plus une +# par dépendance interne — et une seule oubliée fait échouer la publication après +# que les précédentes soient parties, ce qui ne se rattrape pas. +[workspace.package] +version = "0.6.1" + +# Les dépendances internes portent aussi la version, donc elles se déclarent ici +# pour la même raison. `path` sert au développement, `version` à ce que cargo +# écrit dans le paquet publié : les deux doivent coexister, et rester d'accord. +[workspace.dependencies] +rustmotion-core = { path = "crates/rustmotion-core", version = "0.6.1" } +rustmotion-components = { path = "crates/rustmotion-components", version = "0.6.1" } +rustmotion-html = { path = "crates/rustmotion-html", version = "0.6.1" } + # Optimize dependencies even in dev builds. Our own crates stay at opt-level 0 # (fast incremental + debuggable), but heavy compute in deps (image encoding, # etc.) runs optimized — without this, `cargo run` image encode is ~20x slower. diff --git a/crates/rustmotion-cli/Cargo.toml b/crates/rustmotion-cli/Cargo.toml index 5375a1d..df660b7 100644 --- a/crates/rustmotion-cli/Cargo.toml +++ b/crates/rustmotion-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmotion-cli" -version = "0.6.0" +version.workspace = true edition = "2021" publish = false diff --git a/crates/rustmotion-components/Cargo.toml b/crates/rustmotion-components/Cargo.toml index c0ad08a..7ed52bd 100644 --- a/crates/rustmotion-components/Cargo.toml +++ b/crates/rustmotion-components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmotion-components" -version = "0.6.0" +version.workspace = true edition = "2021" description = "Component library for rustmotion (51 components)" license = "MIT" @@ -14,7 +14,7 @@ default = ["lottie-native"] lottie-native = ["dep:thorvg", "dep:dashmap"] [dependencies] -rustmotion-core = { path = "../rustmotion-core", version = "0.6.0" } +rustmotion-core.workspace = true skia-safe = "0.82" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/crates/rustmotion-core/Cargo.toml b/crates/rustmotion-core/Cargo.toml index 55aaff0..34e984d 100644 --- a/crates/rustmotion-core/Cargo.toml +++ b/crates/rustmotion-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmotion-core" -version = "0.6.0" +version.workspace = true edition = "2021" description = "Core types, traits, and rendering utilities for rustmotion" license = "MIT" diff --git a/crates/rustmotion-html/Cargo.toml b/crates/rustmotion-html/Cargo.toml index afea36c..f5827ec 100644 --- a/crates/rustmotion-html/Cargo.toml +++ b/crates/rustmotion-html/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmotion-html" -version = "0.6.0" +version.workspace = true edition = "2021" description = "HTML/CSS front-end transpiler for rustmotion scenarios" license = "MIT" diff --git a/crates/rustmotion-studio/Cargo.toml b/crates/rustmotion-studio/Cargo.toml index df154ed..1e568e6 100644 --- a/crates/rustmotion-studio/Cargo.toml +++ b/crates/rustmotion-studio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmotion-studio" -version = "0.6.0" +version.workspace = true edition = "2021" publish = false diff --git a/crates/rustmotion/Cargo.toml b/crates/rustmotion/Cargo.toml index cd242de..fad36df 100644 --- a/crates/rustmotion/Cargo.toml +++ b/crates/rustmotion/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmotion" -version = "0.6.0" +version.workspace = true edition = "2021" description = "A CLI tool that renders motion design videos from JSON scenarios. No browser, no Node.js — just a single Rust binary." license = "MIT" @@ -10,9 +10,9 @@ repository = "https://github.com/LeadcodeDev/rustmotion" path = "src/lib.rs" [dependencies] -rustmotion-core = { path = "../rustmotion-core", version = "0.6.0" } -rustmotion-components = { path = "../rustmotion-components", version = "0.6.0", features = ["lottie-native"] } -rustmotion-html = { path = "../rustmotion-html", version = "0.6.0" } +rustmotion-core.workspace = true +rustmotion-components = { workspace = true, features = ["lottie-native"] } +rustmotion-html.workspace = true skia-safe = "0.82" serde = { version = "1", features = ["derive"] } serde_json = "1"