name: facebook/rocksdb/jobs-java
on: [push, pull_request]
jobs:
  build-linux-java:
    runs-on:
      labels: 4-core-ubuntu
    container:
      image: zjay437/rocksdb:0.6
      options: --shm-size=16gb
    steps:
    - uses: actions/checkout@v4.1.0
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Test RocksDBJava
      run: make V=1 J=8 -j8 jtest
    - uses: "./.github/actions/post-steps"
  build-linux-java-static27:
    runs-on:
      labels: 4-core-ubuntu
    container:
      image: evolvedbinary/rocksjava:centos6_x64-be
      options: --shm-size=16gb
    steps:
    - name: Checkout
      env:
        GH_TOKEN: ${{ github.token }}
      run: |
        yum install -y git
        git clone --no-checkout https://oath2:$GH_TOKEN@github.com/${{ github.repository }}.git .
        git -c protocol.version=2 fetch --update-head-ok --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:${{ github.ref }}
        git checkout --progress --force ${{ github.ref }}
        git log -1 --format='%H'
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava Static Library
      run: scl enable devtoolset-7 'make V=1 J=8 -j8 rocksdbjavastatic'
    - uses: "./.github/actions/post-steps"
  build-linux-java-static35:
    runs-on:
      labels: 4-core-ubuntu
    container:
      image: evolvedbinary/rocksjava:centos6_x64-be
      options: --shm-size=16gb
    steps:
    - name: Checkout
      env:
        GH_TOKEN: ${{ github.token }}
      run: |
        yum install -y git
        git clone --no-checkout https://oath2:$GH_TOKEN@github.com/${{ github.repository }}.git .
        git -c protocol.version=2 fetch --update-head-ok --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:${{ github.ref }}
        git checkout --progress --force ${{ github.ref }}
        git log -1 --format='%H'
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava Static Library
      run: scl enable devtoolset-7 'make V=1 J=8 -j8 rocksdbjavastatic'
    - uses: "./.github/actions/post-steps"
  build-linux-java-static36:
    runs-on:
      labels: 4-core-ubuntu
    container:
      image: evolvedbinary/rocksjava:centos6_x64-be
      options: --shm-size=16gb
    steps:
    - name: Checkout
      env:
        GH_TOKEN: ${{ github.token }}
      run: |
        yum install -y git
        git clone --no-checkout https://oath2:$GH_TOKEN@github.com/${{ github.repository }}.git .
        git -c protocol.version=2 fetch --update-head-ok --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:${{ github.ref }}
        git checkout --progress --force ${{ github.ref }}
        git log -1 --format='%H'
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava Static Library
      run: scl enable devtoolset-7 'make V=1 J=8 -j8 rocksdbjavastatic'
    - uses: "./.github/actions/post-steps"
  build-linux-java-static40:
    runs-on:
      labels: 4-core-ubuntu
    container:
      image: evolvedbinary/rocksjava:centos6_x64-be
      options: --shm-size=16gb
    steps:
    - name: Checkout
      env:
        GH_TOKEN: ${{ github.token }}
      run: |
        yum install -y git
        git clone --no-checkout https://oath2:$GH_TOKEN@github.com/${{ github.repository }}.git .
        git -c protocol.version=2 fetch --update-head-ok --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:${{ github.ref }}
        git checkout --progress --force ${{ github.ref }}
        git log -1 --format='%H'
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava Static Library
      run: scl enable devtoolset-7 'make V=1 J=8 -j8 rocksdbjavastatic'
    - uses: "./.github/actions/post-steps"
  build-linux-java-static41:
    runs-on:
      labels: 4-core-ubuntu
    container:
      image: evolvedbinary/rocksjava:centos6_x64-be
      options: --shm-size=16gb
    steps:
    - name: Checkout
      env:
        GH_TOKEN: ${{ github.token }}
      run: |
        yum install -y git
        git clone --no-checkout https://oath2:$GH_TOKEN@github.com/${{ github.repository }}.git .
        git -c protocol.version=2 fetch --update-head-ok --no-tags --prune --no-recurse-submodules --depth=1 origin +${{ github.sha }}:${{ github.ref }}
        git checkout --progress --force ${{ github.ref }}
        git log -1 --format='%H'
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava Static Library
      run: scl enable devtoolset-7 'make V=1 J=8 -j8 rocksdbjavastatic'
    - uses: "./.github/actions/post-steps"
  build-macos-java:
    runs-on: macos-13
    env:
      JAVA_HOME: "/Library/Java/JavaVirtualMachines/liberica-jdk-8.jdk/Contents/Home"
      ROCKSDB_DISABLE_JEMALLOC: 1
    steps:
    - uses: actions/checkout@v4.1.0
    - uses: maxim-lobanov/setup-xcode@v1.6.0
      with:
        xcode-version: 14.3.1
    - uses: "./.github/actions/increase-max-open-files-on-macos"
    - uses: "./.github/actions/install-gflags-on-macos"
    - uses: "./.github/actions/install-jdk8-on-macos"
    - uses: "./.github/actions/pre-steps-macos"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Test RocksDBJava
      run: make V=1 J=16 -j16 jtest
    - uses: "./.github/actions/post-steps"
  build-macos-java-static:
    runs-on: macos-13
    env:
      JAVA_HOME: "/Library/Java/JavaVirtualMachines/liberica-jdk-8.jdk/Contents/Home"
    steps:
    - uses: actions/checkout@v4.1.0
    - uses: maxim-lobanov/setup-xcode@v1.6.0
      with:
        xcode-version: 14.3.1
    - uses: "./.github/actions/increase-max-open-files-on-macos"
    - uses: "./.github/actions/install-gflags-on-macos"
    - uses: "./.github/actions/install-jdk8-on-macos"
    - uses: "./.github/actions/pre-steps-macos"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava x86 and ARM Static Libraries
      run: make V=1 J=16 -j16 rocksdbjavastaticosx
    - uses: "./.github/actions/post-steps"
  build-macos-java-static-universal:
    runs-on: macos-13
    env:
      JAVA_HOME: "/Library/Java/JavaVirtualMachines/liberica-jdk-8.jdk/Contents/Home"
    steps:
    - uses: actions/checkout@v4.1.0
    - uses: maxim-lobanov/setup-xcode@v1.6.0
      with:
        xcode-version: 14.3.1
    - uses: "./.github/actions/increase-max-open-files-on-macos"
    - uses: "./.github/actions/install-gflags-on-macos"
    - uses: "./.github/actions/install-jdk8-on-macos"
    - uses: "./.github/actions/pre-steps-macos"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: Build RocksDBJava Universal Binary Static Library
      run: make V=1 J=16 -j16 rocksdbjavastaticosx_ub
    - uses: "./.github/actions/post-steps"
  build-linux-java-pmd:
    runs-on:
      labels: 4-core-ubuntu
    steps:
    - uses: actions/checkout@v4.1.0
    - uses: "./.github/actions/install-maven"
    - uses: "./.github/actions/pre-steps"
    - name: Set Java Environment
      run: |-
        echo "JAVA_HOME=${JAVA_HOME}"
        which java && java -version
        which javac && javac -version
    - name: PMD RocksDBJava
      run: make V=1 J=8 -j8 jpmd
    - uses: "./.github/actions/post-pmd-steps"