Skip to content

Commit

Permalink
Use docker CI image for Linux build (#15) (#21)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis authored Jan 6, 2025
1 parent c41551f commit 63a156f
Showing 1 changed file with 69 additions and 9 deletions.
78 changes: 69 additions & 9 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,95 @@ on:
pull_request:
branches:
- "*"
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
build:
Get-CI-Image-Tag:
uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
with:
product: opensearch
spotless:
if: github.repository == 'opensearch-project/opensearch-remote-metadata-sdk'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Spotless Check
run: ./gradlew spotlessCheck
javadoc:
if: github.repository == 'opensearch-project/opensearch-remote-metadata-sdk'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Javadoc CheckStyle
run: ./gradlew checkstyleMain
- name: Javadoc Check
run: ./gradlew javadoc

build-linux:
needs: [Get-CI-Image-Tag, spotless, javadoc]
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
java:
- 21
- 23
name: Build and Test
runs-on: ${{ matrix.os }}
name: Linux JDK ${{ matrix.java }}
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
- name: Build and Run Tests
id: step-build-test-linux
run: |
./gradlew build
chown -R 1000:1000 `pwd`
su `id -un 1000` -c 'whoami && java -version &&
echo "build and run tests" && ./gradlew build &&
echo "Publish to Maven Local" && ./gradlew publishToMavenLocal'
- name: Upload Coverage Report
if: contains(matrix.os, 'ubuntu') && contains(matrix.java, '21')
if: contains(matrix.java, '21')
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./build/reports/jacoco/test/jacocoTestReport.xml

build-windows:
needs: [spotless, javadoc]
strategy:
matrix:
java:
- 21
- 23
name: Windows JDK ${{ matrix.java }}
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
- name: Build and Run Tests
run: |
./gradlew build

0 comments on commit 63a156f

Please sign in to comment.