<commit_before>name: Java and Natives

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

env:
  # Java version to use for the release
  RELEASE_JAVA_VERSION: 11

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  version:
    name: Prepare version
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.version }}
      create_tag: ${{ steps.version.outputs.create_tag }}
      tag_name: ${{ steps.version.outputs.tag_name }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up JDK
        uses: actions/setup-java@v3
        with:
          java-version: ${{ env.RELEASE_JAVA_VERSION }}
          distribution: temurin

      # don't use the setup-java cache option as this only caches what is
      # necessary for the version, not the other jobs
      - name: Cache local Maven repository
        uses: actions/cache@v2
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-version-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-version-

      - name: Parse and set version
        id: version
        run: |
          MVNVER=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
          if [ "$GITHUB_REF" == "refs/heads/master" ]; then
            TAG_NAME="v${MVNVER/-SNAPSHOT/}"
            if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1
            then
              echo "Creating tag $TAG_NAME"
              git config --local user.name "$GITHUB_ACTOR via GitHub Actions"
              git config --local user.email "<EMAIL>"
              git tag -a "$TAG_NAME" -m "Tagged automatically by GitHub Actions ${{ github.workflow }}"
              echo "::set-output name=create_tag::true"
            else
              echo "Tag: $TAG_NAME already exists"
              echo "::set-output name=create_tag::false"
            fi
            VERSION=`git describe --match "v[0-9\.]*" --long --always`
            VERSION=${VERSION:1}
          else
            echo "Not on master"
            echo "::set-output name=create_tag::false"
            VERSION=${MVNVER}
          fi
          echo "Version: $VERSION"
          echo "::set-output name=version::${VERSION}"
          echo "::set-output name=tag_name::${TAG_NAME}"

  javatest:
    name: Java ${{ matrix.java }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java: [ 11, 17 ]

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up JDK ${{ matrix.java }}
        uses: actions/setup-java@v3
        with:
          java-version: ${{ matrix.java }}
          distribution: temurin
          cache: maven

      - name: Build and test with Maven
        run: mvn -B verify -DperformRelease=true

      - name: Upload JNI headers
        if: matrix.java == env.RELEASE_JAVA_VERSION
        uses: actions/upload-artifact@v3
        with:
          name: javah
          path: target/native

  deb:
    runs-on: ubuntu-latest
    needs:
      - version
      - javatest
    strategy:
      fail-fast: false
      matrix:
        dist:
          - { vendor: ubuntu, dist: bionic }
          - { vendor: ubuntu, dist: focal }
          - { vendor: ubuntu, dist: impish }
          - { vendor: ubuntu, dist: jammy }
          - { vendor: debian, dist: buster }
          - { vendor: debian, dist: bullseye }
        arch:<commit_msg>Remove Ubuntu Impish since Jammy is now final<commit_after>name: Java and Natives

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

env:
  # Java version to use for the release
  RELEASE_JAVA_VERSION: 11

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  version:
    name: Prepare version
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.version }}
      create_tag: ${{ steps.version.outputs.create_tag }}
      tag_name: ${{ steps.version.outputs.tag_name }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set up JDK
        uses: actions/setup-java@v3
        with:
          java-version: ${{ env.RELEASE_JAVA_VERSION }}
          distribution: temurin

      # don't use the setup-java cache option as this only caches what is
      # necessary for the version, not the other jobs
      - name: Cache local Maven repository
        uses: actions/cache@v2
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-version-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-version-

      - name: Parse and set version
        id: version
        run: |
          MVNVER=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
          if [ "$GITHUB_REF" == "refs/heads/master" ]; then
            TAG_NAME="v${MVNVER/-SNAPSHOT/}"
            if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1
            then
              echo "Creating tag $TAG_NAME"
              git config --local user.name "$GITHUB_ACTOR via GitHub Actions"
              git config --local user.email "<EMAIL>"
              git tag -a "$TAG_NAME" -m "Tagged automatically by GitHub Actions ${{ github.workflow }}"
              echo "::set-output name=create_tag::true"
            else
              echo "Tag: $TAG_NAME already exists"
              echo "::set-output name=create_tag::false"
            fi
            VERSION=`git describe --match "v[0-9\.]*" --long --always`
            VERSION=${VERSION:1}
          else
            echo "Not on master"
            echo "::set-output name=create_tag::false"
            VERSION=${MVNVER}
          fi
          echo "Version: $VERSION"
          echo "::set-output name=version::${VERSION}"
          echo "::set-output name=tag_name::${TAG_NAME}"

  javatest:
    name: Java ${{ matrix.java }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java: [ 11, 17 ]

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up JDK ${{ matrix.java }}
        uses: actions/setup-java@v3
        with:
          java-version: ${{ matrix.java }}
          distribution: temurin
          cache: maven

      - name: Build and test with Maven
        run: mvn -B verify -DperformRelease=true

      - name: Upload JNI headers
        if: matrix.java == env.RELEASE_JAVA_VERSION
        uses: actions/upload-artifact@v3
        with:
          name: javah
          path: target/native

  deb:
    runs-on: ubuntu-latest
    needs:
      - version
      - javatest
    strategy:
      fail-fast: false
      matrix:
        dist:
          - { vendor: ubuntu, dist: bionic }
          - { vendor: ubuntu, dist: focal }
          - { vendor: ubuntu, dist: jammy }
          - { vendor: debian, dist: buster }
          - { vendor: debian, dist: bullseye }
        arch:
{'fraction_non_alphanumeric': 0.11557717064797597, 'fraction_numerical': 0.005435560005721642, 'mean_word_length': 1.7724028548770816, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 9, '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': '959650', 'n_tokens_mistral': 2214, 'n_tokens_neox': 2060, 'n_words': 560}