From 24056823c63a78b8afa9290ccd0ad5d71ea6deb0 Mon Sep 17 00:00:00 2001 From: Alexander Koval Date: Mon, 4 Nov 2024 15:36:49 +0200 Subject: [PATCH] Test publishing --- .github/workflows/build.yaml | 452 +++++++++++++++++------------------ build.gradle.kts | 5 +- 2 files changed, 229 insertions(+), 228 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 49905dedb3..3602e6ed0e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build and test on: push: branches: - - master + - publish tags: - "v*" pull_request: @@ -54,166 +54,166 @@ jobs: - name: Upload build artifact uses: ./.github/upload-artifact - unit-tests: - needs: build - if: | - !contains(github.event.head_commit.message, '[skip tests]') - runs-on: ubuntu-latest - strategy: - matrix: - java-version: [11] - steps: - - uses: actions/checkout@v3 - - - name: Setup - uses: ./.github/setup - with: - java-version: ${{ matrix.java-version }} - - - name: Load caches - uses: ./.github/cache - - - name: Download build artifact - uses: ./.github/download-artifact - - - name: Run linter - run: | - set -eux - ./gradlew detekt $GRADLE_ARGS - - - name: Check ABI compatibility - run: | - set -eux - ./gradlew apiCheck $GRADLE_ARGS - - - name: Run unit tests - run: | - set -eux - ./gradlew allTests -PshowPassedTests -x integ-tests:allTests $GRADLE_ARGS - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - - integ-tests: - needs: unit-tests - if: | - !contains(github.event.head_commit.message, '[skip tests]') - runs-on: ubuntu-latest - strategy: - matrix: - include: - - es-distribution: elasticsearch - es-major-version: 6 - es-image: elasticsearch:6.8.23 - es-url: http://localhost:9200 - - es-distribution: elasticsearch - es-major-version: 7 - es-image: elasticsearch:7.17.10 - es-url: http://localhost:9200 - - es-distribution: elasticsearch - es-major-version: 8 - es-image: elasticsearch:8.7.1 - es-url: https://localhost:9200 - - es-distribution: opensearch - es-major-version: 2 - es-image: opensearchproject/opensearch:2.4.0 - es-url: https://localhost:9200 - steps: - - uses: actions/checkout@v3 - - - name: Start Elasticsearch - run: | - set -eu - docker run -d \ - --name elasticsearch \ - -p 9200:9200 \ - -e "discovery.type=single-node" \ - -e "ES_JAVA_OPTS=-Xms128m -Xmx256m" \ - --health-cmd="curl ${{ matrix.es-url }} --insecure" \ - --health-interval=5s \ - --health-timeout=2s \ - --health-retries=10 \ - ${{ matrix.es-image }} - echo -n "Waiting Elasticsearch " - until [ $(docker inspect -f '{{.State.Health.Status}}' elasticsearch) == "healthy" ]; do - sleep 1 - echo -n . - done - echo "ELASTIC_URL=http://localhost:9200" >> $GITHUB_ENV - - - name: Setup Elasticsearch password - if: matrix.es-distribution == 'elasticsearch' && matrix.es-major-version >= 8 - run: | - set -eu - ELASTIC_PASSWORD=$( \ - docker exec elasticsearch \ - /usr/share/elasticsearch/bin/elasticsearch-reset-password --batch -u elastic | \ - awk 'BEGIN { FS=": "; } /^New value:/ { print $2; }' \ - ) - echo "ELASTIC_URL=https://localhost:9200" >> $GITHUB_ENV - echo "ELASTIC_USER=elastic" >> $GITHUB_ENV - echo "ELASTIC_PASSWORD=$ELASTIC_PASSWORD" >> $GITHUB_ENV - - - name: Opensearch settings - if: matrix.es-distribution == 'opensearch' - run: | - set -eu - echo "ELASTIC_URL=https://localhost:9200" >> $GITHUB_ENV - echo "ELASTIC_USER=admin" >> $GITHUB_ENV - echo "ELASTIC_PASSWORD=admin" >> $GITHUB_ENV - - - name: Setup - uses: ./.github/setup - with: - java-version: 11 - - - name: Load caches - uses: ./.github/cache - - - name: Download build artifact - uses: ./.github/download-artifact - - - name: Run integration tests - run: | - set -eux - # Allow self-signed certificates for JS engine: https://stackoverflow.com/a/66476468/473308 - export NODE_TLS_REJECT_UNAUTHORIZED=0 - export ELASTIC_URL='${{ env.ELASTIC_URL }}' - export ELASTIC_USER='${{ env.ELASTIC_USER }}' - export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}' - ./gradlew :integ-tests:check -PshowPassedTests $GRADLE_ARGS - - - name: Run samples JVM - run: | - set -eux - export ELASTIC_URL='${{ env.ELASTIC_URL }}' - export ELASTIC_USER='${{ env.ELASTIC_USER }}' - export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}' - ./gradlew run -p samples $GRADLE_ARGS - - - name: Run samples native - run: | - set -eux - export ELASTIC_URL='${{ env.ELASTIC_URL }}' - export ELASTIC_USER='${{ env.ELASTIC_USER }}' - export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}' - ./gradlew runDebugExecutableNative -p samples $GRADLE_ARGS - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true + # unit-tests: + # needs: build + # if: | + # !contains(github.event.head_commit.message, '[skip tests]') + # runs-on: ubuntu-latest + # strategy: + # matrix: + # java-version: [11] + # steps: + # - uses: actions/checkout@v3 + + # - name: Setup + # uses: ./.github/setup + # with: + # java-version: ${{ matrix.java-version }} + + # - name: Load caches + # uses: ./.github/cache + + # - name: Download build artifact + # uses: ./.github/download-artifact + + # - name: Run linter + # run: | + # set -eux + # ./gradlew detekt $GRADLE_ARGS + + # - name: Check ABI compatibility + # run: | + # set -eux + # ./gradlew apiCheck $GRADLE_ARGS + + # - name: Run unit tests + # run: | + # set -eux + # ./gradlew allTests -PshowPassedTests -x integ-tests:allTests $GRADLE_ARGS + + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v3 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + # verbose: true + + # integ-tests: + # needs: unit-tests + # if: | + # !contains(github.event.head_commit.message, '[skip tests]') + # runs-on: ubuntu-latest + # strategy: + # matrix: + # include: + # - es-distribution: elasticsearch + # es-major-version: 6 + # es-image: elasticsearch:6.8.23 + # es-url: http://localhost:9200 + # - es-distribution: elasticsearch + # es-major-version: 7 + # es-image: elasticsearch:7.17.10 + # es-url: http://localhost:9200 + # - es-distribution: elasticsearch + # es-major-version: 8 + # es-image: elasticsearch:8.7.1 + # es-url: https://localhost:9200 + # - es-distribution: opensearch + # es-major-version: 2 + # es-image: opensearchproject/opensearch:2.4.0 + # es-url: https://localhost:9200 + # steps: + # - uses: actions/checkout@v3 + + # - name: Start Elasticsearch + # run: | + # set -eu + # docker run -d \ + # --name elasticsearch \ + # -p 9200:9200 \ + # -e "discovery.type=single-node" \ + # -e "ES_JAVA_OPTS=-Xms128m -Xmx256m" \ + # --health-cmd="curl ${{ matrix.es-url }} --insecure" \ + # --health-interval=5s \ + # --health-timeout=2s \ + # --health-retries=10 \ + # ${{ matrix.es-image }} + # echo -n "Waiting Elasticsearch " + # until [ $(docker inspect -f '{{.State.Health.Status}}' elasticsearch) == "healthy" ]; do + # sleep 1 + # echo -n . + # done + # echo "ELASTIC_URL=http://localhost:9200" >> $GITHUB_ENV + + # - name: Setup Elasticsearch password + # if: matrix.es-distribution == 'elasticsearch' && matrix.es-major-version >= 8 + # run: | + # set -eu + # ELASTIC_PASSWORD=$( \ + # docker exec elasticsearch \ + # /usr/share/elasticsearch/bin/elasticsearch-reset-password --batch -u elastic | \ + # awk 'BEGIN { FS=": "; } /^New value:/ { print $2; }' \ + # ) + # echo "ELASTIC_URL=https://localhost:9200" >> $GITHUB_ENV + # echo "ELASTIC_USER=elastic" >> $GITHUB_ENV + # echo "ELASTIC_PASSWORD=$ELASTIC_PASSWORD" >> $GITHUB_ENV + + # - name: Opensearch settings + # if: matrix.es-distribution == 'opensearch' + # run: | + # set -eu + # echo "ELASTIC_URL=https://localhost:9200" >> $GITHUB_ENV + # echo "ELASTIC_USER=admin" >> $GITHUB_ENV + # echo "ELASTIC_PASSWORD=admin" >> $GITHUB_ENV + + # - name: Setup + # uses: ./.github/setup + # with: + # java-version: 11 + + # - name: Load caches + # uses: ./.github/cache + + # - name: Download build artifact + # uses: ./.github/download-artifact + + # - name: Run integration tests + # run: | + # set -eux + # # Allow self-signed certificates for JS engine: https://stackoverflow.com/a/66476468/473308 + # export NODE_TLS_REJECT_UNAUTHORIZED=0 + # export ELASTIC_URL='${{ env.ELASTIC_URL }}' + # export ELASTIC_USER='${{ env.ELASTIC_USER }}' + # export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}' + # ./gradlew :integ-tests:check -PshowPassedTests $GRADLE_ARGS + + # - name: Run samples JVM + # run: | + # set -eux + # export ELASTIC_URL='${{ env.ELASTIC_URL }}' + # export ELASTIC_USER='${{ env.ELASTIC_USER }}' + # export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}' + # ./gradlew run -p samples $GRADLE_ARGS + + # - name: Run samples native + # run: | + # set -eux + # export ELASTIC_URL='${{ env.ELASTIC_URL }}' + # export ELASTIC_USER='${{ env.ELASTIC_USER }}' + # export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}' + # ./gradlew runDebugExecutableNative -p samples $GRADLE_ARGS + + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v3 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + # verbose: true publish: - needs: integ-tests - if: | - always() && - github.event_name == 'push' && - startsWith(github.ref, 'refs/tags/v') + # needs: integ-tests + # if: | + # always() && + # github.event_name == 'push' && + # startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -248,73 +248,73 @@ jobs: -PsonatypeUser='${{ secrets.SONATYPE_USER }}' \ -PsonatypePassword='${{ secrets.SONATYPE_PASSWORD }}' - docs: - needs: integ-tests - if: | - always() && - !contains(github.event.head_commit.message, '[skip docs]') - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - # We need to fetch last tag for version - fetch-depth: 0 - - - name: Setup - uses: ./.github/setup - with: - java-version: 11 - - - name: Load caches - uses: ./.github/cache - - - name: Download build artifact - uses: ./.github/download-artifact - - - name: Build docs - run: | - set -eux - ./gradlew mkdocsBuild $GRADLE_ARGS - ./gradlew mkdocsVersionsFile $GRADLE_ARGS - - - name: Review generated docs - run: | - set -eux - ls -l build/mkdocs - cat build/mkdocs/versions.json | jq - - - name: Build API docs - run: ./gradlew dokkaHtmlMultiModule $GRADLE_ARGS - - - name: Copy docs - if: | - github.event_name == 'push' && ( - startsWith(github.ref, 'refs/tags/v') || - github.ref == 'refs/heads/master' || - github.ref == 'refs/heads/docs' - ) - run: ./gradlew gitPublishCopy $GRADLE_ARGS - - - name: Review publishing docs - run: | - set -eux - ls -l .gradle/gh-pages - cat .gradle/gh-pages/versions.json | jq - - - name: Publish documentation - if: | - github.event_name == 'push' && ( - startsWith(github.ref, 'refs/tags/v') || - github.ref == 'refs/heads/master' || - github.ref == 'refs/heads/docs' - ) - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./.gradle/gh-pages - # keep_files: true - full_commit_message: Publish documentation for ${{ github.ref }} + # docs: + # needs: integ-tests + # if: | + # always() && + # !contains(github.event.head_commit.message, '[skip docs]') + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # with: + # # We need to fetch last tag for version + # fetch-depth: 0 + + # - name: Setup + # uses: ./.github/setup + # with: + # java-version: 11 + + # - name: Load caches + # uses: ./.github/cache + + # - name: Download build artifact + # uses: ./.github/download-artifact + + # - name: Build docs + # run: | + # set -eux + # ./gradlew mkdocsBuild $GRADLE_ARGS + # ./gradlew mkdocsVersionsFile $GRADLE_ARGS + + # - name: Review generated docs + # run: | + # set -eux + # ls -l build/mkdocs + # cat build/mkdocs/versions.json | jq + + # - name: Build API docs + # run: ./gradlew dokkaHtmlMultiModule $GRADLE_ARGS + + # - name: Copy docs + # if: | + # github.event_name == 'push' && ( + # startsWith(github.ref, 'refs/tags/v') || + # github.ref == 'refs/heads/master' || + # github.ref == 'refs/heads/docs' + # ) + # run: ./gradlew gitPublishCopy $GRADLE_ARGS + + # - name: Review publishing docs + # run: | + # set -eux + # ls -l .gradle/gh-pages + # cat .gradle/gh-pages/versions.json | jq + + # - name: Publish documentation + # if: | + # github.event_name == 'push' && ( + # startsWith(github.ref, 'refs/tags/v') || + # github.ref == 'refs/heads/master' || + # github.ref == 'refs/heads/docs' + # ) + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: ./.gradle/gh-pages + # # keep_files: true + # full_commit_message: Publish documentation for ${{ github.ref }} cleanup: if: always() diff --git a/build.gradle.kts b/build.gradle.kts index 165b7750c7..4cd6b328b5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,8 +20,9 @@ repositories { mavenCentral() } -val gitDescribe = grgit.describe(mapOf("match" to listOf("v*"), "tags" to true)) - ?: "v0.0.0-SNAPSHOT" +val gitDescribe = "v0.0.31" +// val gitDescribe = grgit.describe(mapOf("match" to listOf("v*"), "tags" to true)) +// ?: "v0.0.0-SNAPSHOT" // Collect all source and class directories for jacoco // TODO: Is there a better way to do that?