From 2a9fa9ffcf28af2daa455a575d5f285aad75e886 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Thu, 15 Oct 2020 17:39:28 +0530 Subject: [PATCH] Fix script to skip builds iff md files are changed In previous commits, we ignored the fact that bools are strings in bash This caused the workflow to proceed wrongly and this commit fixes that Also, auto builds for actions docs were added --- .github/workflows/test-push.yml | 23 ++++++++++++++++++----- actions.jsonc | 16 ++++++++-------- ci/doc.sh | 13 +++++++++++++ 3 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 ci/doc.sh diff --git a/.github/workflows/test-push.yml b/.github/workflows/test-push.yml index d0494c02..ae7c411c 100644 --- a/.github/workflows/test-push.yml +++ b/.github/workflows/test-push.yml @@ -2,8 +2,8 @@ name: Test (push) on: [push] env: - IS_ACTIONS_DOC: false - IS_MD_FILE: false + IS_ACTIONS_DOC: "false" + IS_MD_FILE: "false" jobs: test: name: Test @@ -41,7 +41,7 @@ jobs: restore-keys: | ${{ matrix.build }}-cargo-registry- # HACK(@ohsayan): The next line skips caching until it is fixed - if: runner.os != 'macOS' + if: runner.os != 'macOS' && env.IS_MD_FILE == 'false' - name: Cache Cargo index uses: actions/cache@v1 @@ -51,7 +51,7 @@ jobs: restore-keys: | ${{ matrix.build }}-cargo-index- # HACK(@ohsayan): The next line skips caching until it is fixed - if: runner.os != 'macOS' + if: runner.os != 'macOS' && env.IS_MD_FILE == 'false' - name: Cache Cargo build uses: actions/cache@v1 @@ -61,14 +61,27 @@ jobs: restore-keys: | ${{ matrix.build }}-target- # HACK(@ohsayan): The next line skips caching until it is fixed - if: runner.os != 'macOS' + if: runner.os != 'macOS' && env.IS_MD_FILE == 'false' - name: Install Rust run: | rustup update ${{ matrix.rust }} --no-self-update rustup default ${{ matrix.rust }} + if: env.IS_MD_FILE == 'false' + + - name: Publish docs + env: + BOT_USER: ${{ secrets.BOT_INIT_USER }} + BOT_MAIL: ${{ secrets.BOT_INIT_MAIL }} + BOT_API: ${{ secrets.BOT_API_CALL }} + GIT_SHA: ${{ env.GITHUB_SHA }} + run: | + chmod +x ci/doc.sh + ci/doc.sh + if: runner.os == 'Linux' && env.IS_ACTIONS_DOC == 'true' - name: Run Tests run: cargo test --verbose -- --test-threads=1 env: RUST_BACKTRACE: 1 + if: env.IS_MD_FILE == 'false' diff --git a/actions.jsonc b/actions.jsonc index 10d51b3f..e7c1cdd7 100644 --- a/actions.jsonc +++ b/actions.jsonc @@ -54,7 +54,7 @@ "complexity": "O(n)", "args": "MSET ...", "desc": "Set the value of 'n' keys", - "return": "Number of keys that were set as an integer" + "return": "Number of keys that were set as an unsigned int" }, { "name": "UPDATE", @@ -70,15 +70,15 @@ "complexity": "O(n)", "args": "UPDATE ...", "desc": "Update the value of 'n' keys", - "return": "Number of keys that were updated as an integer" + "return": "Number of keys that were updated as an unsigned int" }, { "name": "DEL", - "since": "0.4.0", + "since": "0.1.0", "complexity": "O(n)", "args": "DEL ...", "desc": "Delete 'n' keys", - "return": "Number of keys that were deleted as an integer" + "return": "Number of keys that were deleted as an unsigned int" }, { "name": "EXISTS", @@ -86,7 +86,7 @@ "complexity": "O(n)", "args": "EXISTS ...", "desc": "Check if 'n' keys exist", - "return": "Number of keys that exist as an integer" + "return": "Number of keys that exist as an unsigned int" }, { "name": "SSET", @@ -134,7 +134,7 @@ "complexity": "O(n)", "args": "USET ...", "desc": "SET all keys if they don't exist, or UPDATE them if they do exist", - "return": "Number of keys that were `USET`ed, as an integer" + "return": "Number of keys that were `USET`ed, as an unsigned int" }, { "name": "KEYLEN", @@ -142,6 +142,6 @@ "complexity": "O(1)", "args": "KEYLEN ", "desc": "Returns the length of the UTF-8 string", - "return": "Length of the key as an integer", + "return": "Length of the key as an unsigned int", } -] \ No newline at end of file +] diff --git a/ci/doc.sh b/ci/doc.sh new file mode 100644 index 00000000..72669d4c --- /dev/null +++ b/ci/doc.sh @@ -0,0 +1,13 @@ +{ + git config --global user.email "$BOT_MAIL" + git config --global user.name "$BOT_USER" + C_USER=$(git show -s --format='%an' HEAD) + C_MAIL=$(git show -s --format='%ae' HEAD) + cd .. + git clone https://github.com/terrabasedb/docs.git + cd docs + chmod +x builddoc.sh + sh ./builddoc.sh + git add . && git commit -m "Updated docs from upstream" -m "Triggered by ${GITHUB_SHA}" --author "$C_USER <$C_MAIL>" + eval '${BOT_API}' +} >>/dev/null