-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add JAR files as runtime dependencies to Python package. #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 23 commits
d923afb
e7f845a
5c27b8e
cd68986
8edf653
aa14af6
08e4fa5
ba24933
fd82fe5
3548944
760d442
7ff6e84
d7f2074
ce0d3db
ff62094
4a2714d
4ffa927
0678ca1
264b3ac
4c35be4
18fafba
6532057
68d2ae9
21f8eb3
b49d0f4
f51f31c
4bf1094
66af564
59ab8dd
4c19d86
9b62fc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -38,13 +38,8 @@ jobs: | |||||||||||||||||||||
| python-version: "3.10" | ||||||||||||||||||||||
| cache: "poetry" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Download JAR | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| VERSION=${{inputs.version}} | ||||||||||||||||||||||
| wget --output-document "jneqsim/neqsim-Java11.jar" "https://github.com/equinor/neqsim/releases/download/v$VERSION/neqsim-$VERSION.jar" | ||||||||||||||||||||||
| wget --output-document "jneqsim/neqsim-Java8.jar" "https://github.com/equinor/neqsim/releases/download/v$VERSION/neqsim-$VERSION-Java8.jar" | ||||||||||||||||||||||
| wget --output-document "jneqsim/neqsim-Java21.jar" "https://github.com/equinor/neqsim/releases/download/v$VERSION/neqsim-$VERSION-Java21.jar" | ||||||||||||||||||||||
| echo "Wrote JAR to jneqsim/neqsim-Java*.jar" | ||||||||||||||||||||||
| - name: Install build tools | ||||||||||||||||||||||
| run: pip install build hatch | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Install deps | ||||||||||||||||||||||
| run: poetry install --no-interaction | ||||||||||||||||||||||
|
|
@@ -53,7 +48,26 @@ jobs: | |||||||||||||||||||||
| run: poetry run python ./generate_stubs.py | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Fixup module naming | ||||||||||||||||||||||
| run: find jneqsim/neqsim -type f -name "*.pyi" -print0 | xargs -0 sed -i '' -e 's/neqsim./jneqsim.neqsim./g' || true | ||||||||||||||||||||||
| run: find jneqsim/neqsim -type f -name "*.pyi" -print0 | xargs -0 sed -i -e 's/neqsim./jneqsim.neqsim./g' || true | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Update NeqSim dependency version | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
| NEQSIM_VERSION="${{ inputs.version }}" | ||||||||||||||||||||||
| echo "Updating NeqSim dependency to version '$NEQSIM_VERSION'" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Get the current version to use as fallback | ||||||||||||||||||||||
| CURRENT_VERSION=$(grep -o 'version: "[^"]*"' jneqsim/dependencies.yaml | head -1 | sed 's/version: "\(.*\)"/\1/') | ||||||||||||||||||||||
| echo "Current version (will become fallback): '$CURRENT_VERSION'" | ||||||||||||||||||||||
| echo "New version: '$NEQSIM_VERSION'" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Update the main version to the new version | ||||||||||||||||||||||
| sed -i 's/version: "[^"]*"/version: "'"$NEQSIM_VERSION"'"/' jneqsim/dependencies.yaml | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Set fallback version to the previous version (current before update) | ||||||||||||||||||||||
| sed -i 's/fallback_version: "[^"]*"/fallback_version: "'"$CURRENT_VERSION"'"/' jneqsim/dependencies.yaml | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| echo "Updated dependencies.yaml:" | ||||||||||||||||||||||
| grep -A 10 -B 5 "version:" jneqsim/dependencies.yaml | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Bump version | ||||||||||||||||||||||
| run: | | ||||||||||||||||||||||
|
|
@@ -70,13 +84,14 @@ jobs: | |||||||||||||||||||||
| cd tests | ||||||||||||||||||||||
| python -m venv .venv | ||||||||||||||||||||||
| source .venv/bin/activate | ||||||||||||||||||||||
| pip install ../dist/jneqsim-*.tar.gz pytest | ||||||||||||||||||||||
| pip install ../dist/jneqsimsmall-*.tar.gz pytest | ||||||||||||||||||||||
| pytest | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - name: Publish package distributions to PyPI | ||||||||||||||||||||||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||||||||||||||||||||||
| with: | ||||||||||||||||||||||
| attestations: false | ||||||||||||||||||||||
| - name: Publish package to TestPyPI | ||||||||||||||||||||||
| run: hatch publish -r test | ||||||||||||||||||||||
| env: | ||||||||||||||||||||||
| HATCH_INDEX_USER: __token__ | ||||||||||||||||||||||
| HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_TOKEN_MAOHE }} | ||||||||||||||||||||||
|
||||||||||||||||||||||
| - name: Publish package to TestPyPI | |
| run: hatch publish -r test | |
| env: | |
| HATCH_INDEX_USER: __token__ | |
| HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_TOKEN_MAOHE }} | |
| - name: Publish package to PyPI | |
| run: hatch publish | |
| env: | |
| HATCH_INDEX_USER: __token__ | |
| HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will change this before merging!
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ jobs: | |
| uses: actions/[email protected] | ||
| with: | ||
| python-version: "3.9" | ||
| cache: 'poetry' | ||
| cache: "poetry" | ||
|
|
||
| - name: Check pyproject.toml validity | ||
| run: poetry check --no-interaction | ||
|
|
@@ -42,19 +42,10 @@ jobs: | |
| uses: actions/[email protected] | ||
| with: | ||
| python-version: "3.12" | ||
| cache: 'poetry' | ||
| cache: "poetry" | ||
| - name: Install deps | ||
| run: poetry install --no-interaction | ||
|
|
||
| - name: Download JAR | ||
| run: | | ||
| VERSION=$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/equinor/neqsim/releases/latest | jq '.tag_name' --raw-output) | ||
| VERSION="${VERSION:1}" | ||
| wget --output-document "jneqsim/neqsim-Java11.jar" "https://github.com/equinor/neqsim/releases/download/v$VERSION/neqsim-$VERSION.jar" | ||
| wget --output-document "jneqsim/neqsim-Java8.jar" "https://github.com/equinor/neqsim/releases/download/v$VERSION/neqsim-$VERSION-Java8.jar" | ||
| wget --output-document "jneqsim/neqsim-Java21.jar" "https://github.com/equinor/neqsim/releases/download/v$VERSION/neqsim-$VERSION-Java21.jar" | ||
| echo "Wrote JAR to jneqsim/neqsim-Java*.jar" | ||
|
|
||
| - name: Generate stubs | ||
| run: poetry run python ./generate_stubs.py | ||
|
|
||
|
|
@@ -68,22 +59,22 @@ jobs: | |
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jneqsim-test-package | ||
| path: ./dist/jneqsim-0.0.0.tar.gz | ||
| path: ./dist/jneqsimsmall-0.0.0.tar.gz | ||
|
|
||
| integration: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| strategy: | ||
| matrix: | ||
| java: [ '11', '17', '21' ] | ||
| java: ["8", "11", "17", "21"] | ||
| name: Java ${{ matrix.Java }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| distribution: "temurin" | ||
| java-version: ${{ matrix.java }} | ||
|
|
||
| - name: Download dist artifact | ||
|
|
@@ -96,5 +87,5 @@ jobs: | |
| cd tests | ||
| python -m venv .venv | ||
| source .venv/bin/activate | ||
| pip install ../jneqsim-0.0.0.tar.gz pytest | ||
| pytest | ||
| pip install ../jneqsimsmall-0.0.0.tar.gz pytest | ||
| pytest | ||
MarcusDragsten marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # NeqSim Dependency Configuration | ||
| # This file defines how to resolve NeqSim Java dependencies | ||
|
|
||
| neqsim: | ||
| # Version to use (specific version that has been tested with this jneqsim release) | ||
| # This version is automatically updated by the CI/CD pipeline when a new NeqSim release is published | ||
| version: "3.0.43" | ||
|
|
||
| # Fallback version when GitHub API is unavailable (rate limited, network issues) | ||
| # This should be the previous tested version, providing a safety fallback mechanism | ||
| # The CI/CD pipeline automatically sets this to the previous version when updating | ||
| fallback_version: "3.0.42" | ||
|
|
||
| # GitHub Releases source | ||
| sources: | ||
| github: | ||
| enabled: true | ||
| repository: "equinor/neqsim" | ||
| base_url: "https://github.com/equinor/neqsim/releases/download" | ||
| # JAR file patterns for different Java versions | ||
| # Note: The code will try multiple naming patterns per Java version | ||
| # (e.g., Java21-Java21, Java21) to handle variations | ||
| assets: | ||
| java8: "neqsim-{version}-Java8.jar" | ||
| java11: "neqsim-{version}.jar" # Java 11+ version | ||
| java21: "neqsim-{version}-Java21.jar" | ||
|
|
||
| # Logging configuration | ||
| logging: | ||
| level: "INFO" # DEBUG, INFO, WARNING, ERROR | ||
| show_progress: true | ||
|
|
||
| # Cache stores one JAR file per version/Java version combination | ||
| cache: | ||
| enabled: true | ||
| verify_integrity: true |
Uh oh!
There was an error while loading. Please reload this page.