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

ggal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-livy.git


The following commit(s) were added to refs/heads/master by this push:
     new da246ff3 [LIVY-972] Add GitHub Action for CI image (#393)
da246ff3 is described below

commit da246ff30d11705d8f9772950c34c4ae1c82cf09
Author: Damon P. Cortesi <[email protected]>
AuthorDate: Sat Apr 8 11:42:44 2023 -0700

    [LIVY-972] Add GitHub Action for CI image (#393)
    
    * Add GitHub Action for CI image
    
    * Update push action
    
    * Add sample unit test
    
    * Add matrix based on spark version
    
    * Update spark version to be strings for proper comparison
    
    * Fix syntax
    
    * Add maven cache and integration tests
    
    * Just use actions/cache
    
    * Be more explicty with pom locations because container build is running as 
root. https://github.com/actions/runner/issues/449
    
    * Add MAVEN_OPTS to avoid timeouts[1] and ignore livy in m2 cache
    [1] https://github.com/apache/iotdb/issues/3121
    
    * Update cache paths
    
    * Add codecov
---
 .github/workflows/build-ci-image.yaml    | 48 ++++++++++++++++++++++++++++
 .github/workflows/integration-tests.yaml | 54 ++++++++++++++++++++++++++++++++
 .github/workflows/unit-tests.yaml        | 52 ++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)

diff --git a/.github/workflows/build-ci-image.yaml 
b/.github/workflows/build-ci-image.yaml
new file mode 100644
index 00000000..1dc0b60a
--- /dev/null
+++ b/.github/workflows/build-ci-image.yaml
@@ -0,0 +1,48 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+name: 'Build CI images'
+on: 
+  push:
+    branches: ["main"]
+    paths:
+    - 'dev/docker/Dockerfile'
+jobs:
+  docker-build:
+    runs-on: ubuntu-latest
+    steps:
+      - 
+        name: Checkout
+        uses: actions/checkout@v3
+      -
+        name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+      -
+        name: Login to the GitHub Container Registry
+        uses: docker/login-action@v2
+        with:
+          registry: ghcr.io
+          username: ${{ github.repository_owner }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - 
+        name: Build and push image
+        id: docker_build
+        uses: docker/build-push-action@v4
+        with:
+          push: true
+          context: ./dev/docker
+          tags: |
+            ghcr.io/${{ github.repository_owner }}/livy-ci:latest
\ No newline at end of file
diff --git a/.github/workflows/integration-tests.yaml 
b/.github/workflows/integration-tests.yaml
new file mode 100644
index 00000000..d74fa8e9
--- /dev/null
+++ b/.github/workflows/integration-tests.yaml
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+name: Integration Tests
+on:
+  pull_request:
+    types: [opened, reopened, synchronize]
+env:
+  MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false 
-Dmaven.wagon.http.retryHandler.class=standard 
-Dmaven.wagon.http.retryHandler.count=3
+jobs:
+  build:
+    runs-on: ubuntu-20.04
+    # TODO: Possibly point to the ./build-ci-image.yaml with the "uses" key
+    container: ghcr.io/${{ github.repository_owner }}/livy-ci:latest
+    strategy:
+      matrix:
+        spark_version: ["2.4", "3.0"]
+    steps:
+    - 
+      name: Checkout
+      uses: actions/checkout@v3
+    - 
+      name: Cache local Maven repository
+      uses: actions/cache@v3
+      with:
+        path: |
+          /root/.m2/repository
+          !/root/.m2/repository/org/apache/livy
+        key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', '*/pom.xml', 
'thriftserver/*/pom.xml', 'core/*/pom.xml', 'repl/*/pom.xml', 
'scala-api/*/pom.xml') }}
+        restore-keys: |
+          ${{ runner.os }}-maven-
+    -
+      name: Set profile based on matrix
+      run: |
+        if [ "${{ matrix.spark_version }}" = "3.0" ]; then echo 
"mvn_profile=-Pspark-3.0" >> $GITHUB_ENV; fi
+    - 
+      name: Build with Maven
+      run: mvn -Pthriftserver ${{ env.mvn_profile }} -DskipTests 
-Dmaven.javadoc.skip=true -B -V -e verify
+    -
+      name: Upload coverage to codecov
+      uses: codecov/codecov-action@v3
diff --git a/.github/workflows/unit-tests.yaml 
b/.github/workflows/unit-tests.yaml
new file mode 100644
index 00000000..7d8c42bc
--- /dev/null
+++ b/.github/workflows/unit-tests.yaml
@@ -0,0 +1,52 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+name: Unit Tests
+on: [push]
+env:
+  MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false 
-Dmaven.wagon.http.retryHandler.class=standard 
-Dmaven.wagon.http.retryHandler.count=3
+jobs:
+  build:
+    runs-on: ubuntu-20.04
+    # TODO: Possibly point to the ./build-ci-image.yaml with the "uses" key
+    container: ghcr.io/${{ github.repository_owner }}/livy-ci:latest
+    strategy:
+      matrix:
+        spark_version: ["2.4", "3.0"]
+    steps:
+    - 
+      name: Checkout
+      uses: actions/checkout@v3
+    - 
+      name: Cache local Maven repository
+      uses: actions/cache@v3
+      with:
+        path: |
+          /root/.m2/repository
+          !/root/.m2/repository/org/apache/livy
+        key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', '*/pom.xml', 
'thriftserver/*/pom.xml', 'core/*/pom.xml', 'repl/*/pom.xml', 
'scala-api/*/pom.xml') }}
+        restore-keys: |
+          ${{ runner.os }}-maven-
+    -
+      name: Set profile based on matrix
+      run: |
+        if [ "${{ matrix.spark_version }}" = "3.0" ]; then echo 
"mvn_profile=-Pspark-3.0" >> $GITHUB_ENV; fi
+    - 
+      name: Build with Maven
+      run: mvn -Pthriftserver ${{ env.mvn_profile }} -DskipITs 
-Dmaven.javadoc.skip=true -B -V -e verify
+    -
+      name: Upload coverage to codecov
+      uses: codecov/codecov-action@v3

Reply via email to