<commit_before># This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on: [push, pull_request]

jobs:

  matrix_prep:
    # Using a separate job and agent so as to be able to use tools like 'sed' and 'jq'
    runs-on: ubuntu-20.04
    # Defining outputs of a job allows for easier consumption and use
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
    # Checking out code as the set-matrix step utilizes a file named matrix_includes.json
    - name: Check out code
      uses: actions/checkout@v2
    # This step is explained more in a following section
    - id: set-matrix
      run: |
        matrix=$(jq . .github/workflows/matrix_includes.json)
        echo ::set-output name=matrix::{\"include\":$(echo $matrix)}\"

  build:
    needs: matrix_prep
    runs-on: ubuntu-20.04
    strategy:
      # We need to convert the json string output into an object that the GitHub Workflow expects.
      # Thankfully, the json-schema for Workflows allows 'matrix' to be set to an expression.
      matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}

    steps:
    - name: Environment
      run: |
        echo GITHUB_WORKSPACE $GITHUB_WORKSPACE
        echo GITHUB_REF $GITHUB_REF
        echo GITHUB_SHA $GITHUB_SHA
        echo GITHUB_EVENT_NAME $GITHUB_EVENT_NAME
        echo JAVA ${{ matrix.java }}
        echo PROFILE ${{ matrix.profile }}
        echo TYCHO ${{ matrix.tycho }}

    - name: Check if update site is needed
      id: updatesite_check
      env:
        PROFILE: ${{ matrix.profile }}
      run: |
        if [[ "$PROFILE" == *"updatesites"* ]]; then export UPDATE_SITES=true; fi
        echo ::set-output name=UPDATE_SITES::${UPDATE_SITES}

    - name: Check out code
      uses: actions/checkout@v2
    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v1
      with:
        java-version: ${{ matrix.java }}
    - uses: actions/cache@v1
      with:
        path: ~/.m2/repository
        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.product') }}
        restore-keys: |
          ${{ runner.os }}-maven-

    - name: Setup website (documentation)
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        chmod a+x ./scripts/website-install.sh
        ./scripts/website-install.sh

    - name: Setup MS Word add-in
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        chmod a+x ./scripts/word-add-in-install.sh
        ./scripts/word-add-in-install.sh
    
    - name: Create directory for website (documentation)
      run: |
        mkdir plugins/org.obeonetwork.m2doc.doc/doc
    - name: Build website (documentation)
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        export TAG="nightly"
        if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi
        echo TAG $TAG
        chmod a+x ./scripts/website-build.sh
        ./scripts/website-build.sh $TAG

    - name: Create directory for MS Word add-in
      run: |
        mkdir plugins/org.obeonetwork.m2doc.word.addin/dist/
    - name: Build MS Word add-in
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        chmod a+x ./scripts/word-add-in-build.sh
        ./scripts/word-add-in-build.sh

    - name: Install metacity
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        sudo apt install metacity

    - name: Build with Maven (${{ matrix.profile }})
      env:
        MAVEN_OPTS: -XX:MaxPermSize=512m -Xmx2048m -Xms1024m
      uses: GabrielBB/xvfb-action@v1
      with:
        run: mvn clean verify -fae -P${{ matrix.profile }} "-Dtycho=${{ matrix.tycho }}"

    - name: Prepare deploy local directory
      id: prepare_deploy
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)/nightly"
        if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi<commit_msg>Moved GabrielBB/xvfb-action from version 1 to 1.6.<commit_after># This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on: [push, pull_request]

jobs:

  matrix_prep:
    # Using a separate job and agent so as to be able to use tools like 'sed' and 'jq'
    runs-on: ubuntu-20.04
    # Defining outputs of a job allows for easier consumption and use
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
    # Checking out code as the set-matrix step utilizes a file named matrix_includes.json
    - name: Check out code
      uses: actions/checkout@v2
    # This step is explained more in a following section
    - id: set-matrix
      run: |
        matrix=$(jq . .github/workflows/matrix_includes.json)
        echo ::set-output name=matrix::{\"include\":$(echo $matrix)}\"

  build:
    needs: matrix_prep
    runs-on: ubuntu-20.04
    strategy:
      # We need to convert the json string output into an object that the GitHub Workflow expects.
      # Thankfully, the json-schema for Workflows allows 'matrix' to be set to an expression.
      matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}

    steps:
    - name: Environment
      run: |
        echo GITHUB_WORKSPACE $GITHUB_WORKSPACE
        echo GITHUB_REF $GITHUB_REF
        echo GITHUB_SHA $GITHUB_SHA
        echo GITHUB_EVENT_NAME $GITHUB_EVENT_NAME
        echo JAVA ${{ matrix.java }}
        echo PROFILE ${{ matrix.profile }}
        echo TYCHO ${{ matrix.tycho }}

    - name: Check if update site is needed
      id: updatesite_check
      env:
        PROFILE: ${{ matrix.profile }}
      run: |
        if [[ "$PROFILE" == *"updatesites"* ]]; then export UPDATE_SITES=true; fi
        echo ::set-output name=UPDATE_SITES::${UPDATE_SITES}

    - name: Check out code
      uses: actions/checkout@v2
    - name: Set up JDK ${{ matrix.java }}
      uses: actions/setup-java@v1
      with:
        java-version: ${{ matrix.java }}
    - uses: actions/cache@v1
      with:
        path: ~/.m2/repository
        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.product') }}
        restore-keys: |
          ${{ runner.os }}-maven-

    - name: Setup website (documentation)
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        chmod a+x ./scripts/website-install.sh
        ./scripts/website-install.sh

    - name: Setup MS Word add-in
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        chmod a+x ./scripts/word-add-in-install.sh
        ./scripts/word-add-in-install.sh
    
    - name: Create directory for website (documentation)
      run: |
        mkdir plugins/org.obeonetwork.m2doc.doc/doc
    - name: Build website (documentation)
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        export TAG="nightly"
        if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi
        echo TAG $TAG
        chmod a+x ./scripts/website-build.sh
        ./scripts/website-build.sh $TAG

    - name: Create directory for MS Word add-in
      run: |
        mkdir plugins/org.obeonetwork.m2doc.word.addin/dist/
    - name: Build MS Word add-in
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        chmod a+x ./scripts/word-add-in-build.sh
        ./scripts/word-add-in-build.sh

    - name: Install metacity
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        sudo apt install metacity

    - name: Build with Maven (${{ matrix.profile }})
      env:
        MAVEN_OPTS: -XX:MaxPermSize=512m -Xmx2048m -Xms1024m
      uses: GabrielBB/xvfb-action@v1.6
      with:
        run: mvn clean verify -fae -P${{ matrix.profile }} "-Dtycho=${{ matrix.tycho }}"

    - name: Prepare deploy local directory
      id: prepare_deploy
      if: ${{ steps.updatesite_check.outputs.UPDATE_SITES }}
      run: |
        export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)/nightly"
        if [[ "$(echo $GITHUB_REF | cut -d"/" -f2)" != "heads" ]]; then export TAG_OR_BRANCH="$(echo $GITHUB_REF | cut -d"/" -f3)"; fi
{'fraction_non_alphanumeric': 0.13003641489486667, 'fraction_numerical': 0.007987783390109245, 'mean_word_length': 2.4165329052969504, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '4376248', 'n_tokens_mistral': 2915, 'n_tokens_neox': 2752, 'n_words': 723}