This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push: new eeef2a67f Enable GitHub actions eeef2a67f is described below commit eeef2a67f2fc39ff0f58d73a468b4209f6b8ff69 Author: Nikita Timofeev <stari...@gmail.com> AuthorDate: Fri Nov 11 12:22:44 2022 +0300 Enable GitHub actions --- .github/actions/export-pom-version/action.yml | 13 +++++ .github/actions/export-pom-version/bash.sh | 11 ++++ .github/maven-settings.xml | 30 ++++++++++ .github/workflows/verify-deploy-on-push.yml | 81 +++++++++++++++++++++++++++ .github/workflows/verify-on-pr.yml | 50 +++++++++++++++++ 5 files changed, 185 insertions(+) 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/.github/maven-settings.xml b/.github/maven-settings.xml new file mode 100644 index 000000000..7e77f806b --- /dev/null +++ b/.github/maven-settings.xml @@ -0,0 +1,30 @@ +<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ 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. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> + +<!-- Maven build settings for Travis CI --> +<settings xmlns="https://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="https://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> + <servers> + <server> + <id>apache.snapshots.https</id> + <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.yml b/.github/workflows/verify-deploy-on-push.yml new file mode 100644 index 000000000..23edadb9d --- /dev/null +++ b/.github/workflows/verify-deploy-on-push.yml @@ -0,0 +1,81 @@ +# 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 + +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 }} + continue-on-error: ${{ matrix.jdk == '19' }} + if: github.repository == 'apache/cayenne' + + strategy: + matrix: + jdk: [11, 17] + db-profile: [hsql, h2, derby, mysql-tc, postgres-tc, sqlserver-tc] + include: + - jdk: 19 + db-profile: postgres-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-') + + 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.yml b/.github/workflows/verify-on-pr.yml new file mode 100644 index 000000000..79390a45a --- /dev/null +++ b/.github/workflows/verify-on-pr.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 + +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: [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