diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ca3bea3a7e..caf8bd0a9c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,48 +21,7 @@ jobs: if: "${{ github.repository == 'NomicFoundation/slang' && github.ref_name == 'main' }}" uses: "./.github/workflows/ci.yml" - buildDocs: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "ci" - - steps: - - name: "Checkout Repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" - - - name: "Restore Cache" - uses: "./.github/actions/cache/restore" - - - name: "infra check mkdocs" - uses: "./.github/actions/devcontainer/run" - with: - runCmd: "./scripts/bin/infra check mkdocs" - - - name: "Configure Pages" - uses: "actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d" - - - name: "Upload Artifacts" - uses: "actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa" - with: - path: "documentation/target/site" # _SLANG_MKDOCS_DOCUMENTATION_SITE_DIR_ (keep in sync) - - deployDocs: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "buildDocs" - - permissions: - pages: "write" # to deploy to Pages - id-token: "write" # to verify the deployment originates from an appropriate source - - steps: - - name: "Deploy Pages" - id: "deployment" - uses: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e" - - environment: - name: "github-pages" - url: "${{ steps.deployment.outputs.page_url }}" - - consumeChangesets: + publish: runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) needs: "ci" @@ -95,23 +54,23 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - outputs: - hasChangesets: "${{ steps.runChangesets.outputs.hasChangesets }}" - - artifacts: - runs-on: "ubuntu-22.04" # _SLANG_DEV_CONTAINER_BASE_IMAGE_ (keep in sync) - needs: "consumeChangesets" - - if: "${{ needs.consumeChangesets.outputs.hasChangesets == 'false' }}" - - steps: - - name: "Checkout Repository" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" + - name: "infra publish mkdocs --target main-branch" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish mkdocs --target main-branch" + env: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - - name: "Restore Cache" - uses: "./.github/actions/cache/restore" + - name: "infra publish mkdocs --target latest-release" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" + uses: "./.github/actions/devcontainer/run" + with: + runCmd: "./scripts/bin/infra publish mkdocs --target latest-release" + env: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - name: "infra publish npm" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" uses: "./.github/actions/devcontainer/run" with: runCmd: "./scripts/bin/infra publish npm" @@ -119,6 +78,7 @@ jobs: NPM_TOKEN=${{ secrets.NPM_TOKEN }} - name: "infra publish cargo" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" uses: "./.github/actions/devcontainer/run" with: runCmd: "./scripts/bin/infra publish cargo" @@ -126,6 +86,7 @@ jobs: CARGO_REGISTRY_TOKEN=${{ secrets.CARGO_REGISTRY_TOKEN }} - name: "infra publish github-release" + if: "${{ steps.runChangesets.outputs.hasChangesets == 'false' }}" uses: "./.github/actions/devcontainer/run" with: runCmd: "./scripts/bin/infra publish github-release" diff --git a/Pipfile b/Pipfile index 8a02a0fab0..dc1723087d 100644 --- a/Pipfile +++ b/Pipfile @@ -8,9 +8,10 @@ name = "pypi" pipenv = "==2024.0.1" # Used for the published GitHub pages site: -mkdocs = "==1.5.3" +mike = "==2.1.2" +mkdocs = "==1.6.0" mkdocs-literate-nav = "==0.6.1" -mkdocs-material = "==9.5.17" +mkdocs-material = "==9.5.31" mkdocs-minify-plugin = "==0.8.0" mkdocs-pymdownx-material-extras = "==2.5.6" diff --git a/Pipfile.lock b/Pipfile.lock index 4867adc646..e7175d1e86 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "276d18feecc01cedb21c29befdcc5aa24529ab2665b8730ae48c257dea1a21d6" + "sha256": "c0b716b16983d211b53377d943b3c868b8410510092623e7df4d9ff79b9bb931" }, "pipfile-spec": 6, "requires": {}, @@ -16,18 +16,17 @@ "default": { "babel": { "hashes": [ - "sha256:6919867db036398ba21eb5c7a0f6b28ab8cbc3ae7a73a44ebe34ae74a4e7d363", - "sha256:efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287" + "sha256:08706bdad8d0a3413266ab61bd6c34d0c28d6e1e7badf40a2cebe67644e2e1fb", + "sha256:8daf0e265d05768bc6c7a314cf1321e9a123afc328cc635c18622a2f30a04413" ], - "markers": "python_version >= '3.7'", - "version": "==2.14.0" + "markers": "python_version >= '3.8'", + "version": "==2.15.0" }, "certifi": { "hashes": [ "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b", "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90" ], - "index": "pypi", "markers": "python_version >= '3.6'", "version": "==2024.7.4" }, @@ -171,12 +170,6 @@ ], "version": "==2.1.0" }, - "htmlmin": { - "hashes": [ - "sha256:50c1ef4630374a5d723900096a961cff426dff46b48f34d194a81bbe14eca178" - ], - "version": "==0.1.12" - }, "htmlmin2": { "hashes": [ "sha256:75609f2a42e64f7ce57dbff28a39890363bde9e7e5885db633317efbdf8c79a2" @@ -191,13 +184,29 @@ "markers": "python_version >= '3.5'", "version": "==3.7" }, + "importlib-metadata": { + "hashes": [ + "sha256:11901fa0c2f97919b288679932bb64febaeacf289d18ac84dd68cb2e74213369", + "sha256:72e8d4399996132204f9a16dcc751af254a48f8d1b20b9ff0f98d4a8f901e73d" + ], + "markers": "python_version >= '3.8'", + "version": "==8.2.0" + }, + "importlib-resources": { + "hashes": [ + "sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c", + "sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145" + ], + "markers": "python_version >= '3.8'", + "version": "==6.4.0" + }, "jinja2": { "hashes": [ - "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa", - "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90" + "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369", + "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d" ], "markers": "python_version >= '3.7'", - "version": "==3.1.3" + "version": "==3.1.4" }, "jsmin": { "hashes": [ @@ -287,14 +296,30 @@ "markers": "python_version >= '3.6'", "version": "==1.3.4" }, + "mike": { + "hashes": [ + "sha256:d59cc8054c50f9c8a046cfd47f9b700cf9ff1b2b19f420bd8812ca6f94fa8bd3", + "sha256:d61d9b423ab412d634ca2bd520136d5114e3cc73f4bbd1aa6a0c6625c04918c0" + ], + "index": "pypi", + "version": "==2.1.2" + }, "mkdocs": { "hashes": [ - "sha256:3b3a78e736b31158d64dbb2f8ba29bd46a379d0c6e324c2246c3bc3d2189cfc1", - "sha256:eb7c99214dcb945313ba30426c2451b735992c73c2e10838f76d09e39ff4d0e2" + "sha256:1eb5cb7676b7d89323e62b56235010216319217d4af5ddc543a91beb8d125ea7", + "sha256:a73f735824ef83a4f3bcb7a231dcab23f5a838f88b7efc54a0eef5fbdbc3c512" ], "index": "pypi", - "markers": "python_version >= '3.7'", - "version": "==1.5.3" + "markers": "python_version >= '3.8'", + "version": "==1.6.0" + }, + "mkdocs-get-deps": { + "hashes": [ + "sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c", + "sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134" + ], + "markers": "python_version >= '3.8'", + "version": "==0.2.0" }, "mkdocs-literate-nav": { "hashes": [ @@ -307,12 +332,12 @@ }, "mkdocs-material": { "hashes": [ - "sha256:06ae1275a72db1989cf6209de9e9ecdfbcfdbc24c58353877b2bb927dbe413e4", - "sha256:14a2a60119a785e70e765dd033e6211367aca9fc70230e577c1cf6a326949571" + "sha256:1b1f49066fdb3824c1e96d6bacd2d4375de4ac74580b47e79ff44c4d835c5fcb", + "sha256:31833ec664772669f5856f4f276bf3fdf0e642a445e64491eda459249c3a1ca8" ], "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==9.5.17" + "version": "==9.5.31" }, "mkdocs-material-extensions": { "hashes": [ @@ -342,11 +367,11 @@ }, "packaging": { "hashes": [ - "sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5", - "sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9" + "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002", + "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124" ], - "markers": "python_version >= '3.7'", - "version": "==24.0" + "markers": "python_version >= '3.8'", + "version": "==24.1" }, "paginate": { "hashes": [ @@ -381,19 +406,27 @@ }, "pygments": { "hashes": [ - "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c", - "sha256:da46cec9fd2de5be3a8a784f434e4c4ab670b4ff54d605c4c2717e9d49c4c367" + "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199", + "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a" ], - "markers": "python_version >= '3.7'", - "version": "==2.17.2" + "markers": "python_version >= '3.8'", + "version": "==2.18.0" }, "pymdown-extensions": { "hashes": [ - "sha256:c70e146bdd83c744ffc766b4671999796aba18842b268510a329f7f64700d584", - "sha256:f5cc7000d7ff0d1ce9395d216017fa4df3dde800afb1fb72d1c7d3fd35e710f4" + "sha256:6ff740bcd99ec4172a938970d42b96128bdc9d4b9bcad72494f29921dc69b753", + "sha256:d323f7e90d83c86113ee78f3fe62fc9dee5f56b54d912660703ea1816fed5626" ], "markers": "python_version >= '3.8'", - "version": "==10.7.1" + "version": "==10.9" + }, + "pyparsing": { + "hashes": [ + "sha256:a1bac0ce561155ecc3ed78ca94d3c9378656ad4c94c1270de543f621420f94ad", + "sha256:f9db75911801ed778fe61bb643079ff86601aca99fcae6345aa67292038fb742" + ], + "markers": "python_full_version >= '3.6.8'", + "version": "==3.1.2" }, "python-dateutil": { "hashes": [ @@ -470,119 +503,104 @@ }, "regex": { "hashes": [ - "sha256:0694219a1d54336fd0445ea382d49d36882415c0134ee1e8332afd1529f0baa5", - "sha256:086dd15e9435b393ae06f96ab69ab2d333f5d65cbe65ca5a3ef0ec9564dfe770", - "sha256:094ba386bb5c01e54e14434d4caabf6583334090865b23ef58e0424a6286d3dc", - "sha256:09da66917262d9481c719599116c7dc0c321ffcec4b1f510c4f8a066f8768105", - "sha256:0ecf44ddf9171cd7566ef1768047f6e66975788258b1c6c6ca78098b95cf9a3d", - "sha256:0fda75704357805eb953a3ee15a2b240694a9a514548cd49b3c5124b4e2ad01b", - "sha256:11a963f8e25ab5c61348d090bf1b07f1953929c13bd2309a0662e9ff680763c9", - "sha256:150c39f5b964e4d7dba46a7962a088fbc91f06e606f023ce57bb347a3b2d4630", - "sha256:1b9d811f72210fa9306aeb88385b8f8bcef0dfbf3873410413c00aa94c56c2b6", - "sha256:1e0eabac536b4cc7f57a5f3d095bfa557860ab912f25965e08fe1545e2ed8b4c", - "sha256:22a86d9fff2009302c440b9d799ef2fe322416d2d58fc124b926aa89365ec482", - "sha256:22f3470f7524b6da61e2020672df2f3063676aff444db1daa283c2ea4ed259d6", - "sha256:263ef5cc10979837f243950637fffb06e8daed7f1ac1e39d5910fd29929e489a", - "sha256:283fc8eed679758de38fe493b7d7d84a198b558942b03f017b1f94dda8efae80", - "sha256:29171aa128da69afdf4bde412d5bedc335f2ca8fcfe4489038577d05f16181e5", - "sha256:298dc6354d414bc921581be85695d18912bea163a8b23cac9a2562bbcd5088b1", - "sha256:2aae8101919e8aa05ecfe6322b278f41ce2994c4a430303c4cd163fef746e04f", - "sha256:2f4e475a80ecbd15896a976aa0b386c5525d0ed34d5c600b6d3ebac0a67c7ddf", - "sha256:34e4af5b27232f68042aa40a91c3b9bb4da0eeb31b7632e0091afc4310afe6cb", - "sha256:37f8e93a81fc5e5bd8db7e10e62dc64261bcd88f8d7e6640aaebe9bc180d9ce2", - "sha256:3a17d3ede18f9cedcbe23d2daa8a2cd6f59fe2bf082c567e43083bba3fb00347", - "sha256:3b1de218d5375cd6ac4b5493e0b9f3df2be331e86520f23382f216c137913d20", - "sha256:43f7cd5754d02a56ae4ebb91b33461dc67be8e3e0153f593c509e21d219c5060", - "sha256:4558410b7a5607a645e9804a3e9dd509af12fb72b9825b13791a37cd417d73a5", - "sha256:4719bb05094d7d8563a450cf8738d2e1061420f79cfcc1fa7f0a44744c4d8f73", - "sha256:4bfc2b16e3ba8850e0e262467275dd4d62f0d045e0e9eda2bc65078c0110a11f", - "sha256:518440c991f514331f4850a63560321f833979d145d7d81186dbe2f19e27ae3d", - "sha256:51f4b32f793812714fd5307222a7f77e739b9bc566dc94a18126aba3b92b98a3", - "sha256:531ac6cf22b53e0696f8e1d56ce2396311254eb806111ddd3922c9d937151dae", - "sha256:5cd05d0f57846d8ba4b71d9c00f6f37d6b97d5e5ef8b3c3840426a475c8f70f4", - "sha256:5dd58946bce44b53b06d94aa95560d0b243eb2fe64227cba50017a8d8b3cd3e2", - "sha256:60080bb3d8617d96f0fb7e19796384cc2467447ef1c491694850ebd3670bc457", - "sha256:636ba0a77de609d6510235b7f0e77ec494d2657108f777e8765efc060094c98c", - "sha256:67d3ccfc590e5e7197750fcb3a2915b416a53e2de847a728cfa60141054123d4", - "sha256:68191f80a9bad283432385961d9efe09d783bcd36ed35a60fb1ff3f1ec2efe87", - "sha256:7502534e55c7c36c0978c91ba6f61703faf7ce733715ca48f499d3dbbd7657e0", - "sha256:7aa47c2e9ea33a4a2a05f40fcd3ea36d73853a2aae7b4feab6fc85f8bf2c9704", - "sha256:7d2af3f6b8419661a0c421584cfe8aaec1c0e435ce7e47ee2a97e344b98f794f", - "sha256:7e316026cc1095f2a3e8cc012822c99f413b702eaa2ca5408a513609488cb62f", - "sha256:88ad44e220e22b63b0f8f81f007e8abbb92874d8ced66f32571ef8beb0643b2b", - "sha256:88d1f7bef20c721359d8675f7d9f8e414ec5003d8f642fdfd8087777ff7f94b5", - "sha256:89723d2112697feaa320c9d351e5f5e7b841e83f8b143dba8e2d2b5f04e10923", - "sha256:8a0ccf52bb37d1a700375a6b395bff5dd15c50acb745f7db30415bae3c2b0715", - "sha256:8c2c19dae8a3eb0ea45a8448356ed561be843b13cbc34b840922ddf565498c1c", - "sha256:905466ad1702ed4acfd67a902af50b8db1feeb9781436372261808df7a2a7bca", - "sha256:9852b76ab558e45b20bf1893b59af64a28bd3820b0c2efc80e0a70a4a3ea51c1", - "sha256:98a2636994f943b871786c9e82bfe7883ecdaba2ef5df54e1450fa9869d1f756", - "sha256:9aa1a67bbf0f957bbe096375887b2505f5d8ae16bf04488e8b0f334c36e31360", - "sha256:9eda5f7a50141291beda3edd00abc2d4a5b16c29c92daf8d5bd76934150f3edc", - "sha256:a6d1047952c0b8104a1d371f88f4ab62e6275567d4458c1e26e9627ad489b445", - "sha256:a9b6d73353f777630626f403b0652055ebfe8ff142a44ec2cf18ae470395766e", - "sha256:a9cc99d6946d750eb75827cb53c4371b8b0fe89c733a94b1573c9dd16ea6c9e4", - "sha256:ad83e7545b4ab69216cef4cc47e344d19622e28aabec61574b20257c65466d6a", - "sha256:b014333bd0217ad3d54c143de9d4b9a3ca1c5a29a6d0d554952ea071cff0f1f8", - "sha256:b43523d7bc2abd757119dbfb38af91b5735eea45537ec6ec3a5ec3f9562a1c53", - "sha256:b521dcecebc5b978b447f0f69b5b7f3840eac454862270406a39837ffae4e697", - "sha256:b77e27b79448e34c2c51c09836033056a0547aa360c45eeeb67803da7b0eedaf", - "sha256:b7a635871143661feccce3979e1727c4e094f2bdfd3ec4b90dfd4f16f571a87a", - "sha256:b7fca9205b59c1a3d5031f7e64ed627a1074730a51c2a80e97653e3e9fa0d415", - "sha256:ba1b30765a55acf15dce3f364e4928b80858fa8f979ad41f862358939bdd1f2f", - "sha256:ba99d8077424501b9616b43a2d208095746fb1284fc5ba490139651f971d39d9", - "sha256:c25a8ad70e716f96e13a637802813f65d8a6760ef48672aa3502f4c24ea8b400", - "sha256:c3c4a78615b7762740531c27cf46e2f388d8d727d0c0c739e72048beb26c8a9d", - "sha256:c40281f7d70baf6e0db0c2f7472b31609f5bc2748fe7275ea65a0b4601d9b392", - "sha256:c7ad32824b7f02bb3c9f80306d405a1d9b7bb89362d68b3c5a9be53836caebdb", - "sha256:cb3fe77aec8f1995611f966d0c656fdce398317f850d0e6e7aebdfe61f40e1cd", - "sha256:cc038b2d8b1470364b1888a98fd22d616fba2b6309c5b5f181ad4483e0017861", - "sha256:cc37b9aeebab425f11f27e5e9e6cf580be7206c6582a64467a14dda211abc232", - "sha256:cc6bb9aa69aacf0f6032c307da718f61a40cf970849e471254e0e91c56ffca95", - "sha256:d126361607b33c4eb7b36debc173bf25d7805847346dd4d99b5499e1fef52bc7", - "sha256:d15b274f9e15b1a0b7a45d2ac86d1f634d983ca40d6b886721626c47a400bf39", - "sha256:d166eafc19f4718df38887b2bbe1467a4f74a9830e8605089ea7a30dd4da8887", - "sha256:d498eea3f581fbe1b34b59c697512a8baef88212f92e4c7830fcc1499f5b45a5", - "sha256:d6f7e255e5fa94642a0724e35406e6cb7001c09d476ab5fce002f652b36d0c39", - "sha256:d78bd484930c1da2b9679290a41cdb25cc127d783768a0369d6b449e72f88beb", - "sha256:d865984b3f71f6d0af64d0d88f5733521698f6c16f445bb09ce746c92c97c586", - "sha256:d902a43085a308cef32c0d3aea962524b725403fd9373dea18110904003bac97", - "sha256:d94a1db462d5690ebf6ae86d11c5e420042b9898af5dcf278bd97d6bda065423", - "sha256:da695d75ac97cb1cd725adac136d25ca687da4536154cdc2815f576e4da11c69", - "sha256:db2a0b1857f18b11e3b0e54ddfefc96af46b0896fb678c85f63fb8c37518b3e7", - "sha256:df26481f0c7a3f8739fecb3e81bc9da3fcfae34d6c094563b9d4670b047312e1", - "sha256:e14b73607d6231f3cc4622809c196b540a6a44e903bcfad940779c80dffa7be7", - "sha256:e2610e9406d3b0073636a3a2e80db05a02f0c3169b5632022b4e81c0364bcda5", - "sha256:e692296c4cc2873967771345a876bcfc1c547e8dd695c6b89342488b0ea55cd8", - "sha256:e693e233ac92ba83a87024e1d32b5f9ab15ca55ddd916d878146f4e3406b5c91", - "sha256:e81469f7d01efed9b53740aedd26085f20d49da65f9c1f41e822a33992cb1590", - "sha256:e8c7e08bb566de4faaf11984af13f6bcf6a08f327b13631d41d62592681d24fe", - "sha256:ed19b3a05ae0c97dd8f75a5d8f21f7723a8c33bbc555da6bbe1f96c470139d3c", - "sha256:efb2d82f33b2212898f1659fb1c2e9ac30493ac41e4d53123da374c3b5541e64", - "sha256:f44dd4d68697559d007462b0a3a1d9acd61d97072b71f6d1968daef26bc744bd", - "sha256:f72cbae7f6b01591f90814250e636065850c5926751af02bb48da94dfced7baa", - "sha256:f7bc09bc9c29ebead055bcba136a67378f03d66bf359e87d0f7c759d6d4ffa31", - "sha256:ff100b203092af77d1a5a7abe085b3506b7eaaf9abf65b73b7d6905b6cb76988" + "sha256:01b689e887f612610c869421241e075c02f2e3d1ae93a037cb14f88ab6a8934c", + "sha256:04ce29e2c5fedf296b1a1b0acc1724ba93a36fb14031f3abfb7abda2806c1535", + "sha256:0ffe3f9d430cd37d8fa5632ff6fb36d5b24818c5c986893063b4e5bdb84cdf24", + "sha256:18300a1d78cf1290fa583cd8b7cde26ecb73e9f5916690cf9d42de569c89b1ce", + "sha256:185e029368d6f89f36e526764cf12bf8d6f0e3a2a7737da625a76f594bdfcbfc", + "sha256:19c65b00d42804e3fbea9708f0937d157e53429a39b7c61253ff15670ff62cb5", + "sha256:228b0d3f567fafa0633aee87f08b9276c7062da9616931382993c03808bb68ce", + "sha256:23acc72f0f4e1a9e6e9843d6328177ae3074b4182167e34119ec7233dfeccf53", + "sha256:25419b70ba00a16abc90ee5fce061228206173231f004437730b67ac77323f0d", + "sha256:2dfbb8baf8ba2c2b9aa2807f44ed272f0913eeeba002478c4577b8d29cde215c", + "sha256:2f1baff13cc2521bea83ab2528e7a80cbe0ebb2c6f0bfad15be7da3aed443908", + "sha256:33e2614a7ce627f0cdf2ad104797d1f68342d967de3695678c0cb84f530709f8", + "sha256:3426de3b91d1bc73249042742f45c2148803c111d1175b283270177fdf669024", + "sha256:382281306e3adaaa7b8b9ebbb3ffb43358a7bbf585fa93821300a418bb975281", + "sha256:3d974d24edb231446f708c455fd08f94c41c1ff4f04bcf06e5f36df5ef50b95a", + "sha256:3f3b6ca8eae6d6c75a6cff525c8530c60e909a71a15e1b731723233331de4169", + "sha256:3fac296f99283ac232d8125be932c5cd7644084a30748fda013028c815ba3364", + "sha256:416c0e4f56308f34cdb18c3f59849479dde5b19febdcd6e6fa4d04b6c31c9faa", + "sha256:438d9f0f4bc64e8dea78274caa5af971ceff0f8771e1a2333620969936ba10be", + "sha256:43affe33137fcd679bdae93fb25924979517e011f9dea99163f80b82eadc7e53", + "sha256:44fc61b99035fd9b3b9453f1713234e5a7c92a04f3577252b45feefe1b327759", + "sha256:45104baae8b9f67569f0f1dca5e1f1ed77a54ae1cd8b0b07aba89272710db61e", + "sha256:4fdd1384619f406ad9037fe6b6eaa3de2749e2e12084abc80169e8e075377d3b", + "sha256:538d30cd96ed7d1416d3956f94d54e426a8daf7c14527f6e0d6d425fcb4cca52", + "sha256:558a57cfc32adcf19d3f791f62b5ff564922942e389e3cfdb538a23d65a6b610", + "sha256:5eefee9bfe23f6df09ffb6dfb23809f4d74a78acef004aa904dc7c88b9944b05", + "sha256:64bd50cf16bcc54b274e20235bf8edbb64184a30e1e53873ff8d444e7ac656b2", + "sha256:65fd3d2e228cae024c411c5ccdffae4c315271eee4a8b839291f84f796b34eca", + "sha256:66b4c0731a5c81921e938dcf1a88e978264e26e6ac4ec96a4d21ae0354581ae0", + "sha256:68a8f8c046c6466ac61a36b65bb2395c74451df2ffb8458492ef49900efed293", + "sha256:6a1141a1dcc32904c47f6846b040275c6e5de0bf73f17d7a409035d55b76f289", + "sha256:6b9fc7e9cc983e75e2518496ba1afc524227c163e43d706688a6bb9eca41617e", + "sha256:6f51f9556785e5a203713f5efd9c085b4a45aecd2a42573e2b5041881b588d1f", + "sha256:7214477bf9bd195894cf24005b1e7b496f46833337b5dedb7b2a6e33f66d962c", + "sha256:731fcd76bbdbf225e2eb85b7c38da9633ad3073822f5ab32379381e8c3c12e94", + "sha256:74007a5b25b7a678459f06559504f1eec2f0f17bca218c9d56f6a0a12bfffdad", + "sha256:7a5486ca56c8869070a966321d5ab416ff0f83f30e0e2da1ab48815c8d165d46", + "sha256:7c479f5ae937ec9985ecaf42e2e10631551d909f203e31308c12d703922742f9", + "sha256:7df9ea48641da022c2a3c9c641650cd09f0cd15e8908bf931ad538f5ca7919c9", + "sha256:7e37e809b9303ec3a179085415cb5f418ecf65ec98cdfe34f6a078b46ef823ee", + "sha256:80c811cfcb5c331237d9bad3bea2c391114588cf4131707e84d9493064d267f9", + "sha256:836d3cc225b3e8a943d0b02633fb2f28a66e281290302a79df0e1eaa984ff7c1", + "sha256:84c312cdf839e8b579f504afcd7b65f35d60b6285d892b19adea16355e8343c9", + "sha256:86b17ba823ea76256b1885652e3a141a99a5c4422f4a869189db328321b73799", + "sha256:871e3ab2838fbcb4e0865a6e01233975df3a15e6fce93b6f99d75cacbd9862d1", + "sha256:88ecc3afd7e776967fa16c80f974cb79399ee8dc6c96423321d6f7d4b881c92b", + "sha256:8bc593dcce679206b60a538c302d03c29b18e3d862609317cb560e18b66d10cf", + "sha256:8fd5afd101dcf86a270d254364e0e8dddedebe6bd1ab9d5f732f274fa00499a5", + "sha256:945352286a541406f99b2655c973852da7911b3f4264e010218bbc1cc73168f2", + "sha256:973335b1624859cb0e52f96062a28aa18f3a5fc77a96e4a3d6d76e29811a0e6e", + "sha256:994448ee01864501912abf2bad9203bffc34158e80fe8bfb5b031f4f8e16da51", + "sha256:9cfd009eed1a46b27c14039ad5bbc5e71b6367c5b2e6d5f5da0ea91600817506", + "sha256:a2ec4419a3fe6cf8a4795752596dfe0adb4aea40d3683a132bae9c30b81e8d73", + "sha256:a4997716674d36a82eab3e86f8fa77080a5d8d96a389a61ea1d0e3a94a582cf7", + "sha256:a512eed9dfd4117110b1881ba9a59b31433caed0c4101b361f768e7bcbaf93c5", + "sha256:a82465ebbc9b1c5c50738536fdfa7cab639a261a99b469c9d4c7dcbb2b3f1e57", + "sha256:ae2757ace61bc4061b69af19e4689fa4416e1a04840f33b441034202b5cd02d4", + "sha256:b16582783f44fbca6fcf46f61347340c787d7530d88b4d590a397a47583f31dd", + "sha256:ba2537ef2163db9e6ccdbeb6f6424282ae4dea43177402152c67ef869cf3978b", + "sha256:bf7a89eef64b5455835f5ed30254ec19bf41f7541cd94f266ab7cbd463f00c41", + "sha256:c0abb5e4e8ce71a61d9446040c1e86d4e6d23f9097275c5bd49ed978755ff0fe", + "sha256:c414cbda77dbf13c3bc88b073a1a9f375c7b0cb5e115e15d4b73ec3a2fbc6f59", + "sha256:c51edc3541e11fbe83f0c4d9412ef6c79f664a3745fab261457e84465ec9d5a8", + "sha256:c5e69fd3eb0b409432b537fe3c6f44ac089c458ab6b78dcec14478422879ec5f", + "sha256:c918b7a1e26b4ab40409820ddccc5d49871a82329640f5005f73572d5eaa9b5e", + "sha256:c9bb87fdf2ab2370f21e4d5636e5317775e5d51ff32ebff2cf389f71b9b13750", + "sha256:ca5b2028c2f7af4e13fb9fc29b28d0ce767c38c7facdf64f6c2cd040413055f1", + "sha256:d0a07763776188b4db4c9c7fb1b8c494049f84659bb387b71c73bbc07f189e96", + "sha256:d33a0021893ede5969876052796165bab6006559ab845fd7b515a30abdd990dc", + "sha256:d55588cba7553f0b6ec33130bc3e114b355570b45785cebdc9daed8c637dd440", + "sha256:dac8e84fff5d27420f3c1e879ce9929108e873667ec87e0c8eeb413a5311adfe", + "sha256:eaef80eac3b4cfbdd6de53c6e108b4c534c21ae055d1dbea2de6b3b8ff3def38", + "sha256:eb462f0e346fcf41a901a126b50f8781e9a474d3927930f3490f38a6e73b6950", + "sha256:eb563dd3aea54c797adf513eeec819c4213d7dbfc311874eb4fd28d10f2ff0f2", + "sha256:f273674b445bcb6e4409bf8d1be67bc4b58e8b46fd0d560055d515b8830063cd", + "sha256:f6442f0f0ff81775eaa5b05af8a0ffa1dda36e9cf6ec1e0d3d245e8564b684ce", + "sha256:fb168b5924bef397b5ba13aabd8cf5df7d3d93f10218d7b925e360d436863f66", + "sha256:fbf8c2f00904eaf63ff37718eb13acf8e178cb940520e47b2f05027f5bb34ce3", + "sha256:fe4ebef608553aff8deb845c7f4f1d0740ff76fa672c011cc0bacb2a00fbde86" ], - "markers": "python_version >= '3.7'", - "version": "==2023.12.25" + "markers": "python_version >= '3.8'", + "version": "==2024.7.24" }, "requests": { "hashes": [ - "sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5", - "sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8" + "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", + "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6" ], - "index": "pypi", "markers": "python_version >= '3.8'", - "version": "==2.32.0" + "version": "==2.32.3" }, "setuptools": { "hashes": [ - "sha256:937a48c7cdb7a21eb53cd7f9b59e525503aa8abaf3584c730dc5f7a5bec3a650", - "sha256:a58a8fde0541dab0419750bcc521fbdf8585f6e5cb41909df3a472ef7b81ca95" + "sha256:5a03e1860cf56bb6ef48ce186b0e557fdba433237481a9a625176c2831be15d1", + "sha256:8d243eff56d095e5817f796ede6ae32941278f542e0f941867cc05ae52b162ec" ], "markers": "python_version >= '3.8'", - "version": "==70.1.1" + "version": "==72.1.0" }, "six": { "hashes": [ @@ -597,10 +615,16 @@ "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472", "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168" ], - "index": "pypi", "markers": "python_version >= '3.8'", "version": "==2.2.2" }, + "verspec": { + "hashes": [ + "sha256:741877d5633cc9464c45a469ae2a31e801e6dbbaa85b9675d481cda100f11c31", + "sha256:c4504ca697b2056cdb4bfa7121461f5a0e81809255b41c03dda4ba823637c01e" + ], + "version": "==0.1.0" + }, "virtualenv": { "hashes": [ "sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a", @@ -611,38 +635,41 @@ }, "watchdog": { "hashes": [ - "sha256:11e12fafb13372e18ca1bbf12d50f593e7280646687463dd47730fd4f4d5d257", - "sha256:2895bf0518361a9728773083908801a376743bcc37dfa252b801af8fd281b1ca", - "sha256:39cb34b1f1afbf23e9562501673e7146777efe95da24fab5707b88f7fb11649b", - "sha256:45cc09cc4c3b43fb10b59ef4d07318d9a3ecdbff03abd2e36e77b6dd9f9a5c85", - "sha256:4986db5e8880b0e6b7cd52ba36255d4793bf5cdc95bd6264806c233173b1ec0b", - "sha256:5369136a6474678e02426bd984466343924d1df8e2fd94a9b443cb7e3aa20d19", - "sha256:557ba04c816d23ce98a06e70af6abaa0485f6d94994ec78a42b05d1c03dcbd50", - "sha256:6a4db54edea37d1058b08947c789a2354ee02972ed5d1e0dca9b0b820f4c7f92", - "sha256:6a80d5cae8c265842c7419c560b9961561556c4361b297b4c431903f8c33b269", - "sha256:6a9c71a0b02985b4b0b6d14b875a6c86ddea2fdbebd0c9a720a806a8bbffc69f", - "sha256:6c47bdd680009b11c9ac382163e05ca43baf4127954c5f6d0250e7d772d2b80c", - "sha256:6e949a8a94186bced05b6508faa61b7adacc911115664ccb1923b9ad1f1ccf7b", - "sha256:73c7a935e62033bd5e8f0da33a4dcb763da2361921a69a5a95aaf6c93aa03a87", - "sha256:76ad8484379695f3fe46228962017a7e1337e9acadafed67eb20aabb175df98b", - "sha256:8350d4055505412a426b6ad8c521bc7d367d1637a762c70fdd93a3a0d595990b", - "sha256:87e9df830022488e235dd601478c15ad73a0389628588ba0b028cb74eb72fed8", - "sha256:8f9a542c979df62098ae9c58b19e03ad3df1c9d8c6895d96c0d51da17b243b1c", - "sha256:8fec441f5adcf81dd240a5fe78e3d83767999771630b5ddfc5867827a34fa3d3", - "sha256:9a03e16e55465177d416699331b0f3564138f1807ecc5f2de9d55d8f188d08c7", - "sha256:ba30a896166f0fee83183cec913298151b73164160d965af2e93a20bbd2ab605", - "sha256:c17d98799f32e3f55f181f19dd2021d762eb38fdd381b4a748b9f5a36738e935", - "sha256:c522392acc5e962bcac3b22b9592493ffd06d1fc5d755954e6be9f4990de932b", - "sha256:d0f9bd1fd919134d459d8abf954f63886745f4660ef66480b9d753a7c9d40927", - "sha256:d18d7f18a47de6863cd480734613502904611730f8def45fc52a5d97503e5101", - "sha256:d31481ccf4694a8416b681544c23bd271f5a123162ab603c7d7d2dd7dd901a07", - "sha256:e3e7065cbdabe6183ab82199d7a4f6b3ba0a438c5a512a68559846ccb76a78ec", - "sha256:eed82cdf79cd7f0232e2fdc1ad05b06a5e102a43e331f7d041e5f0e0a34a51c4", - "sha256:f970663fa4f7e80401a7b0cbeec00fa801bf0287d93d48368fc3e6fa32716245", - "sha256:f9b2fdca47dc855516b2d66eef3c39f2672cbf7e7a42e7e67ad2cbfcd6ba107d" + "sha256:0144c0ea9997b92615af1d94afc0c217e07ce2c14912c7b1a5731776329fcfc7", + "sha256:03e70d2df2258fb6cb0e95bbdbe06c16e608af94a3ffbd2b90c3f1e83eb10767", + "sha256:093b23e6906a8b97051191a4a0c73a77ecc958121d42346274c6af6520dec175", + "sha256:123587af84260c991dc5f62a6e7ef3d1c57dfddc99faacee508c71d287248459", + "sha256:17e32f147d8bf9657e0922c0940bcde863b894cd871dbb694beb6704cfbd2fb5", + "sha256:206afc3d964f9a233e6ad34618ec60b9837d0582b500b63687e34011e15bb429", + "sha256:4107ac5ab936a63952dea2a46a734a23230aa2f6f9db1291bf171dac3ebd53c6", + "sha256:4513ec234c68b14d4161440e07f995f231be21a09329051e67a2118a7a612d2d", + "sha256:611be3904f9843f0529c35a3ff3fd617449463cb4b73b1633950b3d97fa4bfb7", + "sha256:62c613ad689ddcb11707f030e722fa929f322ef7e4f18f5335d2b73c61a85c28", + "sha256:667f3c579e813fcbad1b784db7a1aaa96524bed53437e119f6a2f5de4db04235", + "sha256:6e8c70d2cd745daec2a08734d9f63092b793ad97612470a0ee4cbb8f5f705c57", + "sha256:7577b3c43e5909623149f76b099ac49a1a01ca4e167d1785c76eb52fa585745a", + "sha256:998d2be6976a0ee3a81fb8e2777900c28641fb5bfbd0c84717d89bca0addcdc5", + "sha256:a3c2c317a8fb53e5b3d25790553796105501a235343f5d2bf23bb8649c2c8709", + "sha256:ab998f567ebdf6b1da7dc1e5accfaa7c6992244629c0fdaef062f43249bd8dee", + "sha256:ac7041b385f04c047fcc2951dc001671dee1b7e0615cde772e84b01fbf68ee84", + "sha256:bca36be5707e81b9e6ce3208d92d95540d4ca244c006b61511753583c81c70dd", + "sha256:c9904904b6564d4ee8a1ed820db76185a3c96e05560c776c79a6ce5ab71888ba", + "sha256:cad0bbd66cd59fc474b4a4376bc5ac3fc698723510cbb64091c2a793b18654db", + "sha256:d10a681c9a1d5a77e75c48a3b8e1a9f2ae2928eda463e8d33660437705659682", + "sha256:d4925e4bf7b9bddd1c3de13c9b8a2cdb89a468f640e66fbfabaf735bd85b3e35", + "sha256:d7b9f5f3299e8dd230880b6c55504a1f69cf1e4316275d1b215ebdd8187ec88d", + "sha256:da2dfdaa8006eb6a71051795856bedd97e5b03e57da96f98e375682c48850645", + "sha256:dddba7ca1c807045323b6af4ff80f5ddc4d654c8bce8317dde1bd96b128ed253", + "sha256:e7921319fe4430b11278d924ef66d4daa469fafb1da679a2e48c935fa27af193", + "sha256:e93f451f2dfa433d97765ca2634628b789b49ba8b504fdde5837cdcf25fdb53b", + "sha256:eebaacf674fa25511e8867028d281e602ee6500045b57f43b08778082f7f8b44", + "sha256:ef0107bbb6a55f5be727cfc2ef945d5676b97bffb8425650dadbb184be9f9a2b", + "sha256:f0de0f284248ab40188f23380b03b59126d1479cd59940f2a34f8852db710625", + "sha256:f27279d060e2ab24c0aa98363ff906d2386aa6c4dc2f1a374655d4e02a6c5e5e", + "sha256:f8affdf3c0f0466e69f5b3917cdd042f89c8c63aebdb9f7c078996f607cdb0f5" ], "markers": "python_version >= '3.8'", - "version": "==4.0.0" + "version": "==4.0.1" }, "yamllint": { "hashes": [ @@ -652,6 +679,14 @@ "index": "pypi", "markers": "python_version >= '3.8'", "version": "==1.35.1" + }, + "zipp": { + "hashes": [ + "sha256:bf1dcf6450f873a13e952a29504887c89e6de7506209e5b1bcc3460135d4de19", + "sha256:f091755f667055f2d02b32c53771a7a6c8b47e1fdbc4b72a8b9072b3eef8015c" + ], + "markers": "python_version >= '3.8'", + "version": "==3.19.2" } }, "develop": {} diff --git a/crates/infra/cli/src/commands/check/mod.rs b/crates/infra/cli/src/commands/check/mod.rs index c20c749e0d..4f439fc367 100644 --- a/crates/infra/cli/src/commands/check/mod.rs +++ b/crates/infra/cli/src/commands/check/mod.rs @@ -78,5 +78,5 @@ fn check_npm() -> Result<()> { } fn check_mkdocs() -> Result<()> { - Mkdocs::build() + Mkdocs::check() } diff --git a/crates/infra/cli/src/commands/lint/mod.rs b/crates/infra/cli/src/commands/lint/mod.rs index 9d3ee7ee08..cb34c055f2 100644 --- a/crates/infra/cli/src/commands/lint/mod.rs +++ b/crates/infra/cli/src/commands/lint/mod.rs @@ -7,6 +7,7 @@ use infra_utils::github::GitHub; use infra_utils::paths::{FileWalker, PathExtensions}; use infra_utils::terminal::Terminal; +use crate::toolchains::pipenv::PipEnv; use crate::utils::{ClapExtensions, OrderedCommand}; #[derive(Clone, Debug, Default, Parser)] @@ -143,9 +144,7 @@ fn run_yamllint() -> Result<()> { path }); - return Command::new("python3") - .property("-m", "pipenv") - .args(["run", "yamllint"]) + return PipEnv::run("yamllint") .flag("--strict") .property("--config-file", config_file.unwrap_str()) .run_xargs(yaml_files); diff --git a/crates/infra/cli/src/commands/mod.rs b/crates/infra/cli/src/commands/mod.rs index 55446870c8..30b8e9fd41 100644 --- a/crates/infra/cli/src/commands/mod.rs +++ b/crates/infra/cli/src/commands/mod.rs @@ -71,16 +71,16 @@ impl Cli { impl AppCommand { pub fn execute(&self) -> Result<()> { match self { - AppCommand::Setup(command) => command.execute(), - AppCommand::Check(command) => command.execute(), - AppCommand::Test(command) => command.execute(), - AppCommand::Lint(command) => command.execute(), - AppCommand::Ci(command) => command.execute(), - AppCommand::Run(command) => command.execute(), - AppCommand::Watch(command) => command.execute(), - AppCommand::Perf(command) => command.execute(), - AppCommand::Publish(command) => command.execute(), - AppCommand::Completions(command) => command.execute(), + AppCommand::Setup(controller) => controller.execute(), + AppCommand::Check(controller) => controller.execute(), + AppCommand::Test(controller) => controller.execute(), + AppCommand::Lint(controller) => controller.execute(), + AppCommand::Ci(controller) => controller.execute(), + AppCommand::Run(controller) => controller.execute(), + AppCommand::Watch(controller) => controller.execute(), + AppCommand::Perf(controller) => controller.execute(), + AppCommand::Publish(controller) => controller.execute(), + AppCommand::Completions(controller) => controller.execute(), } } } diff --git a/crates/infra/cli/src/commands/publish/cargo/mod.rs b/crates/infra/cli/src/commands/publish/cargo/mod.rs index f67cbad9b6..1e32d3389c 100644 --- a/crates/infra/cli/src/commands/publish/cargo/mod.rs +++ b/crates/infra/cli/src/commands/publish/cargo/mod.rs @@ -2,14 +2,14 @@ use std::iter::once; use std::path::Path; use anyhow::Result; +use clap::Parser; use infra_utils::cargo::CargoWorkspace; use infra_utils::commands::Command; use infra_utils::git::TemporaryChangeset; -use infra_utils::github::GitHub; use infra_utils::paths::PathExtensions; use itertools::Itertools; -use crate::commands::publish::DryRun; +use crate::utils::DryRun; const USER_FACING_CRATES: &[&str] = &[ // Sorted by dependency order (from dependencies to dependents): @@ -19,36 +19,44 @@ const USER_FACING_CRATES: &[&str] = &[ "slang_solidity", ]; -pub fn publish_cargo(dry_run: DryRun) -> Result<()> { - let mut changeset = TemporaryChangeset::new( - "infra/cargo-publish", - "prepare Cargo packages for publishing", - )?; +#[derive(Clone, Debug, Parser)] +pub struct CargoController { + #[command(flatten)] + dry_run: DryRun, +} + +impl CargoController { + pub fn execute(&self) -> Result<()> { + let mut changeset = TemporaryChangeset::new( + "infra/cargo-publish", + "prepare Cargo packages for publishing", + )?; - let mut changed_crates = vec![]; + let mut changed_crates = vec![]; - for crate_name in USER_FACING_CRATES { - if prepare_for_publish(crate_name, &mut changeset)? { - changed_crates.push(crate_name); + for crate_name in USER_FACING_CRATES { + if prepare_for_publish(crate_name, &mut changeset)? { + changed_crates.push(crate_name); + } } - } - if changed_crates.is_empty() { - println!("No crates to publish."); - return Ok(()); - } + if changed_crates.is_empty() { + println!("No crates to publish."); + return Ok(()); + } - update_cargo_lock(&mut changeset)?; + update_cargo_lock(&mut changeset)?; - changeset.commit_changes()?; + changeset.commit_changes()?; - for crate_name in &changed_crates { - run_cargo_publish(crate_name, dry_run)?; - } + for crate_name in &changed_crates { + run_cargo_publish(crate_name, self.dry_run)?; + } - changeset.revert_changes()?; + changeset.revert_changes()?; - Ok(()) + Ok(()) + } } fn prepare_for_publish(crate_name: &str, changeset: &mut TemporaryChangeset) -> Result { @@ -120,10 +128,7 @@ fn run_cargo_publish(crate_name: &str, dry_run: DryRun) -> Result<()> { .property("--package", crate_name) .flag("--all-features"); - if dry_run.is_yes() || !GitHub::is_running_in_ci() { - println!( - "Attempting a dry run, since we are not running in CI or a dry run was requested." - ); + if dry_run.get() { command = command.flag("--dry-run"); } diff --git a/crates/infra/cli/src/commands/publish/changesets/mod.rs b/crates/infra/cli/src/commands/publish/changesets/mod.rs index 4186f025aa..8208e5d25e 100644 --- a/crates/infra/cli/src/commands/publish/changesets/mod.rs +++ b/crates/infra/cli/src/commands/publish/changesets/mod.rs @@ -1,96 +1,104 @@ +//! This repository versions and releases all its artifacts together, generating the same changelog. +//! Unfortunately, changesets does not support combining changelogs from multiple packages into one. +//! +//! So, we let changesets bump the version of the single NPM package we ship, and generate its changelog. +//! Then our build process copies the new version and the single changelog to other packages and crates. +//! +//! Additionally, changesets can only bump versions of packages in the root workspace. +//! However, NAPI platform-specific packages cannot be added to the workspace, because other platforms will fail "npm install". +//! So we have to bump the versions over ourselves anyways. + use anyhow::Result; +use clap::Parser; use infra_utils::cargo::CargoWorkspace; use infra_utils::commands::Command; use infra_utils::paths::{FileWalker, PathExtensions}; use crate::toolchains::napi::{NapiConfig, NapiResolver}; -/// This repository versions and releases all its artifacts together, generating the same changelog. -/// Unfortunately, changesets does not support combining changelogs from multiple packages into one. -/// -/// So, we let changesets bump the version of the single NPM package we ship, and generate its changelog. -/// Then our build process copies the new version and the single changelog to other packages and crates. -/// -/// Additionally, changesets can only bump versions of packages in the root workspace. -/// However, NAPI platform-specific packages cannot be added to the workspace, because other platforms will fail "npm install". -/// So we have to bump the versions over ourselves anyways. -pub fn publish_changesets() -> Result<()> { - let resolver = NapiResolver::Solidity; - let package_dir = resolver.main_package_dir(); - - let package_version = NapiConfig::local_version(&package_dir)?; - println!("Package version: {package_version}"); - - let workspace_version = CargoWorkspace::local_version()?; - println!("Workspace version: {workspace_version}"); - - assert_eq!( - package_version, workspace_version, - "Package version does not match workspace version." - ); - - // This command will: - // 1) Consume/delete any changeset files currently in "$REPO_ROOT/.changeset" - // 2) Update the CHANGELOG.md file for the NPM package. - // 3) Bump the version in its package.json accordingly. - - Command::new("changeset").arg("version").run()?; - - let updated_version = NapiConfig::local_version(&package_dir)?; - println!("Updated version: {updated_version}"); - - if package_version == updated_version { - println!("No version changes. Skipping."); - return Ok(()); - } +#[derive(Clone, Debug, Parser)] +pub struct ChangesetsController {} + +impl ChangesetsController { + #[allow(clippy::unused_self)] // for compatibility with other controllers: + pub fn execute(&self) -> Result<()> { + let resolver = NapiResolver::Solidity; + let package_dir = resolver.main_package_dir(); + + let package_version = NapiConfig::local_version(&package_dir)?; + println!("Package version: {package_version}"); - // Format the updated package files: + let workspace_version = CargoWorkspace::local_version()?; + println!("Workspace version: {workspace_version}"); - let package_dir = resolver.main_package_dir(); - Command::new("prettier") - .property("--write", package_dir.unwrap_str()) - .run()?; + assert_eq!( + package_version, workspace_version, + "Package version does not match workspace version." + ); - // Update NPM lock file: + // This command will: + // 1) Consume/delete any changeset files currently in "$REPO_ROOT/.changeset" + // 2) Update the CHANGELOG.md file for the NPM package. + // 3) Bump the version in its package.json accordingly. - Command::new("npm") - .arg("install") - .flag("--package-lock-only") - .run()?; + Command::new("changeset").arg("version").run()?; + + let updated_version = NapiConfig::local_version(&package_dir)?; + println!("Updated version: {updated_version}"); + + if package_version == updated_version { + println!("No version changes. Skipping."); + return Ok(()); + } - // Update Cargo workspace: + // Format the updated package files: - println!("Updating Cargo workspace version."); - CargoWorkspace::update_version(&updated_version)?; + let package_dir = resolver.main_package_dir(); + Command::new("prettier") + .property("--write", package_dir.unwrap_str()) + .run()?; - // Update Cargo lock file: + // Update NPM lock file: - Command::new("cargo") - .arg("update") - .flag("--workspace") - .run()?; + Command::new("npm") + .arg("install") + .flag("--package-lock-only") + .run()?; - // Update other CHANGELOG files: + // Update Cargo workspace: - let source_changelog = package_dir.join("CHANGELOG.md"); + println!("Updating Cargo workspace version."); + CargoWorkspace::update_version(&updated_version)?; - for destination_changelog in FileWalker::from_repo_root().find(["**/CHANGELOG.md"])? { - if source_changelog != destination_changelog { - println!("Updating: {destination_changelog:?}"); - std::fs::copy(&source_changelog, &destination_changelog)?; + // Update Cargo lock file: + + Command::new("cargo") + .arg("update") + .flag("--workspace") + .run()?; + + // Update other CHANGELOG files: + + let source_changelog = package_dir.join("CHANGELOG.md"); + + for destination_changelog in FileWalker::from_repo_root().find(["**/CHANGELOG.md"])? { + if source_changelog != destination_changelog { + println!("Updating: {destination_changelog:?}"); + std::fs::copy(&source_changelog, &destination_changelog)?; + } } - } - Command::new("git") - .args(["stash", "push"]) - .flag("--include-untracked") - .property("--message", "applied changesets") - .run()?; + Command::new("git") + .args(["stash", "push"]) + .flag("--include-untracked") + .property("--message", "applied changesets") + .run()?; - println!(); - println!("Source files are now updated with the new version, and stored in a 'git stash'."); - println!("The calling CI workflow will now use this stash to create a PR if needed."); - println!(); + println!(); + println!("Source files are now updated with the new version, and stored in a 'git stash'."); + println!("The calling CI workflow will now use this stash to create a PR if needed."); + println!(); - Ok(()) + Ok(()) + } } diff --git a/crates/infra/cli/src/commands/publish/github_release/mod.rs b/crates/infra/cli/src/commands/publish/github_release/mod.rs index 5ecba370f2..db6d2ab72e 100644 --- a/crates/infra/cli/src/commands/publish/github_release/mod.rs +++ b/crates/infra/cli/src/commands/publish/github_release/mod.rs @@ -1,6 +1,7 @@ use std::path::Path; use anyhow::Result; +use clap::Parser; use infra_utils::cargo::CargoWorkspace; use infra_utils::github::GitHub; use infra_utils::paths::PathExtensions; @@ -8,34 +9,41 @@ use itertools::Itertools; use markdown::{Block, Span}; use semver::Version; -use crate::commands::publish::DryRun; +use crate::utils::DryRun; -pub fn publish_github_release(dry_run: DryRun) -> Result<()> { - let current_version = CargoWorkspace::local_version()?; - println!("Current version: {current_version}"); +#[derive(Clone, Debug, Parser)] +pub struct GithubReleaseController { + #[command(flatten)] + dry_run: DryRun, +} - let previous_version = GitHub::latest_release_version()?; - println!("Latest published version: {previous_version}"); +impl GithubReleaseController { + pub fn execute(&self) -> Result<()> { + let current_version = CargoWorkspace::local_version()?; + println!("Current version: {current_version}"); - if current_version == previous_version { - println!("Skipping release, since the workspace version is already published."); - return Ok(()); - } + let previous_version = GitHub::latest_release_version()?; + println!("Latest published version: {previous_version}"); - let notes = extract_latest_changelogs(¤t_version, &previous_version)?; - let tag_name = format!("v{current_version}"); + if current_version == previous_version { + println!("Skipping release, since the workspace version is already published."); + return Ok(()); + } - println!("Creating release '{tag_name}' with contents:"); - println!(); - println!("{}", notes.lines().map(|l| format!(" │ {l}")).join("\n")); - println!(); + let notes = extract_latest_changelogs(¤t_version, &previous_version)?; + let tag_name = format!("v{current_version}"); - if dry_run.is_yes() || !GitHub::is_running_in_ci() { - println!("Skipping release, since we are not running in CI or a dry run was requested."); - return Ok(()); - } + println!("Creating release '{tag_name}' with contents:"); + println!(); + println!("{}", notes.lines().map(|l| format!(" │ {l}")).join("\n")); + println!(); - GitHub::create_new_release(tag_name, notes) + if self.dry_run.get() { + return Ok(()); + } + + GitHub::create_new_release(tag_name, notes) + } } fn extract_latest_changelogs( diff --git a/crates/infra/cli/src/commands/publish/mkdocs/mod.rs b/crates/infra/cli/src/commands/publish/mkdocs/mod.rs new file mode 100644 index 0000000000..fcd505917e --- /dev/null +++ b/crates/infra/cli/src/commands/publish/mkdocs/mod.rs @@ -0,0 +1,30 @@ +use anyhow::Result; +use clap::{Parser, ValueEnum}; + +use crate::toolchains::mkdocs::Mkdocs; +use crate::utils::DryRun; + +#[derive(Clone, Debug, Parser)] +pub struct MkdocsController { + /// The target version to publish. + #[arg(long)] + target: PublishTarget, + + #[command(flatten)] + dry_run: DryRun, +} + +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, ValueEnum)] +enum PublishTarget { + MainBranch, + LatestRelease, +} + +impl MkdocsController { + pub fn execute(&self) -> Result<()> { + match self.target { + PublishTarget::MainBranch => Mkdocs::publish_main_branch(self.dry_run), + PublishTarget::LatestRelease => Mkdocs::publish_latest_release(self.dry_run), + } + } +} diff --git a/crates/infra/cli/src/commands/publish/mod.rs b/crates/infra/cli/src/commands/publish/mod.rs index 3386e7579f..7d4660a1ef 100644 --- a/crates/infra/cli/src/commands/publish/mod.rs +++ b/crates/infra/cli/src/commands/publish/mod.rs @@ -1,71 +1,52 @@ mod cargo; mod changesets; mod github_release; +mod mkdocs; mod npm; use anyhow::Result; -use clap::{Parser, ValueEnum}; -use infra_utils::terminal::Terminal; +use clap::{Parser, Subcommand}; -use crate::commands::publish::cargo::publish_cargo; -use crate::commands::publish::changesets::publish_changesets; -use crate::commands::publish::github_release::publish_github_release; -use crate::commands::publish::npm::publish_npm; -use crate::utils::ClapExtensions; +use crate::commands::publish::cargo::CargoController; +use crate::commands::publish::changesets::ChangesetsController; +use crate::commands::publish::github_release::GithubReleaseController; +use crate::commands::publish::mkdocs::MkdocsController; +use crate::commands::publish::npm::NpmController; #[derive(Clone, Debug, Parser)] pub struct PublishController { + #[command(subcommand)] command: PublishCommand, - - #[arg(long)] - dry_run: bool, -} - -#[derive(Clone, Copy)] -enum DryRun { - Yes, - No, -} - -impl DryRun { - fn is_yes(self) -> bool { - matches!(self, DryRun::Yes) - } -} - -impl From for DryRun { - fn from(value: bool) -> Self { - if value { - DryRun::Yes - } else { - DryRun::No - } - } } -#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, ValueEnum)] -enum PublishCommand { +#[derive(Clone, Debug, Subcommand)] +pub enum PublishCommand { /// Consume pending changesets, update changelogs and package versions, then send a PR. - Changesets, + Changesets(ChangesetsController), + /// Publish the documentation to GitHub pages. + Mkdocs(MkdocsController), /// Publish source packages to [npmjs.com]. - Npm, + Npm(NpmController), /// Publish source crates to [crates.io]. - Cargo, + Cargo(CargoController), /// Publish a new release in the GitHub repository. - GithubRelease, + GithubRelease(GithubReleaseController), } impl PublishController { pub fn execute(&self) -> Result<()> { - Terminal::step(format!("publish {name}", name = self.command.clap_name())); - - let dry_run = DryRun::from(self.dry_run); + self.command.execute() + } +} - match self.command { - PublishCommand::Changesets => publish_changesets(), - PublishCommand::Npm => publish_npm(dry_run), - PublishCommand::Cargo => publish_cargo(dry_run), - PublishCommand::GithubRelease => publish_github_release(dry_run), +impl PublishCommand { + pub fn execute(&self) -> Result<()> { + match self { + PublishCommand::Changesets(controller) => controller.execute(), + PublishCommand::Mkdocs(controller) => controller.execute(), + PublishCommand::Npm(controller) => controller.execute(), + PublishCommand::Cargo(controller) => controller.execute(), + PublishCommand::GithubRelease(controller) => controller.execute(), } } } diff --git a/crates/infra/cli/src/commands/publish/npm/mod.rs b/crates/infra/cli/src/commands/publish/npm/mod.rs index 6c52c523b4..8ee151063b 100644 --- a/crates/infra/cli/src/commands/publish/npm/mod.rs +++ b/crates/infra/cli/src/commands/publish/npm/mod.rs @@ -1,36 +1,44 @@ use std::path::Path; use anyhow::Result; +use clap::Parser; use infra_utils::commands::Command; -use infra_utils::github::GitHub; use infra_utils::paths::PathExtensions; -use crate::commands::publish::DryRun; use crate::toolchains::napi::{ NapiCompiler, NapiConfig, NapiPackageKind, NapiProfile, NapiResolver, }; +use crate::utils::DryRun; -pub fn publish_npm(dry_run: DryRun) -> Result<()> { - let resolver = NapiResolver::Solidity; +#[derive(Clone, Debug, Parser)] +pub struct NpmController { + #[command(flatten)] + dry_run: DryRun, +} - NapiCompiler::run(resolver, NapiProfile::Release)?; +impl NpmController { + pub fn execute(&self) -> Result<()> { + let resolver = NapiResolver::Solidity; - // Publish platform-specific packages first, as the main package now depends on their latest version: + NapiCompiler::run(resolver, NapiProfile::Release)?; - for platform_dir in resolver.platforms_dir().collect_children()? { - let platform = platform_dir.unwrap_name().to_owned(); - publish_package( - resolver, - &platform_dir, - &NapiPackageKind::Platform(platform), - dry_run, - )?; - } + // Publish platform-specific packages first, as the main package now depends on their latest version: - // Then publish the main package, that depends on the previously published platform-specific packages: + for platform_dir in resolver.platforms_dir().collect_children()? { + let platform = platform_dir.unwrap_name().to_owned(); + publish_package( + resolver, + &platform_dir, + &NapiPackageKind::Platform(platform), + self.dry_run, + )?; + } - let package_dir = resolver.main_package_dir(); - publish_package(resolver, &package_dir, &NapiPackageKind::Main, dry_run) + // Then publish the main package, that depends on the previously published platform-specific packages: + + let package_dir = resolver.main_package_dir(); + publish_package(resolver, &package_dir, &NapiPackageKind::Main, self.dry_run) + } } fn publish_package( @@ -58,8 +66,7 @@ fn publish_package( .args(["publish", output_dir.unwrap_str()]) .property("--access", "public"); - if dry_run.is_yes() || !GitHub::is_running_in_ci() { - println!("Doing a dry run, since we are not running in CI or a dry run was requested."); + if dry_run.get() { command = command.flag("--dry-run"); } diff --git a/crates/infra/cli/src/commands/setup/git/mod.rs b/crates/infra/cli/src/commands/setup/git/mod.rs new file mode 100644 index 0000000000..dfc8c11507 --- /dev/null +++ b/crates/infra/cli/src/commands/setup/git/mod.rs @@ -0,0 +1,22 @@ +use anyhow::Result; +use infra_utils::commands::Command; +use infra_utils::github::GitHub; + +pub fn setup_git() -> Result<()> { + if !GitHub::is_running_in_ci() { + println!("No need to modify local dev environments."); + return Ok(()); + } + + Command::new("git") + .arg("config") + .property("user.name", "github-actions") + .run()?; + + Command::new("git") + .arg("config") + .property("user.email", "github-actions@users.noreply.github.com") + .run()?; + + Ok(()) +} diff --git a/crates/infra/cli/src/commands/setup/mod.rs b/crates/infra/cli/src/commands/setup/mod.rs index 481bcbad78..1663ef984c 100644 --- a/crates/infra/cli/src/commands/setup/mod.rs +++ b/crates/infra/cli/src/commands/setup/mod.rs @@ -1,4 +1,5 @@ mod cargo; +mod git; mod npm; mod pipenv; mod shell_completions; @@ -8,6 +9,7 @@ use clap::{Parser, ValueEnum}; use infra_utils::terminal::Terminal; use crate::commands::setup::cargo::setup_cargo; +use crate::commands::setup::git::setup_git; use crate::commands::setup::npm::setup_npm; use crate::commands::setup::pipenv::setup_pipenv; use crate::commands::setup::shell_completions::setup_shell_completions; @@ -27,6 +29,8 @@ impl SetupController { #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, ValueEnum)] enum SetupCommand { + /// Prepare the local git client/repository. + Git, /// Install Cargo dependencies. Cargo, /// Install NPM dependencies. @@ -42,6 +46,7 @@ impl OrderedCommand for SetupCommand { Terminal::step(format!("setup {name}", name = self.clap_name())); match self { + SetupCommand::Git => setup_git(), SetupCommand::Cargo => setup_cargo(), SetupCommand::Npm => setup_npm(), SetupCommand::Pipenv => setup_pipenv(), diff --git a/crates/infra/cli/src/commands/setup/pipenv/mod.rs b/crates/infra/cli/src/commands/setup/pipenv/mod.rs index fd6b01ca59..6258afaf59 100644 --- a/crates/infra/cli/src/commands/setup/pipenv/mod.rs +++ b/crates/infra/cli/src/commands/setup/pipenv/mod.rs @@ -1,52 +1,7 @@ -use std::collections::HashMap; -use std::path::Path; +use anyhow::Result; -use anyhow::{Context, Result}; -use infra_utils::commands::Command; -use infra_utils::github::GitHub; -use infra_utils::paths::PathExtensions; -use serde::Deserialize; +use crate::toolchains::pipenv::PipEnv; pub fn setup_pipenv() -> Result<()> { - // Install the 'pipenv' binary using the version defined in the `Pipfile`. - install_pipenv_binary()?; - - // Use it to install other dependencies: - install_project_packages()?; - - Ok(()) -} - -#[derive(Deserialize)] -struct Pipfile { - packages: HashMap, -} - -fn install_pipenv_binary() -> Result<()> { - let pip_file_toml = Path::repo_path("Pipfile").read_to_string()?; - let pip_file: Pipfile = toml::from_str(&pip_file_toml)?; - - // This should be a value like "==YYYY.MM.DD" - let version = pip_file - .packages - .get("pipenv") - .context("Failed to find 'pipenv' in 'Pipfile' packages.")?; - - // pip3 install "pipenv==YYYY.MM.DD" - Command::new("pip3") - .arg("install") - .arg(format!("pipenv{version}")) - .run() -} - -fn install_project_packages() -> Result<()> { - let mut command = Command::new("python3") - .property("-m", "pipenv") - .arg("install"); - - if GitHub::is_running_in_ci() { - command = command.flag("--deploy"); - } - - command.run() + PipEnv::install_packages() } diff --git a/crates/infra/cli/src/toolchains/mkdocs/mod.rs b/crates/infra/cli/src/toolchains/mkdocs/mod.rs index 2565891d6e..6d1487e43d 100644 --- a/crates/infra/cli/src/toolchains/mkdocs/mod.rs +++ b/crates/infra/cli/src/toolchains/mkdocs/mod.rs @@ -1,36 +1,77 @@ use std::path::Path; use anyhow::Result; +use infra_utils::cargo::CargoWorkspace; use infra_utils::commands::Command; use infra_utils::paths::PathExtensions; +use crate::toolchains::pipenv::PipEnv; +use crate::utils::DryRun; + pub struct Mkdocs; impl Mkdocs { - pub fn build() -> Result<()> { - mkdocs_command() - .arg("build") - .flag("--clean") - .flag("--strict") - .run() + pub fn check() -> Result<()> { + mkdocs().arg("build").flag("--clean").flag("--strict").run() } pub fn watch() -> Result<()> { // _MKDOCS_WATCH_PORT_ | keep in sync with the port number defined in "$REPO_ROOT/.devcontainer/devcontainer.json" const PORT: usize = 5353; - mkdocs_command() + mkdocs() .arg("serve") .flag("--clean") .flag("--watch-theme") .property("--dev-addr", format!("localhost:{PORT}")) .run() } + + pub fn publish_main_branch(dry_run: DryRun) -> Result<()> { + fetch_latest_remote()?; + + let mut command = mike().args(["deploy", "main"]); + + if !dry_run.get() { + command = command.flag("--push"); + } + + command.run() + } + + pub fn publish_latest_release(dry_run: DryRun) -> Result<()> { + fetch_latest_remote()?; + + let version = CargoWorkspace::local_version()?.to_string(); + + if mike().args(["list", &version]).run().is_ok() { + println!("Version '{version}' is already published."); + return Ok(()); + } + + let mut command = mike() + .args(["deploy", &version, "latest"]) + .flag("--update-aliases"); + + if !dry_run.get() { + command = command.flag("--push"); + } + + command.run() + } +} + +fn fetch_latest_remote() -> Result<()> { + Command::new("git") + .args(["fetch", "origin", "gh-pages"]) + .property("--depth", "1") + .run() +} + +fn mkdocs() -> Command { + PipEnv::run("mkdocs").current_dir(Path::repo_path("documentation")) } -fn mkdocs_command() -> Command { - Command::new("python3") - .property("-m", "pipenv") - .args(["run", "mkdocs"]) - .current_dir(Path::repo_path("documentation")) +fn mike() -> Command { + PipEnv::run("mike").current_dir(Path::repo_path("documentation")) } diff --git a/crates/infra/cli/src/toolchains/mod.rs b/crates/infra/cli/src/toolchains/mod.rs index 1c4e299b68..4220506bae 100644 --- a/crates/infra/cli/src/toolchains/mod.rs +++ b/crates/infra/cli/src/toolchains/mod.rs @@ -1,2 +1,3 @@ pub mod mkdocs; pub mod napi; +pub mod pipenv; diff --git a/crates/infra/cli/src/toolchains/pipenv/mod.rs b/crates/infra/cli/src/toolchains/pipenv/mod.rs new file mode 100644 index 0000000000..10c460b239 --- /dev/null +++ b/crates/infra/cli/src/toolchains/pipenv/mod.rs @@ -0,0 +1,53 @@ +use std::collections::HashMap; +use std::path::Path; + +use anyhow::{Context, Result}; +use infra_utils::commands::Command; +use infra_utils::github::GitHub; +use infra_utils::paths::PathExtensions; +use serde::Deserialize; + +pub struct PipEnv; + +impl PipEnv { + pub fn install_packages() -> Result<()> { + let pip_file_toml = Path::repo_path("Pipfile").read_to_string()?; + let pip_file: Pipfile = toml::from_str(&pip_file_toml)?; + + // This should be a value like "==YYYY.MM.DD" + let version = pip_file + .packages + .get("pipenv") + .context("Failed to find 'pipenv' in 'Pipfile' packages.")?; + + // pip3 install "pipenv==YYYY.MM.DD" + Command::new("pip3") + .arg("install") + .arg(format!("pipenv{version}")) + .run()?; + + let mut command = Command::new("python3") + .property("-m", "pipenv") + .arg("install"); + + if GitHub::is_running_in_ci() { + command = command.flag("--deploy"); + } + + command.run()?; + + Ok(()) + } + + #[must_use] + pub fn run(name: impl Into) -> Command { + Command::new("python3") + .property("-m", "pipenv") + .args(["run", &name.into()]) + } +} + +#[derive(Deserialize)] +struct Pipfile { + packages: HashMap, +} diff --git a/crates/infra/cli/src/utils.rs b/crates/infra/cli/src/utils.rs index 944c25a7bd..df673fd7fa 100644 --- a/crates/infra/cli/src/utils.rs +++ b/crates/infra/cli/src/utils.rs @@ -1,5 +1,6 @@ use anyhow::{Ok, Result}; -use clap::ValueEnum; +use clap::{Parser, ValueEnum}; +use infra_utils::github::GitHub; pub trait OrderedCommand: Clone + Ord + PartialEq + ValueEnum { fn execute(&self) -> Result<()>; @@ -37,3 +38,25 @@ impl ClapExtensions for T { .to_owned(); } } + +#[derive(Clone, Copy, Debug, Parser)] +pub struct DryRun { + /// Attempt a dry run, instead of actually executing the command. + #[arg(long)] + dry_run: bool, +} + +impl DryRun { + pub fn get(self) -> bool { + if self.dry_run { + println!("Performing a dry run, since it was requested on the command line."); + true + } else if !GitHub::is_running_in_ci() { + println!("Performing a dry run, since we are not running in CI."); + true + } else { + println!("Performing a full run. You can pass '--dry-run' to simulate the execution."); + false + } + } +} diff --git a/crates/infra/utils/src/git/mod.rs b/crates/infra/utils/src/git/mod.rs index d628d1774b..d0850dac66 100644 --- a/crates/infra/utils/src/git/mod.rs +++ b/crates/infra/utils/src/git/mod.rs @@ -62,8 +62,6 @@ impl TemporaryChangeset { Command::new("git").arg("diff").flag("--cached").run()?; Command::new("git") - .property("-c", "user.name=github-actions") - .property("-c", "user.email=github-actions@users.noreply.github.com") .arg("commit") .property("--message", &self.message) .run()?; diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml index 0aff27f51c..7f99f747dd 100644 --- a/documentation/mkdocs.yml +++ b/documentation/mkdocs.yml @@ -11,8 +11,8 @@ site_description: > Written in Rust and distributed in multiple languages. repo_name: "NomicFoundation/slang" -repo_url: "https://github.com/NomicFoundation/slang" -site_url: "https://NomicFoundation.github.io/slang" +repo_url: "https://github.com/NomicFoundation/slang/" +site_url: "https://NomicFoundation.github.io/slang/" edit_uri: "edit/main/documentation/public" docs_dir: "./public" @@ -59,6 +59,10 @@ extra: link: "https://twitter.com/nomicfoundation/" - icon: "fontawesome/solid/link" link: "https://nomic.foundation/" + version: + provider: "mike" + alias: true + default: "latest" # # Extensions: @@ -93,6 +97,8 @@ plugins: - "literate-nav": nav_file: ".navigation.md" # use a dot file name, to be excluded from public pages markdown_extensions: [] + - "mike": + canonical_version: "latest" - "minify": minify_html: true minify_js: true diff --git a/documentation/overrides/main.html b/documentation/overrides/main.html new file mode 100644 index 0000000000..a0461e1a0f --- /dev/null +++ b/documentation/overrides/main.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block outdated %} + You're not viewing the latest released version. + + Click here to go to the latest. + +{% endblock %}