From a0c37ecb54b66b137b48950c8b30dabaede55898 Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Sat, 1 Mar 2025 18:42:49 -0500 Subject: [PATCH 1/4] add rustc as requirement for cargo install - move the `cargo install` to the last option - add the requirement - modify the requirement (in both cases) to 1.76.0, to trigger a failure so that I can make sure it works - change the checker to use just plain grep, and include the file name and line number, so I can use them in the workflow commands --- .github/workflows/readme-checks.yml | 28 ++++++++++++++-------------- README.md | 14 ++++++++------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/readme-checks.yml b/.github/workflows/readme-checks.yml index 92dccbd..ae1adf5 100644 --- a/.github/workflows/readme-checks.yml +++ b/.github/workflows/readme-checks.yml @@ -14,12 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - run: docker pull yshavit/mdq - - name: find version mentioned in readme - id: readme-version - run: | - set -euo pipefail - readme_version="$(cat README.md | docker run -i --rm yshavit/mdq '# Development | P: "Requires rustc >=" ' | awk '{print $NF}')" - echo "result=$readme_version" >> "$GITHUB_OUTPUT" - name: pull cargo-msrv from docker hub run: docker pull foresterre/cargo-msrv - name: find minimum supported rust version @@ -27,15 +21,21 @@ jobs: run: | set -euo pipefail min_version="$(docker run --rm -t -v "$PWD/":/app/ foresterre/cargo-msrv find --no-log --output-format minimal | tr -d $'\r\n')" + echo "::notice title=cargo-msrv::$min_version" echo "result=$min_version" >> "$GITHUB_OUTPUT" - - name: compare versions + - name: check versions in readme + id: readme-version run: | - echo "::notice title=cargo-msrv::$MSRV_VERSION" - echo "::notice title=README.md-msrv::$README_VERSION" - if [[ "$MSRV_VERSION" != "$README_VERSION" ]]; then - echo "::error title=msrv-mismatch::cargo-msrv was $MSRV_VERSION but README.md says rustc >= $README_VERSION" - exit 1 - fi + set -euo pipefail + exit_code=0 + while IFS=: read -r file line_no found_rustc_version; do + if [[ "$found_rustc_version" == "$MSRV_VERSION" ]]; then + echo "::notice file=$file,line=$line_no,title=version::✅ $found_rustc_version" + else + echo "::error file=$file,line=$line_no,title=version::$found_rustc_version should have been $MSRV_VERSION" + exit_code=1 + fi + done <<<"$(grep -HnoE 'rustc >= \S+' README.md)" + exit "$exit_code" env: MSRV_VERSION: ${{ steps.run-msrv.outputs.result }} - README_VERSION: ${{ steps.readme-version.outputs.result }} diff --git a/README.md b/README.md index 9e7deff..9910b1a 100644 --- a/README.md +++ b/README.md @@ -41,19 +41,21 @@ have one you prefer. Any of these will work: 1. ```shell - cargo install --git https://github.com/yshavit/mdq - ``` -2. ```shell brew install mdq ``` -3. ```bash + (Mac and Linux) +1. ```bash docker pull yshavit/mdq echo 'My [example](https://github.com/yshavit/mdq) markdown' | docker run --rm -i yshavit/mdq '[]()' ``` -4. Download binaries from [the latest release] (or any other release, of course). +1. Download binaries from [the latest release] (or any other release, of course). You can also grab the binaries from the latest [build-release] workflow run. You must be logged into GitHub to do that (this is GitHub's limitation, not mine). You'll have to `chmod +x` them before you can run them. +1. ```shell + cargo install --git https://github.com/yshavit/mdq + ``` + Requires rustc >= 1.2.3
Security concerns @@ -188,7 +190,7 @@ cat oncall.md | mdq ':-: * :-: 2024-01-15' # Development -Requires rustc >= 1.78.0 +Requires rustc >= 1.2.3 ```bash cargo build From a60a0ed16f43e9a44eeba405c8ec0995bb76d3a1 Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Sat, 1 Mar 2025 18:51:29 -0500 Subject: [PATCH 2/4] fix rustc version --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9910b1a..89e86a9 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Any of these will work: 1. ```shell cargo install --git https://github.com/yshavit/mdq ``` - Requires rustc >= 1.2.3 + Requires rustc >= 1.78.0
Security concerns @@ -190,7 +190,7 @@ cat oncall.md | mdq ':-: * :-: 2024-01-15' # Development -Requires rustc >= 1.2.3 +Requires rustc >= 1.78.0 ```bash cargo build From 80389f294efb31da73a69023b5a69d561ac3dbae Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Sat, 1 Mar 2025 18:57:13 -0500 Subject: [PATCH 3/4] extract only the version string from the matched --- .github/workflows/readme-checks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/readme-checks.yml b/.github/workflows/readme-checks.yml index ae1adf5..18d0f15 100644 --- a/.github/workflows/readme-checks.yml +++ b/.github/workflows/readme-checks.yml @@ -28,7 +28,8 @@ jobs: run: | set -euo pipefail exit_code=0 - while IFS=: read -r file line_no found_rustc_version; do + while IFS=: read -r file line_no version_contents; do + found_rustc_version="${version_contents//rustc >= /}" if [[ "$found_rustc_version" == "$MSRV_VERSION" ]]; then echo "::notice file=$file,line=$line_no,title=version::✅ $found_rustc_version" else From 761c9f30c267ca2c1cc3a5e0f747c8b8457e53f2 Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Sat, 1 Mar 2025 19:45:21 -0500 Subject: [PATCH 4/4] make readme item shorter --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e032443..6a19158 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,9 @@ have one you prefer. Any of these will work: 1. ```shell + # (Mac and Linux, with brew installed) brew install mdq ``` - (Mac and Linux) 1. ```bash docker pull yshavit/mdq echo 'My [example](https://github.com/yshavit/mdq) markdown' | docker run --rm -i yshavit/mdq '[]()'