You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2022/11/15 09:07:07 UTC

[cayenne] branch STABLE-4.2 updated: Enable GitHub actions

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

ntimofeev pushed a commit to branch STABLE-4.2
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/STABLE-4.2 by this push:
     new 14ae9f737 Enable GitHub actions
14ae9f737 is described below

commit 14ae9f7378f0bcc8e7d9b73321c9c6148643c736
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Nov 15 12:07:02 2022 +0300

    Enable GitHub actions
---
 .github/actions/export-pom-version/action.yml      | 13 ++++
 .github/actions/export-pom-version/bash.sh         | 11 ++++
 .../maven-settings.xml                             |  4 +-
 .github/workflows/verify-deploy-on-push-4.2.yml    | 77 ++++++++++++++++++++++
 .github/workflows/verify-on-pr-4.2.yml             | 50 ++++++++++++++
 .travis.yml                                        | 77 ----------------------
 6 files changed, 153 insertions(+), 79 deletions(-)

diff --git a/.github/actions/export-pom-version/action.yml b/.github/actions/export-pom-version/action.yml
new file mode 100644
index 000000000..69cce0ca5
--- /dev/null
+++ b/.github/actions/export-pom-version/action.yml
@@ -0,0 +1,13 @@
+name: Pom version
+description: Gets version from the pom.xml file
+
+runs:
+  using: "composite"
+  steps:
+    - id: set-up
+      run: chmod +x $GITHUB_ACTION_PATH/bash.sh
+      shell: bash
+
+    - id: get-pom-version
+      run: $GITHUB_ACTION_PATH/bash.sh
+      shell: bash
\ No newline at end of file
diff --git a/.github/actions/export-pom-version/bash.sh b/.github/actions/export-pom-version/bash.sh
new file mode 100644
index 000000000..1ed9a6bee
--- /dev/null
+++ b/.github/actions/export-pom-version/bash.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+function get_pom_version {
+  awk -F '<[^>]*>' '/<dependencies>/,/<\/dependencies>/{next} /<plugins>/,/<\/plugins>/{next} /<version>/ {$1=$1; gsub(/ /,"") $0; print}' pom.xml
+}
+
+VERSION=$(get_pom_version)
+echo "pom.xml version: $VERSION"
+
+# export VERSION to the GitHub env
+echo "POM_VERSION=$VERSION" >> "$GITHUB_ENV"
\ No newline at end of file
diff --git a/.travis-mvn-settings.xml b/.github/maven-settings.xml
similarity index 90%
rename from .travis-mvn-settings.xml
rename to .github/maven-settings.xml
index 41ec17017..7e77f806b 100644
--- a/.travis-mvn-settings.xml
+++ b/.github/maven-settings.xml
@@ -23,8 +23,8 @@
     <servers>
         <server>
             <id>apache.snapshots.https</id>
-            <username>${env.SNAPSHOT_REPO_USERNAME}</username>
-            <password>${env.SNAPSHOT_REPO_PASSWORD}</password>
+            <username>${env.MAVEN_USERNAME}</username>
+            <password>${env.MAVEN_PASSWORD}</password>
         </server>
     </servers>
 </settings>
