Skip to content

Commit

Permalink
Backport workflow improvements and increment version (opensearch-proj…
Browse files Browse the repository at this point in the history
…ect#446)

* Improve time taken by Github actions (opensearch-project#439)

* Improve time taken by Github actions

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Add Changelog

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixing distribution and adding cache

Signed-off-by: Vacha Shah <vachshah@amazon.com>

---------

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixing Changelog

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Increment to version 2.5.0

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixing Changelog

Signed-off-by: Vacha Shah <vachshah@amazon.com>

---------

Signed-off-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
VachaShah authored Apr 13, 2023
1 parent 7a80b89 commit f0d3f7d
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 31 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ jobs:
java: [ 11 ]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout Java Client
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}

- name: Checkout Branch
uses: actions/checkout@v2
distribution: 'temurin'
cache: 'gradle'

- name: Build with Gradle
run: ./gradlew clean build -x test
8 changes: 6 additions & 2 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ jobs:
matrix:
java: [ 11 ]
steps:
- name: Checkout Java Client
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'

- uses: actions/checkout@v2
- name: Check style and license headers
run: |
./gradlew checkstyleMain checkstyleTest
2 changes: 1 addition & 1 deletion .github/workflows/dependabot_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
installation_id: 22958780

- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ steps.github_app_token.outputs.token }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: lychee Link Checker
id: lychee
uses: lycheeverse/lychee-action@v1.5.0
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ jobs:
issue-body: "Please approve or deny the release of opensearch-java. **VERSION**: ${{ steps.get_data.outputs.version }} **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }}"
exclude-workflow-initiator-as-approver: true
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
run: |
export VERSION=`cat gradle.properties | grep "systemProp.version" | tr -d " " | cut -d '=' -f2`
Expand Down
43 changes: 31 additions & 12 deletions .github/workflows/test-integration-unreleased.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,55 @@ jobs:
- { opensearch_ref: '1.x', java: 11 }
- { opensearch_ref: '2.x', java: 11 }
- { opensearch_ref: '2.x', java: 17 }
- { opensearch_ref: '2.0', java: 11 }
- { opensearch_ref: 'main', java: 11 }
- { opensearch_ref: 'main', java: 17 }
steps:
- name: Set up JDK ${{ matrix.entry.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.entry.java }}
distribution: 'temurin'

- name: Checkout OpenSearch
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: opensearch-project/OpenSearch
ref: ${{ matrix.entry.opensearch_ref }}
path: opensearch

- name: Get OpenSearch branch top
id: get-key
working-directory: opensearch
run: echo key=`git log -1 --format='%H'` >> $GITHUB_OUTPUT

- name: Restore cached build
id: cache-restore
uses: actions/cache/restore@v3
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

- name: Assemble OpenSearch
run: |
cd opensearch
./gradlew assemble
if: steps.cache-restore.outputs.cache-hit != 'true'
working-directory: opensearch
run: ./gradlew :distribution:archives:linux-tar:assemble

- name: Save cached build
if: steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: opensearch/distribution/archives/linux-tar/build/distributions
key: ${{ steps.get-key.outputs.key }}

# This step runs the docker image generated during gradle assemble in OpenSearch. It is tagged as opensearch:test.
# Reference: https://github.com/opensearch-project/OpenSearch/blob/2.0/distribution/docker/build.gradle#L190
- name: Run Docker Image
- name: Run OpenSearch
working-directory: opensearch/distribution/archives/linux-tar/build/distributions
run: |
docker run -p 9200:9200 -p 9600:9600 -d -e "discovery.type=single-node" -e "bootstrap.memory_lock=true" opensearch:test
sleep 90
tar xf opensearch-min-*
./opensearch-*/bin/opensearch &
for attempt in {1..20}; do sleep 5; if curl -s localhost:9200; then echo '=====> ready'; break; fi; echo '=====> waiting...'; done
- name: Checkout Java Client
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: opensearch-java

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ jobs:
- { opensearch_version: 2.4.1, java: 11 }
- { opensearch_version: 2.5.0, java: 11 }
steps:
- name: Checkout Java Client
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.entry.java }}

- name: Checkout Branch
uses: actions/checkout@v2
distribution: 'temurin'
cache: 'gradle'

- name: Run Docker
run: |
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ jobs:
java: [ 11 ]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Checkout Java Client
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}

- name: Checkout Branch
uses: actions/checkout@v2
distribution: 'temurin'
cache: 'gradle'

- name: Run Unit Test
run: ./gradlew clean unitTest
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Dependencies

### Changed
- Improve time taken by Github actions by using cache ([#439](https://github.com/opensearch-project/opensearch-java/pull/439))

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
systemProp.version = 2.4.0
systemProp.version = 2.5.0

0 comments on commit f0d3f7d

Please sign in to comment.