You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/04/13 09:14:44 UTC

[apisix] branch master updated: ci: cache deps (#4026)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 22dd899  ci: cache deps (#4026)
22dd899 is described below

commit 22dd8999136c579733391f2f44ba7ee54fe0c7c3
Author: nic-chen <33...@users.noreply.github.com>
AuthorDate: Tue Apr 13 17:14:37 2021 +0800

    ci: cache deps (#4026)
---
 .github/workflows/build.yml         |  8 ++++++++
 .github/workflows/fuzzing-ci.yaml   |  8 ++++++++
 ci/common.sh                        |  6 +-----
 ci/linux_openresty_common_runner.sh | 16 ++--------------
 ci/linux_openresty_mtls_runner.sh   | 14 +-------------
 ci/linux_tengine_runner.sh          | 14 +-------------
 6 files changed, 21 insertions(+), 45 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef8deaf..051cb700 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -56,6 +56,14 @@ jobs:
         with:
           submodules: recursive
 
+      - name: Cache deps
+        uses: actions/cache@v2
+        env:
+          cache-name: cache-deps
+        with:
+          path: deps
+          key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
+
       - name: Extract branch name
         if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
         id: branch_env
diff --git a/.github/workflows/fuzzing-ci.yaml b/.github/workflows/fuzzing-ci.yaml
index 703b11d..01037c3 100644
--- a/.github/workflows/fuzzing-ci.yaml
+++ b/.github/workflows/fuzzing-ci.yaml
@@ -33,6 +33,14 @@ jobs:
       with:
         submodules: recursive
 
+    - name: Cache deps
+      uses: actions/cache@v2
+      env:
+        cache-name: cache-deps
+      with:
+        path: deps
+        key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
+
     - name: run apisix
       run: |
         wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
diff --git a/ci/common.sh b/ci/common.sh
index 11829fd..aec7082 100644
--- a/ci/common.sh
+++ b/ci/common.sh
@@ -24,7 +24,7 @@ export_or_prefix() {
 }
 
 create_lua_deps() {
-    echo "Create lua deps cache"
+    echo "Create lua deps"
 
     for (( i = 0; i < 10; i++ )); do
         if [[ "$i" -eq 10 ]]; then
@@ -35,8 +35,4 @@ create_lua_deps() {
     done
     # maybe reopen this feature later
     # luarocks install luacov-coveralls --tree=deps --local > build.log 2>&1 || (cat build.log && exit 1)
-
-    sudo rm -rf build-cache/deps
-    sudo cp -r deps build-cache/
-    sudo cp rockspec/apisix-master-0.rockspec build-cache/
 }
diff --git a/ci/linux_openresty_common_runner.sh b/ci/linux_openresty_common_runner.sh
index c6fd2f2..5b501e0 100755
--- a/ci/linux_openresty_common_runner.sh
+++ b/ci/linux_openresty_common_runner.sh
@@ -63,19 +63,7 @@ do_install() {
 
     ./utils/linux-install-etcd-client.sh
 
-    if [ ! -f "build-cache/apisix-master-0.rockspec" ]; then
-        create_lua_deps
-
-    else
-        src=`md5sum rockspec/apisix-master-0.rockspec | awk '{print $1}'`
-        src_cp=`md5sum build-cache/apisix-master-0.rockspec | awk '{print $1}'`
-        if [ "$src" = "$src_cp" ]; then
-            echo "Use lua deps cache"
-            sudo cp -r build-cache/deps ./
-        else
-            create_lua_deps
-        fi
-    fi
+    create_lua_deps
 
     # sudo apt-get install tree -y
     # tree deps
@@ -86,7 +74,7 @@ do_install() {
     git clone https://github.com/apache/openwhisk-utilities.git ci/openwhisk-utilities
     cp ci/ASF* ci/openwhisk-utilities/scancode/
 
-    ls -l ./
+    mkdir -p build-cache
     if [ ! -f "build-cache/grpc_server_example_20210122" ]; then
         wget https://github.com/api7/grpc_server_example/releases/download/20210122/grpc_server_example-amd64.tar.gz
         tar -xvf grpc_server_example-amd64.tar.gz
diff --git a/ci/linux_openresty_mtls_runner.sh b/ci/linux_openresty_mtls_runner.sh
index a1a8bd9..c1fb063 100755
--- a/ci/linux_openresty_mtls_runner.sh
+++ b/ci/linux_openresty_mtls_runner.sh
@@ -41,19 +41,7 @@ do_install() {
 
     ./utils/linux-install-etcd-client.sh
 
-    if [ ! -f "build-cache/apisix-master-0.rockspec" ]; then
-        create_lua_deps
-
-    else
-        src=`md5sum rockspec/apisix-master-0.rockspec | awk '{print $1}'`
-        src_cp=`md5sum build-cache/apisix-master-0.rockspec | awk '{print $1}'`
-        if [ "$src" = "$src_cp" ]; then
-            echo "Use lua deps cache"
-            sudo cp -r build-cache/deps ./
-        else
-            create_lua_deps
-        fi
-    fi
+    create_lua_deps
 
     # sudo apt-get install tree -y
     # tree deps
diff --git a/ci/linux_tengine_runner.sh b/ci/linux_tengine_runner.sh
index 802e427..b8f6a27 100755
--- a/ci/linux_tengine_runner.sh
+++ b/ci/linux_tengine_runner.sh
@@ -221,19 +221,7 @@ do_install() {
 
     ./utils/linux-install-luarocks.sh
 
-    if [ ! -f "build-cache/apisix-master-0.rockspec" ]; then
-        create_lua_deps
-
-    else
-        src=`md5sum rockspec/apisix-master-0.rockspec | awk '{print $1}'`
-        src_cp=`md5sum build-cache/apisix-master-0.rockspec | awk '{print $1}'`
-        if [ "$src" = "$src_cp" ]; then
-            echo "Use lua deps cache"
-            sudo cp -r build-cache/deps ./
-        else
-            create_lua_deps
-        fi
-    fi
+    create_lua_deps
 
     for (( i = 0; i < 10; i++ )); do
         if [[ "$i" -eq 10 ]]; then