\ No newline at end of file
diff --git a/.github/workflows/verify-deploy-on-push-4.2.yml b/.github/workflows/verify-deploy-on-push-4.2.yml
new file mode 100644
index 000000000..c0b77cdb0
--- /dev/null
+++ b/.github/workflows/verify-deploy-on-push-4.2.yml
@@ -0,0 +1,77 @@
+# 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
+#
+# https://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: verify and deploy 4.2
+
+on: push
+
+env:
+  MAVEN_OPTS: -Xmx4g -Xms1g -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3
+
+jobs:
+  verify:
+    runs-on: ubuntu-latest
+    name: JDK ${{ matrix.jdk }}, DB ${{ matrix.db-profile }}
+    if: github.repository == 'apache/cayenne'
+
+    strategy:
+      matrix:
+        jdk: [8, 11, 17]
+        db-profile: [hsql, h2, derby, mysql-tc, postgres-tc, sqlserver-tc]
+      fail-fast: false # finish all jobs anyway
+
+    env:
+      JDK_VERSION: ${{ matrix.jdk }}
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      - name: Setup java
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'temurin'
+          java-version: ${{ matrix.jdk }}
+          cache: 'maven'
+
+      - name: mvn verify ${{ matrix.db-profile }}
+        run: mvn verify -q -DcayenneTestConnection=${{ matrix.db-profile }} -DcayenneLogLevel=ERROR
+
+  deploy:
+    needs: verify
+    runs-on: ubuntu-latest
+    if: github.repository == 'apache/cayenne' && (contains(github.ref_name, 'STABLE-') || github.ref == 'refs/heads/master')
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      - name: Export version
+        uses: ./.github/actions/export-pom-version
+
+      - name: Setup java
+        uses: actions/setup-java@v3
+        if: contains(env.POM_VERSION, '-SNAPSHOT')
+        with:
+          distribution: 'temurin'
+          java-version: 11
+          cache: 'maven'
+
+      - name: Deploy snapshot
+        run: mvn deploy -DskipTests --settings .github/maven-settings.xml
+        if: contains(env.POM_VERSION, '-SNAPSHOT')
+        env:
+          MAVEN_USERNAME: ${{ secrets.NEXUS_USER }}
+          MAVEN_PASSWORD: ${{ secrets.NEXUS_PW }}
\ No newline at end of file
diff --git a/.github/workflows/verify-on-pr-4.2.yml b/.github/workflows/verify-on-pr-4.2.yml
new file mode 100644
index 000000000..3071fb4a4
--- /dev/null
+++ b/.github/workflows/verify-on-pr-4.2.yml
@@ -0,0 +1,50 @@
+# 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
+#
+# https://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: verify PR 4.2
+
+on: pull_request
+
+env:
+  MAVEN_OPTS: -Xmx4g -Xms1g -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.count=3
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    name: JDK ${{ matrix.jdk }}, DB ${{ matrix.db-profile }}
+    if: github.repository == 'apache/cayenne'
+
+    strategy:
+      matrix:
+        jdk: [8, 11, 17]
+        db-profile: [hsql, h2, derby, mysql-tc, postgres-tc, sqlserver-tc]
+      fail-fast: true
+
+    env:
+      JDK_VERSION: ${{ matrix.jdk }}
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      - name: Setup java
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'temurin'
+          java-version: ${{ matrix.jdk }}
+          cache: 'maven'
+
+      - name: mvn verify ${{ matrix.db-profile }}
+        run: mvn verify -q -DcayenneTestConnection=${{ matrix.db-profile }} -DcayenneLogLevel=ERROR
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 4313f2ab7..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-# 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
-#
-# https://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.
-
-language: java
-
-os: linux
-dist: bionic
-
-services:
-  - docker
-
-env:
-  jobs:
-    - DB_PROFILE=mysql-tc
-    - DB_PROFILE=postgres-tc
-    - DB_PROFILE=sqlserver-tc
-  global:
-    # travis encrypt -r apache/cayenne "SNAPSHOT_REPO_USERNAME='username'"
-    # travis encrypt -r apache/cayenne "SNAPSHOT_REPO_PASSWORD='password'"
-    - secure: "ssx4T8lnuLcR6bRx8BWeWRDa5IfK7RBi5CfNoFlQMoSaiiFvbW0TG+1YAqsYnvf07PfU7YJ4+6b0pG+E83Serw7TSoXehvCeCK8AzsT9/BbVpvuQVlbj/cG9rfrJcTvGyZI7p02+nVBR70XSN2qcvWQt5q2me7ZApS3unmen350="
-    - secure: "cysyR/fEtBHC26lYHGhfXYIPMaol1c1wP+r59idByE4iq71QiOffA4j1CQCAnN5Zo7QsNavz/GZoIxNif4SUcY7sW5M92a78VFVK3aYGTOBtN9jpqWDJoFc8jm5C75j3CoBe7dVFkxw3pCdMlZQ7HJj7L+GiyZ5USu6E2vD5X7A="
-
-jdk:
-  - openjdk8
-  - openjdk11
-  - openjdk17
-
-script:
-  - travis_wait 25 mvn verify -fae -q $EXCLUDE_MODULES -DcayenneTestConnection=$DB_PROFILE -DcayenneLogLevel=ERROR
-
-jobs:
-# add hsql, h2 and derby databases to tests on openjdk8
-# To reduce the test time, add only postgress db on openjdk18
-  include:
-    - env: DB_PROFILE=hsql
-      jdk: openjdk8
-    - env: DB_PROFILE=h2
-      jdk: openjdk8
-    - env: DB_PROFILE=derby
-      jdk: openjdk8
-    - jdk: openjdk18
-      env: DB_PROFILE=postgres-tc
-    - stage: deploy
-      script: mvn deploy -DskipTests --settings .travis-mvn-settings.xml
-      jdk: openjdk8
-      if: type = push AND branch = STABLE-4.2 AND repo = apache/cayenne
-
-  allow_failures:
-    - jdk: openjdk18
-
-# prevent Travis from unnecessary checks with pull request
-  exclude:
-    - if: type = pull_request
-      jdk: openjdk11
-    - if: type = pull_request
-      jdk: openjdk17
-    - if: type = pull_request
-      jdk: openjdk18
-
-# prevent Travis from unneeded "mvn install" run
-install: true
-
-cache:
-  directories:
-    - $HOME/.m2