Skip to content

Commit

Permalink
Standardize build/test github actions and java versions (#623)
Browse files Browse the repository at this point in the history
* setup-java action to v4

Signed-off-by: Finn Carroll <[email protected]>

* Update all setup-java actions

Signed-off-by: Finn Carroll <[email protected]>

* Upgrade actions/checkout to v4

Signed-off-by: Finn Carroll <[email protected]>

* Build/publish/release java 11/17/21 but test only with java 21

Signed-off-by: Finn Carroll <[email protected]>

* Only workflows runs in container need to downgrade checkout/java-setup actions to @V3. Workflows run directly on runners already have up to date glibc.

Signed-off-by: Finn Carroll <[email protected]>

* Revert java matrix anchor

Signed-off-by: Finn Carroll <[email protected]>

* Build and release only with configured sourceCompatibility/targetCompatibility java 21

Signed-off-by: Finn Carroll <[email protected]>

---------

Signed-off-by: Finn Carroll <[email protected]>
  • Loading branch information
finnegancarroll authored Sep 17, 2024
1 parent a4cf835 commit d1c801f
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 31 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write

env: # actions/checkout uses node 16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
- name: GitHub App token
id: github_app_token
Expand All @@ -22,7 +26,7 @@ jobs:
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ncipollo/release-action@v1
with:
github_token: ${{ steps.github_app_token.outputs.token }}
Expand Down
53 changes: 35 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ jobs:
product: opensearch

linux-build:
needs: Get-CI-Image-Tag
strategy:
matrix:
java:
- 21
java: [ 21 ]
needs: Get-CI-Image-Tag
# Job name
name: Linux - Build Asynchronous Search
# This job runs on Linux.
Expand All @@ -33,18 +32,23 @@ jobs:
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root

# actions/checkout@v4 and actions/setup-java@v4 use node 20:
# https://github.com/actions/checkout/releases/tag/v4.0.0
# container image does not have GLIBC_2.28 required for this node version
# as such use @v3 actions instead for this workflow and set ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
- name: Set up JDK ${{ matrix.java }} for build and test
uses: actions/setup-java@v3
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}
# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build with Gradle
id: step-build-test-linux
run: |
Expand All @@ -65,18 +69,21 @@ jobs:
if-no-files-found: error

linux-test-docker:
needs: linux-build
strategy:
matrix:
java:
- 21
java: [ 21 ]
needs: linux-build
# Job name
name: Test Asynchronous Search with opensearchstaging docker
# This job runs on Linux.
runs-on: ubuntu-latest

env: # actions/checkout uses node 16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: async-plugin-linux-${{ matrix.java }}
Expand Down Expand Up @@ -138,19 +145,24 @@ jobs:
path: build/testclusters/integTest-*/logs/*

windows-build:
strategy:
matrix:
java: [ 21 ]
# Job name
name: Windows - Build Asynchronous Search
# This job runs on Windows.
runs-on: windows-latest

steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK 21
uses: actions/setup-java@v1
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: 21
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}
# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build with Gradle
run: ./gradlew.bat build -x integTest -x jacocoTestReport
env:
Expand All @@ -167,19 +179,24 @@ jobs:
path: asynchronous-search-artifacts

mac-os-build:
strategy:
matrix:
java: [ 21 ]
# Job name
name: MacOS - Build Asynchronous Search
# This job runs on Mac OS.
runs-on: macos-latest

steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK 21
uses: actions/setup-java@v1
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: 21
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}
# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build with Gradle
run: ./gradlew build -x integTest -x jacocoTestReport
env:
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ on:

jobs:
build-and-publish-snapshots:
strategy:
matrix:
java: [ 11,17,21 ]

runs-on: ubuntu-latest

permissions:
id-token: write
contents: write

steps:
- uses: actions/setup-java@v3
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: 11
- uses: actions/checkout@v3
java-version: ${{ matrix.java }}
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.PUBLISH_SNAPSHOTS_ROLE }}
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Multi node test workflow

env:
java_version: 21
# This workflow is triggered on pull requests to master
on:
pull_request:
Expand All @@ -18,6 +16,9 @@ jobs:
product: opensearch

build:
strategy:
matrix:
java: [ 21 ]
# Job name
needs: Get-CI-Image-Tag
name: Build Asynchronous Search
Expand All @@ -30,18 +31,24 @@ jobs:
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root

# actions/checkout@v4 and actions/setup-java@v4 use node 20:
# https://github.com/actions/checkout/releases/tag/v4.0.0
# container image does not have GLIBC_2.28 required for this node version
# as such use @v3 actions instead for this workflow and set ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK 21
uses: actions/setup-java@v1
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.java_version }}
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}

# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run integration tests with multi node config
run: |
chown -R 1000:1000 `pwd`
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ jobs:
build:
strategy:
matrix:
java: [11,17,21]
java: [21]
# Job name
name: Build Asynchronous Search with JDK ${{ matrix.java }}
# This job runs on Linux
runs-on: ubuntu-latest

steps:
# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v4
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}

# Building zip, deb and rpm files
Expand Down

0 comments on commit d1c801f

Please sign in to comment.