name: XGBoost-JVM-Tests on: [push, pull_request] permissions: contents: read # to fetch code (actions/checkout) jobs: test-with-jvm: name: Test JVM on OS ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-11] steps: - uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v2.5.0 with: submodules: 'true' - uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a # v4.3.0 with: python-version: '3.8' architecture: 'x64' - uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 # v3.6.0 with: java-version: 1.8 - name: Install Python packages run: | python -m pip install wheel setuptools python -m pip install awscli - name: Cache Maven packages uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('./jvm-packages/pom.xml') }} restore-keys: ${{ runner.os }}-m2-${{ hashFiles('./jvm-packages/pom.xml') }} - name: Test XGBoost4J (Core) run: | cd jvm-packages mvn test -B -pl :xgboost4j_2.12 - name: Extract branch name shell: bash run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" id: extract_branch if: | (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')) && (matrix.os == 'windows-latest' || matrix.os == 'macos-11') - name: Publish artifact xgboost4j.dll to S3 run: | cd lib/ Rename-Item -Path xgboost4j.dll -NewName xgboost4j_${{ github.sha }}.dll dir python -m awscli s3 cp xgboost4j_${{ github.sha }}.dll s3://xgboost-nightly-builds/${{ steps.extract_branch.outputs.branch }}/libxgboost4j/ --acl public-read if: | (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')) && matrix.os == 'windows-latest' env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }} - name: Publish artifact libxgboost4j.dylib to S3 run: | cd lib/ mv -v libxgboost4j.dylib libxgboost4j_${{ github.sha }}.dylib ls python -m awscli s3 cp libxgboost4j_${{ github.sha }}.dylib s3://xgboost-nightly-builds/${{ steps.extract_branch.outputs.branch }}/libxgboost4j/ --acl public-read if: | (github.ref == 'refs/heads/master' || contains(github.ref, 'refs/heads/release_')) && matrix.os == 'macos-11' env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IAM_S3_UPLOADER }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IAM_S3_UPLOADER }} - name: Test XGBoost4J (Core, Spark, Examples) run: | rm -rfv build/ cd jvm-packages mvn -B test if: matrix.os == 'ubuntu-latest' # Distributed training doesn't work on Windows env: RABIT_MOCK: ON - name: Build and Test XGBoost4J with scala 2.13 run: | rm -rfv build/ cd jvm-packages mvn -B clean install test -Pdefault,scala-2.13 if: matrix.os == 'ubuntu-latest' # Distributed training doesn't work on Windows env: RABIT_MOCK: ON