rzo1 commented on code in PR #285:
URL: https://github.com/apache/openjpa/pull/285#discussion_r4507294936


##########
pom.xml:
##########
@@ -693,6 +697,10 @@
                                         <ports>
                                             
<port>${docker.external.mariadb.port}:3306</port>
                                         </ports>
+                                        <wait>
+                                            <log>mariadbd: ready for 
connections</log>
+                                            <time>3600000</time>

Review Comment:
   Same here: the init server prints `mariadbd: ready for connections.` too 
(with `port: 0`). Also 1h vs. 6 min for the others:
   ```suggestion
                                               <log>port: 3306\s</log>
                                               <time>360000</time>
   ```



##########
pom.xml:
##########
@@ -593,6 +593,10 @@
                                         <ports>
                                             
<port>${docker.external.mysql.port}:3306</port>
                                         </ports>
+                                        <wait>
+                                            <log>mysqld: ready for 
connections</log>

Review Comment:
   The image runs a temporary init server first, which already prints `mysqld: 
ready for connections ... port: 0`, so `docker:start` returns before the real 
server is up. Only the real server reports `port: 3306` (`\s` keeps the X 
plugin's `33060` out):
   ```suggestion
                                               <log>port: 3306\s</log>
   ```



##########
.github/workflows/tck.yml:
##########
@@ -0,0 +1,94 @@
+#
+# 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: TCK
+on:
+  schedule:
+    # Tuesdays, 04:17 UTC. A quarter past the hour avoids the load peak at :00.
+    - cron: '17 4 * * 2'
+  workflow_dispatch:
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+env:
+  MAVEN_OPTS: -Dmaven.artifact.threads=256 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
+jobs:
+  # A scheduled run on an unchanged tree would test what the previous one 
already
+  # tested, so skip it unless something was committed since. A manual run 
always
+  # proceeds, which is the point of being able to ask for one.
+  check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_run: ${{ steps.decide.outputs.should_run }}
+    steps:
+      - uses: actions/[email protected]
+      - name: 'Decide whether there is anything new to test'
+        id: decide
+        env:
+          EVENT: ${{ github.event_name }}
+          BRANCH: ${{ github.ref_name }}
+          DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
+        run: |
+          if [ "$EVENT" = 'workflow_dispatch' ]; then
+            echo "Manual run on $BRANCH."
+            echo 'should_run=true' >> "$GITHUB_OUTPUT"
+          elif [ "$BRANCH" != "$DEFAULT_BRANCH" ]; then
+            echo "Scheduled runs are limited to $DEFAULT_BRANCH, this is 
$BRANCH."
+            echo 'should_run=false' >> "$GITHUB_OUTPUT"
+          else
+            age=$(( ( $(date +%s) - $(git log -1 --format=%ct) ) / 86400 ))
+            if [ "$age" -ge 7 ]; then
+              echo "Last commit is $age days old, nothing new since the 
previous run."
+              echo 'should_run=false' >> "$GITHUB_OUTPUT"
+            else
+              echo "Last commit is $age days old."
+              echo 'should_run=true' >> "$GITHUB_OUTPUT"
+            fi
+          fi
+
+  tck:
+    needs: check
+    if: needs.check.outputs.should_run == 'true'
+    runs-on: ubuntu-latest

Review Comment:
   A hanging run otherwise holds an ASF runner for the full 6h. We can adjust 
once we know how long a run takes:
   ```suggestion
       runs-on: ubuntu-latest
       timeout-minutes: 180
   ```



##########
.github/workflows/tck.yml:
##########
@@ -0,0 +1,94 @@
+#
+# 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: TCK
+on:
+  schedule:
+    # Tuesdays, 04:17 UTC. A quarter past the hour avoids the load peak at :00.
+    - cron: '17 4 * * 2'
+  workflow_dispatch:
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+env:
+  MAVEN_OPTS: -Dmaven.artifact.threads=256 
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
+jobs:
+  # A scheduled run on an unchanged tree would test what the previous one 
already
+  # tested, so skip it unless something was committed since. A manual run 
always
+  # proceeds, which is the point of being able to ask for one.
+  check:
+    runs-on: ubuntu-latest
+    outputs:
+      should_run: ${{ steps.decide.outputs.should_run }}
+    steps:
+      - uses: actions/[email protected]
+      - name: 'Decide whether there is anything new to test'
+        id: decide
+        env:
+          EVENT: ${{ github.event_name }}
+          BRANCH: ${{ github.ref_name }}
+          DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
+        run: |
+          if [ "$EVENT" = 'workflow_dispatch' ]; then
+            echo "Manual run on $BRANCH."
+            echo 'should_run=true' >> "$GITHUB_OUTPUT"
+          elif [ "$BRANCH" != "$DEFAULT_BRANCH" ]; then
+            echo "Scheduled runs are limited to $DEFAULT_BRANCH, this is 
$BRANCH."
+            echo 'should_run=false' >> "$GITHUB_OUTPUT"
+          else
+            age=$(( ( $(date +%s) - $(git log -1 --format=%ct) ) / 86400 ))
+            if [ "$age" -ge 7 ]; then
+              echo "Last commit is $age days old, nothing new since the 
previous run."
+              echo 'should_run=false' >> "$GITHUB_OUTPUT"
+            else
+              echo "Last commit is $age days old."
+              echo 'should_run=true' >> "$GITHUB_OUTPUT"
+            fi
+          fi
+
+  tck:
+    needs: check
+    if: needs.check.outputs.should_run == 'true'
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        db: ['mysql', 'postgresql', 'mssql', 'oracle', 'derby']
+    name: TCK (Java 21, ${{ matrix.db }})
+    steps:
+      - uses: actions/[email protected]
+      - name: Setup Java JDK
+        uses: actions/[email protected]
+        with:
+          distribution: 'zulu'
+          java-version: 21
+      - name: 'Cache Maven packages'
+        uses: actions/[email protected]
+        with:
+          path: ~/.m2
+          key: cache-21-tck-${{ matrix.db }}
+          restore-keys: cache-21-tck-${{ matrix.db }}
+      - name: 'Build with Maven'
+        run: mvn clean install -DskipTests
+      - name: 'Test TCK against ${{ matrix.db }}'
+        shell: bash
+        run: |
+          cd openjpa-integration/tck
+          DB_TYPE=${{ matrix.db }} ./run-tck32.sh |& tee tck_${{ matrix.db 
}}.log
+          if [[ -z $(grep 'Failures: [1-9]' tck_${{ matrix.db }}.log) && -z 
$(grep 'Errors: [1-9]' tck_${{ matrix.db }}.log) ]]; then exit 0; else exit 1; 
fi

Review Comment:
   With `shell: bash`, Actions runs the step with `-eo pipefail`, so a failing 
`mvn verify` (failsafe fails on test failures and errors) already fails the 
step through the `tee`. The grep isn't needed:
   ```suggestion
             cd openjpa-integration/tck
             DB_TYPE=${{ matrix.db }} ./run-tck32.sh |& tee tck_${{ matrix.db 
}}.log
   ```



##########
pom.xml:
##########
@@ -794,6 +802,10 @@
                                         <ports>
                                             
<port>${docker.external.postgresql.port}:5432</port>
                                         </ports>
+                                        <wait>
+                                            <log>database system is ready to 
accept connections</log>

Review Comment:
   `database system is ready to accept connections` is printed by the init 
server as well. Waiting for the line after the init is done:
   ```suggestion
                                               <log>(?s)init process 
complete.*ready to accept connections</log>
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to