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

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 2a731198 chore(github workflow): add cache to improve github action 
(#1931)
2a731198 is described below

commit 2a731198e8dc42eaf715d664d51c74e2f3fedeb2
Author: warrenchen <[email protected]>
AuthorDate: Thu May 19 16:57:28 2022 +0800

    chore(github workflow): add cache to improve github action (#1931)
---
 .github/workflows/build.yml          | 19 +++++++++++++++++++
 .github/workflows/commit-msg.yml     |  6 ++++++
 .github/workflows/front-end-lint.yml |  6 ++++++
 .github/workflows/golangci-lint.yml  |  6 ++++++
 .github/workflows/test-e2e.yml       | 26 +++++++++++++++++++++++++-
 .github/workflows/test.yml           | 31 ++++++++++++++++++++++++++++---
 Dockerfile                           |  1 +
 7 files changed, 91 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 30ee4db4..5544bfa5 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,6 +9,13 @@ jobs:
     runs-on: ubuntu-20.04
     steps:
     - uses: actions/checkout@v2
+    - name: Cache Build-Images-Push-Docker
+      id: cache-Build-Images-Push-Docker
+      uses: actions/cache@v3
+      with:
+        path: Build-Images-Push-Docker
+        key: ${{ runner.os }}-Build-Images-Push-Docker
+
     - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
       with:
         username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
@@ -25,6 +32,12 @@ jobs:
     runs-on: ubuntu-20.04
     steps:
     - uses: actions/checkout@v2
+    - name: Cache config-ui
+      id: cache-config-ui
+      uses: actions/cache@v3
+      with:
+        path: config-ui
+        key: ${{ runner.os }}-config-ui
     - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
       with:
         username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
@@ -42,6 +55,12 @@ jobs:
     runs-on: ubuntu-20.04
     steps:
     - uses: actions/checkout@v2
+    - name: Cache grafana
+      id: cache-grafana
+      uses: actions/cache@v3
+      with:
+        path: grafana
+        key: ${{ runner.os }}-grafana
     - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
       with:
         username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
diff --git a/.github/workflows/commit-msg.yml b/.github/workflows/commit-msg.yml
index 138c075b..015d5a73 100644
--- a/.github/workflows/commit-msg.yml
+++ b/.github/workflows/commit-msg.yml
@@ -8,4 +8,10 @@ jobs:
       - uses: actions/checkout@v2
         with:
           fetch-depth: 0
+      - name: Cache lint-commit-message
+        id: cache-lint-commit-message
+        uses: actions/cache@v3
+        with:
+          path: lint-commit-message
+          key: ${{ runner.os }}-lint-commit-message
       - uses: wagoid/commitlint-github-action@v4
diff --git a/.github/workflows/front-end-lint.yml 
b/.github/workflows/front-end-lint.yml
index daa0c1a3..5bc8fd62 100644
--- a/.github/workflows/front-end-lint.yml
+++ b/.github/workflows/front-end-lint.yml
@@ -5,6 +5,12 @@ jobs:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
+    - name: Cache Frontend-Lint
+      id: cache-Frontend-Lint
+      uses: actions/cache@v3
+      with:
+        path: Frontend-Lint
+        key: ${{ runner.os }}-Frontend-Lint
     - name: Install modules
       run: cd config-ui; npm i
     - name: Run ESLint
diff --git a/.github/workflows/golangci-lint.yml 
b/.github/workflows/golangci-lint.yml
index 12abe50e..23555c93 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -15,6 +15,12 @@ jobs:
         with:
           go-version: '1.17.x'
       - uses: actions/checkout@v3
+      - name: Cache golangci-lint
+        id: cache-golangci-lint
+        uses: actions/cache@v3
+        with:
+          path: golangci-lint
+          key: ${{ runner.os }}-golangci-lint
       - name: golangci-lint
         uses: golangci/golangci-lint-action@v3
         with:
diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml
index 67856f7b..9745056a 100644
--- a/.github/workflows/test-e2e.yml
+++ b/.github/workflows/test-e2e.yml
@@ -1,6 +1,18 @@
 # This action run e2e test for pull requests
 name: test-e2e
-on: [pull_request]
+on:
+  pull_request:
+    branches: [ main ]
+    paths:
+      - '**.go'
+      - 'Makefile'
+      - 'go.mod'
+      - 'go.sum'
+      - '.github/workflows/*.yml'
+      - 'test/**'
+      - 'e2e/**'
+      - 'devops/**'
+      - 'config-ui/**'
 jobs:
   e2e-mysql:
     runs-on: ubuntu-latest
@@ -15,6 +27,18 @@ jobs:
     container: mericodev/lake-builder:0.0.4
     steps:
       - uses: actions/checkout@v3
+      - run: |
+          apk add --no-cache tar
+      - name: Cache test-e2e
+        id: cache-test-e2e
+        uses: actions/cache@v3
+        with:
+          path: |
+            ~/.cache/go-build
+            ~/go/pkg/mod
+          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+          restore-keys: |
+            ${{ runner.os }}-go-
       - name: Test
         env:
           DB_URL: 
mysql://root:root@db:3306/lake?charset=utf8mb4&loc=Asia%2fShanghai&parseTime=True
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 4b6c0c93..a79c7a0d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,17 +1,42 @@
-on: [pull_request]
 name: unit-test
+
+on:
+  pull_request:
+    branches: [ main ]
+    paths:
+      - '**.go'
+      - 'Makefile'
+      - 'go.mod'
+      - 'go.sum'
+      - '.github/workflows/*.yml'
+      - 'test/**'
 jobs:
   test:
     strategy:
       matrix:
-        #go-version: [1.16.x]
         os: [ubuntu-latest]
     runs-on: ${{ matrix.os }}
     container:
       image: mericodev/lake-builder:0.0.4
     steps:
+    - run: |
+        apk add --no-cache tar
     - name: Checkout code
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
+    - name: Setup Golang env
+      uses: actions/setup-go@v3
+      with:
+        go-version: ${{ matrix.go }}
+    - name: Cache unit-test
+      id: cache-unit-test
+      uses: actions/cache@v3
+      with:
+        path: |
+          ~/.cache/go-build
+          ~/go/pkg/mod
+        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+        restore-keys: |
+          ${{ runner.os }}-go-
     - name: Unit tests
       run: |
         make unit-test
diff --git a/Dockerfile b/Dockerfile
index b29a308a..c79fce98 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,6 +21,7 @@ RUN apk add --update --no-cache python3-dev && ln -sf python3 
/usr/bin/python
 RUN python3 -m ensurepip
 RUN pip3 install --no-cache --upgrade pip setuptools
 RUN pip3 install dbt-mysql
+RUN apk add --no-cache tar
 
 EXPOSE 8080
 

Reply via email to