diff --git a/.github/workflows/test-and-build-workflow.yml b/.github/workflows/test-and-build-workflow.yml index de9620d82..03838f37a 100644 --- a/.github/workflows/test-and-build-workflow.yml +++ b/.github/workflows/test-and-build-workflow.yml @@ -1,5 +1,4 @@ name: Test and Build Workflow -# This workflow is triggered on pull requests to main or a opendistro release branch on: pull_request: branches: @@ -12,8 +11,23 @@ jobs: build: # Job name name: Build Index Management - # This job runs on Linux - runs-on: ubuntu-latest + env: + BUILD_ARGS: -D"opensearch.version=1.3.0-SNAPSHOT" ${{ matrix.os_build_args }} + WORKING_DIR: ${{ matrix.working_directory }}. + strategy: + # This setting says that all jobs should finish, even if one fails + fail-fast: false + # This starts three jobs, setting these environment variables uniquely for the different jobs + matrix: + include: + - os: ubuntu-latest + - os: windows-latest + os_build_args: -x integTest -x jacocoTestReport + working_directory: X:\ + os_java_options: -Xmx4096M + - os: macos-latest + os_build_args: -x integTest -x jacocoTestReport + runs-on: ${{ matrix.os }} steps: # This step uses the setup-java Github action: https://github.com/actions/setup-java - name: Set Up JDK 14 @@ -23,19 +37,28 @@ jobs: # build index management - name: Checkout Branch uses: actions/checkout@v2 + # This is a hack, but this step creates a link to the X: mounted drive, which makes the path + # short enough to work on Windows + - name: Shorten Path + if: ${{ matrix.os == 'windows-latest' }} + run: subst 'X:' . - name: Build with Gradle - run: ./gradlew build -Dopensearch.version=1.3.0-SNAPSHOT + working-directory: ${{ env.WORKING_DIR }} + run: ./gradlew build ${{ env.BUILD_ARGS }} + env: + _JAVA_OPTIONS: ${{ matrix.os_java_options }} - name: Upload failed logs uses: actions/upload-artifact@v2 - if: failure() + if: ${{ failure() && matrix.os == 'ubuntu-latest' }} with: name: logs path: build/testclusters/integTest-*/logs/* - name: Create Artifact Path run: | mkdir -p index-management-artifacts - cp ./build/distributions/*.zip index-management-artifacts + cp ./build/distributions/*.zip index-management-artifacts - name: Uploads coverage + if: ${{ matrix.os == 'ubuntu-latest' }} uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -43,5 +66,5 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v1 with: - name: index-management-plugin + name: index-management-plugin-${{ matrix.os }} path: index-management-artifacts