Skip to content

Commit

Permalink
Maven modules depends on JDK (langchain4j#1979)
Browse files Browse the repository at this point in the history
## Issue
Simplify CI configuration

## Change

- Use maven profile to activate project modules, depending on active JDK
- Simplify CI configuration

This pull request includes several updates to the CI workflows and the
`pom.xml` file, primarily focusing on simplifying the Maven options and
restructuring module definitions. The most important changes include
replacing `included_modules` with `mvn_opts` in the workflow files and
updating the `pom.xml` to conditionally include the `langchain4j-jlama`
module based on the JDK version.

### CI Workflow Updates:

*
[`.github/workflows/main.yaml`](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L37-R39):
Replaced `included_modules` with `mvn_opts` to simplify the Maven
command options.
[[1]](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L37-R39)
[[2]](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L62-R62)
[[3]](diffhunk://#diff-71cabc4177e41ea8f15a89eb65398fa8187739f68a2762706d84885cd8b2ddc3L73-R73)
*
[`.github/workflows/nightly.yaml`](diffhunk://#diff-e79198339eb3fcc6974b6912e52526068eab3b7952ed67d03276479a235eb58eL18-R20):
Made similar changes to replace `included_modules` with `mvn_opts` for
consistency across workflows.
[[1]](diffhunk://#diff-e79198339eb3fcc6974b6912e52526068eab3b7952ed67d03276479a235eb58eL18-R20)
[[2]](diffhunk://#diff-e79198339eb3fcc6974b6912e52526068eab3b7952ed67d03276479a235eb58eL45-R51)

### `pom.xml` Updates:

*
[`pom.xml`](diffhunk://#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8L35):
Removed the `langchain4j-jlama` module from the default module list and
added it to a new profile activated only for JDK 21 and above.
[[1]](diffhunk://#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8L35)
[[2]](diffhunk://#diff-9c5fb3d1b7e3b0f54bc5c4182965c4fe1f9023d449017cece3005d3f90e8e4d8R175-R183)

## General checklist
- [x] There are no breaking changes
- [ ] I have added unit and integration tests for my change
- [ ] I have manually run all the unit and integration tests in the
module I have added/changed, and they are all green
- [ ] I have manually run all the unit and integration tests in the
[core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core)
and
[main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j)
modules, and they are all green
- [ ] I have added/updated the
[documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples
repo](https://github.com/langchain4j/langchain4j-examples) (only for
"big" features)
- [ ] I have added/updated [Spring Boot
starter(s)](https://github.com/langchain4j/langchain4j-spring) (if
applicable)
  • Loading branch information
kpavlov authored Oct 25, 2024
1 parent a7964b4 commit 7fa20bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
- 21
include:
- java_version: '17'
included_modules: '-pl !langchain4j-jlama'
mvn_opts: ''
- java_version: '21'
included_modules: ''
mvn_opts: ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -59,7 +59,7 @@ jobs:
run: |
mvn -B -U -T8C test javadoc:aggregate \
-Dgib.disable=false -Dgib.referenceBranch=__branch_before \
${{ matrix.included_modules }}
${{ matrix.mvn_opts }}
- name: Integration test with JDK ${{ matrix.java_version }}
## allow builds to run only:
Expand All @@ -70,7 +70,7 @@ jobs:
run: |
mvn -B -U verify \
-Dgib.disable=false -Dgib.referenceBranch=__branch_before \
${{ matrix.included_modules }}
${{ matrix.mvn_opts }}
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- 21
include:
- java_version: '17'
included_modules: '-pl !langchain4j-jlama'
mvn_opts: ''
- java_version: '21'
included_modules: ''
mvn_opts: ''
max-parallel: 1
runs-on: ubuntu-latest
steps:
Expand All @@ -42,13 +42,13 @@ jobs:
## compile and verify javadocs on ALL modules
mvn -B -U -T8C test javadoc:aggregate \
--fail-at-end \
${{ matrix.included_modules }}
${{ matrix.mvn_opts }}
## run tests for some modules
mvn -B -U verify \
--fail-at-end \
-Dmaven.test.failure.ignore=true \
${{ matrix.included_modules }}
${{ matrix.mvn_opts }}
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<module>langchain4j-cohere</module>
<module>langchain4j-dashscope</module>
<module>langchain4j-hugging-face</module>
<module>langchain4j-jlama</module>
<module>langchain4j-jina</module>
<module>langchain4j-local-ai</module>
<module>langchain4j-mistral-ai</module>
Expand Down Expand Up @@ -173,6 +172,15 @@
</reporting>

<profiles>
<profile>
<id>jdk21</id>
<activation>
<jdk>[21,)</jdk>
</activation>
<modules>
<module>langchain4j-jlama</module>
</modules>
</profile>
<profile>
<id>openrewrite</id>
<!-- `mvn -P openrewrite org.openrewrite.maven:rewrite-maven-plugin:run` -->
Expand Down

0 comments on commit 7fa20bc

Please sign in to comment.