<commit_before># This workflow builds stable releases

name: Build stable release

on:
  push:
    tags:
      - "*"

jobs:
  build:
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        include:
          - mongodb-version: 3.6
            karate-options: "--tags ~@requires-mongodb-4 ~@requires-replica-set"
          - mongodb-version: 4.2
          - mongodb-version: 4.4
            deploy: true
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-

      - name: Set up JDK 16
        uses: actions/setup-java@v2
        with:
          distribution: "adopt"
          java-version: 16

      - name: Set the VERSION
        id: vars
        run: |
          echo "::set-output name=VERSION::$(echo ${GITHUB_REF:10})"
          echo "VERSION=${{steps.vars.outputs.VERSION}}"

      - name: Build and Test
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
        run: mvn -B verify -Dmongodb.version="${{ matrix.mongodb-version }}" -Dkarate.options="${{ matrix.karate-options }}"

      - name: Set up QEMU
        if: ${{ matrix.deploy }}
        uses: docker/setup-qemu-action@v1

      - name: Set up Docker Buildx
        if: ${{ matrix.deploy }}
        uses: docker/setup-buildx-action@v1

      - name: Login to DockerHub
        if: ${{ matrix.deploy }}
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      # - name: Build and Push distroless Docker image
      #   if: ${{ false }} # temporarily disabled because there's no JDK 16 for distroless images
      #   run: |
      #     docker build --file ./core/Dockerfile.distroless -t softinstigate/restheart:${{steps.vars.outputs.VERSION}}-distroless ./core/.
      #     docker push softinstigate/restheart:${{steps.vars.outputs.VERSION}}-distroless

      - name: Build and Push multi-arch Docker images
        if: ${{ matrix.deploy }}
        uses: docker/build-push-action@v2
        with:
          context: ./core/
          platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7
          push: true
          tags: softinstigate/restheart:${{steps.vars.outputs.VERSION}}

      - name: Build and Push GraalVM Docker image
        if: ${{ matrix.deploy }}
        uses: docker/build-push-action@v2
        with:
          context: ./core/
          file: ./core/Dockerfile.graalvm
          push: true
          tags: softinstigate/restheart:${{steps.vars.outputs.VERSION}}-graalvm

      - name: Upload GitHub release
        if: ${{ matrix.deploy }}
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          body: |
            Release ${{ github.ref }}
          files: |
            core/target/restheart.tar.gz
            core/target/restheart.zip
            core/target/restheart.jar
          draft: true
          prerelease: false

      - name: Import private gpg key
        if: ${{ matrix.deploy }}
        run: |
          printf "%s" "$GPG_PRIVATE_KEY" > private.key
          gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
        continue-on-error: true<commit_msg>Add tag softinstigate/restheart:latest-graalvm [skip ci]<commit_after># This workflow builds stable releases

name: Build stable release

on:
  push:
    tags:
      - "*"

jobs:
  build:
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        include:
          - mongodb-version: 3.6
            karate-options: "--tags ~@requires-mongodb-4 ~@requires-replica-set"
          - mongodb-version: 4.2
          - mongodb-version: 4.4
            deploy: true
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-

      - name: Set up JDK 16
        uses: actions/setup-java@v2
        with:
          distribution: "adopt"
          java-version: 16

      - name: Set the VERSION
        id: vars
        run: |
          echo "::set-output name=VERSION::$(echo ${GITHUB_REF:10})"
          echo "VERSION=${{steps.vars.outputs.VERSION}}"

      - name: Build and Test
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
        run: mvn -B verify -Dmongodb.version="${{ matrix.mongodb-version }}" -Dkarate.options="${{ matrix.karate-options }}"

      - name: Set up QEMU
        if: ${{ matrix.deploy }}
        uses: docker/setup-qemu-action@v1

      - name: Set up Docker Buildx
        if: ${{ matrix.deploy }}
        uses: docker/setup-buildx-action@v1

      - name: Login to DockerHub
        if: ${{ matrix.deploy }}
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      # - name: Build and Push distroless Docker image
      #   if: ${{ false }} # temporarily disabled because there's no JDK 16 for distroless images
      #   run: |
      #     docker build --file ./core/Dockerfile.distroless -t softinstigate/restheart:${{steps.vars.outputs.VERSION}}-distroless ./core/.
      #     docker push softinstigate/restheart:${{steps.vars.outputs.VERSION}}-distroless

      - name: Build and Push multi-arch Docker images
        if: ${{ matrix.deploy }}
        uses: docker/build-push-action@v2
        with:
          context: ./core/
          platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7
          push: true
          tags: softinstigate/restheart:${{steps.vars.outputs.VERSION}}

      - name: Build and Push GraalVM Docker image
        if: ${{ matrix.deploy }}
        uses: docker/build-push-action@v2
        with:
          context: ./core/
          file: ./core/Dockerfile.graalvm
          push: true
          tags: softinstigate/restheart:${{steps.vars.outputs.VERSION}}-graalvm,softinstigate/restheart:latest-graalvm

      - name: Upload GitHub release
        if: ${{ matrix.deploy }}
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          body: |
            Release ${{ github.ref }}
          files: |
            core/target/restheart.tar.gz
            core/target/restheart.zip
            core/target/restheart.jar
          draft: true
          prerelease: false

      - name: Import private gpg key
        if: ${{ matrix.deploy }}
        run: |
          printf "%s" "$GPG_PRIVATE_KEY" > private.key
          gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
        continue-on-error: true
{'fraction_non_alphanumeric': 0.1288832913518052, 'fraction_numerical': 0.011474951021550517, 'mean_word_length': 1.899391480730223, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1973047', 'n_tokens_mistral': 2334, 'n_tokens_neox': 2159, 'n_words': 489}