From 390c109e673c9164c5359eda34223688875e4b66 Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Wed, 28 Feb 2024 11:49:39 +0100 Subject: [PATCH] Add a nightly workflow to run and verify buildAndPushRelease.py and smokeTestRelease.py (#13141) --- .github/workflows/run-nightly-smoketester.yml | 74 +++++++++++++++++++ dev-tools/scripts/smokeTestRelease.py | 6 +- 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/run-nightly-smoketester.yml diff --git a/.github/workflows/run-nightly-smoketester.yml b/.github/workflows/run-nightly-smoketester.yml new file mode 100644 index 000000000000..507a4babbeae --- /dev/null +++ b/.github/workflows/run-nightly-smoketester.yml @@ -0,0 +1,74 @@ +name: "Run nightly: buildAndPushRelease and smokeTestRelease.py" + +on: + # Allow manual dispatch. + workflow_dispatch: + + # run nightly at 2:04am. + schedule: + - cron: '4 2 * * *' + +jobs: + smokeTestRelease: + name: "Smoke test release on jdk ${{ matrix.java-version }}, ${{ matrix.os }}" + + # only run on schedule in the main Lucene repo (not in forks). + if: (github.event_name == 'schedule' && github.repository == 'apache/lucene') || (github.event_name != 'schedule') + + strategy: + matrix: + os: [ ubuntu-latest ] + java-version: [ '17', '21', '22-ea' ] + + runs-on: ${{ matrix.os }} + + env: + LUCENE_RELEASE_DIR: /tmp/lucene-release-dir + TMP_DIR: /tmp/lucene-tmp-dir + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-package: jdk + check-latest: true + # This intentionally lists two versions, the last one is used as the system default (for running gradle). + java-version: | + ${{ matrix.java-version }} + 17 + + - name: Echo diagnostic paths and locations + run: | + echo "All installed JDKs:" + set | grep "JAVA" + + echo "Gradle's 'RUNTIME_JAVA_HOME' JDK:" + RUNTIME_JAVA_HOME_VAR=JAVA_HOME_`echo ${{ matrix.java-version }} | egrep --only "[0-9]+"`_X64 + echo ${RUNTIME_JAVA_HOME_VAR} points at ${!RUNTIME_JAVA_HOME_VAR} + + # This sets the environment variable and makes it available for subsequent job steps. + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable + echo "RUNTIME_JAVA_HOME=${!RUNTIME_JAVA_HOME_VAR}" >> "$GITHUB_ENV" + + - name: "Run buildAndPushRelease.py (--dev-mode)" + run: | + # Assemble an unsigned release, in dev mode, publish locally. + python3 ./dev-tools/scripts/buildAndPushRelease.py --dev-mode --push-local ${{ env.LUCENE_RELEASE_DIR }} + + - name: "Run smokeTestRelease.py (runtime java: ${{ matrix.java-version }})" + run: | + python3 -u dev-tools/scripts/smokeTestRelease.py \ + --not-signed \ + --tmp-dir ${{ env.TMP_DIR }} \ + file://`realpath ${{ env.LUCENE_RELEASE_DIR }}/lucene*` \ + -Ptests.filter="@skipall" + + - name: "Store smoke tester logs" + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: smoke-tester-logs-jdk-${{ matrix.java-version }} + path: | + ${{ env.TMP_DIR }}/**/*.log diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 1f39e3b3a6ca..69833663c81a 100755 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -158,9 +158,9 @@ def checkJARMetaData(desc, jarFile, gitRevision, version): break else: if len(verify) == 1: - raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFEST.MF' % (desc, verify[0])) + raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFEST.MF: %s' % (desc, verify[0], s)) else: - raise RuntimeError('%s is missing one of "%s" inside its META-INF/MANIFEST.MF' % (desc, verify)) + raise RuntimeError('%s is missing one of "%s" inside its META-INF/MANIFEST.MF: %s' % (desc, verify, s)) if gitRevision != 'skip': # Make sure this matches the version and git revision we think we are releasing: @@ -577,7 +577,7 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): # raise RuntimeError('lucene: file "%s" is missing from artifact %s' % (fileName, artifact)) # in_root_folder.remove(fileName) - expected_folders = ['analysis', 'analysis.tests', 'backward-codecs', 'benchmark', 'classification', 'codecs', 'core', 'core.tests', + expected_folders = ['analysis', 'analysis.tests', 'backward-codecs', 'benchmark', 'benchmark-jmh', 'classification', 'codecs', 'core', 'core.tests', 'distribution.tests', 'demo', 'expressions', 'facet', 'grouping', 'highlighter', 'join', 'luke', 'memory', 'misc', 'monitor', 'queries', 'queryparser', 'replicator', 'sandbox', 'spatial-extras', 'spatial-test-fixtures', 'spatial3d', 'suggest', 'test-framework', 'licenses']