diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 05e868c0..b2cc7c11 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -2,9 +2,9 @@ name: Java on: push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + branches: [ "feat/add-java-release-job" ] + # pull_request: + # branches: [ "main" ] permissions: contents: read @@ -47,6 +47,8 @@ jobs: run: python bindings/java/scripts/java-builder.py create-version-file env: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + # JAVA_BUILDER_RELEASE_JAR_VERSION: ${{ startsWith(github.ref, 'refs/tags/') }} + JAVA_BUILDER_RELEASE_JAR_VERSION: true - name: Upload native bindings uses: actions/upload-artifact@v5 with: @@ -96,11 +98,15 @@ jobs: run: python bindings/java/scripts/java-builder.py build --use-existing-native-libs native-bindings --use-release-build env: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + # JAVA_BUILDER_RELEASE_JAR_VERSION: ${{ startsWith(github.ref, 'refs/tags/') }} + JAVA_BUILDER_RELEASE_JAR_VERSION: true - name: Build Sysand Maven plugin and run integration tests shell: bash run: python bindings/java/scripts/java-builder.py build-plugin env: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + # JAVA_BUILDER_RELEASE_JAR_VERSION: ${{ startsWith(github.ref, 'refs/tags/') }} + JAVA_BUILDER_RELEASE_JAR_VERSION: true - name: Upload JARs uses: actions/upload-artifact@v5 with: @@ -159,6 +165,8 @@ jobs: run: python bindings/java/scripts/java-builder.py test env: MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + # JAVA_BUILDER_RELEASE_JAR_VERSION: ${{ startsWith(github.ref, 'refs/tags/') }} + JAVA_BUILDER_RELEASE_JAR_VERSION: true nightly-release: name: Nightly Release @@ -216,3 +224,62 @@ jobs: MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + + release: + name: Release + runs-on: ubuntu-latest + needs: [build-jar, test-jar] + # if: ${{ startsWith(github.ref, 'refs/tags/') }} + permissions: + # Use to sign the release artifacts + id-token: write + # Used to upload release artifacts + contents: write + # Used to generate artifact attestation + attestations: write + steps: + - uses: actions/checkout@v5 + - name: Download native bindings + uses: actions/download-artifact@v6 + with: + name: jars + path: target/java + - name: Download Maven plugin JAR + uses: actions/download-artifact@v6 + with: + name: maven-plugin-jar + path: target/java-plugin + - name: Download version.txt + uses: actions/download-artifact@v6 + with: + name: version + - name: Debugging + shell: bash + run: | + find . -iname "*.jar" + find target/java-plugin/target/it/ + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v3 + with: + subject-path: 'target/java/target/*.jar' + - uses: actions/setup-python@v6 + with: + python-version: 3.12 + - uses: actions/setup-java@v5 + with: + distribution: 'temurin' + java-version: '21' + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Deploy Java bindings + shell: bash + run: python bindings/java/scripts/java-builder.py deploy + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + # JAVA_BUILDER_RELEASE_JAR_VERSION: ${{ startsWith(github.ref, 'refs/tags/') }} + JAVA_BUILDER_RELEASE_JAR_VERSION: true diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml deleted file mode 100644 index 7a3fe67d..00000000 --- a/.github/workflows/js.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: WASM - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Install Node.js - uses: actions/setup-node@v6 - with: - node-version: 23 - - - name: Test in Firefox - run: | - cd bindings/js - export WASM_BINDGEN_USE_BROWSER=1 - wasm-pack test --headless --firefox - - - name: Test in Chrome - run: | - cd bindings/js - export WASM_BINDGEN_USE_BROWSER=1 - wasm-pack test --headless --chrome - - - name: Build for Node.js and test - run: | - cd bindings/js - npm install - npm run test:browser diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml deleted file mode 100644 index 03423cb3..00000000 --- a/.github/workflows/python.yml +++ /dev/null @@ -1,285 +0,0 @@ -# This file is autogenerated by maturin v1.8.7 and **manually** edited. You can -# regerate it as follows but do not forget to re-add the manual bits: -# -# maturin generate-ci github --pytest --manifest-path bindings/py/Cargo.toml -# -name: Python - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - linux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-22.04 - target: x86_64 - - runner: ubuntu-22.04 - target: x86 - - runner: ubuntu-22.04 - target: aarch64 - - runner: ubuntu-22.04 - target: armv7 - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - name: Run Rust tests for Python bindings - run: cargo test --package sysand-py --verbose --no-default-features - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml --features vendored_tls - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: auto - before-script-linux: | - /bin/bash .github/scripts/install-linux-dependencies.sh - - name: Build free-threaded wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml -i python3.13t --features vendored_tls - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: auto - before-script-linux: | - /bin/bash .github/scripts/install-linux-dependencies.sh - - name: Upload wheels - uses: actions/upload-artifact@v5 - with: - name: wheels-linux-${{ matrix.platform.target }} - path: dist - - name: Install uv - uses: astral-sh/setup-uv@v7 - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} - shell: bash - run: | - /bin/bash .github/scripts/run-pytest.sh - - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'x86') && matrix.platform.target != 'ppc64' }} - uses: uraimo/run-on-arch-action@v3 - with: - arch: ${{ matrix.platform.target }} - distro: ubuntu22.04 - githubToken: ${{ github.token }} - install: | - apt-get update - apt-get install -y curl python3 - curl -LsSf https://astral.sh/uv/install.sh | sh - run: | - export PATH=$PATH:$HOME/.local/bin - /bin/bash .github/scripts/run-pytest.sh - - name: linters - if: ${{ matrix.platform.target == 'x86_64' }} - shell: bash - run: | - cd bindings/py - source .venv/bin/activate - uv sync --group linters --active --no-install-project --locked - ruff format --check python tests - ruff check python - mypy --strict python - - musllinux: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: ubuntu-22.04 - target: x86_64 - - runner: ubuntu-22.04 - target: x86 - - runner: ubuntu-22.04 - target: aarch64 - - runner: ubuntu-22.04 - target: armv7 - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - name: Run Rust tests for Python bindings - run: cargo test --package sysand-py --verbose --no-default-features - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml --features vendored_tls - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: musllinux_1_2 - - name: Build free-threaded wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml -i python3.13t --features vendored_tls - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - manylinux: musllinux_1_2 - - name: Upload wheels - uses: actions/upload-artifact@v5 - with: - name: wheels-musllinux-${{ matrix.platform.target }} - path: dist - - name: pytest - if: ${{ startsWith(matrix.platform.target, 'x86_64') }} - uses: addnab/docker-run-action@v3 - with: - image: alpine:latest - options: -v ${{ github.workspace }}:/io -w /io - run: | - apk add curl bash - curl -LsSf https://astral.sh/uv/install.sh | sh - export PATH=$PATH:$HOME/.local/bin - /bin/bash .github/scripts/run-pytest.sh - - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'x86') }} - uses: uraimo/run-on-arch-action@v3 - with: - arch: ${{ matrix.platform.target }} - distro: alpine_latest - githubToken: ${{ github.token }} - install: | - apk add curl bash python3 - run: | - curl -LsSf https://astral.sh/uv/install.sh | sh - export PATH=$PATH:$HOME/.local/bin - /bin/bash .github/scripts/run-pytest.sh - - windows: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: windows-latest - target: x64 - rust_target: x86_64-pc-windows-msvc - - runner: windows-latest - target: x86 - rust_target: i686-pc-windows-msvc - python: - - version: "3.13" - label: default - args_suffix: "" - - version: "3.13t" - label: free-threaded - args_suffix: " -i python3.13t" - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python.version }} - architecture: ${{ matrix.platform.target }} - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml${{ matrix.python.args_suffix }} - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - - name: Upload wheels - uses: actions/upload-artifact@v5 - with: - name: wheels-windows-${{ matrix.platform.target }}-${{ matrix.python.label }} - path: dist - - name: Run Rust tests for Python bindings - run: | - cd bindings/py - cargo test --package sysand-py --verbose --no-default-features --target ${{ matrix.platform.rust_target }} - - name: Install uv - uses: astral-sh/setup-uv@v7 - - name: pytest - if: ${{ !startsWith(matrix.platform.target, 'aarch64') }} - shell: bash - run: | - export UV_PYTHON=${{ matrix.python.version }} - export ACTIVATION_SCRIPT=.venv/Scripts/activate - /bin/bash .github/scripts/run-pytest.sh ${{ matrix.python.version }} - - macos: - runs-on: ${{ matrix.platform.runner }} - strategy: - matrix: - platform: - - runner: macos-15-intel - target: x86_64 - - runner: macos-14 - target: aarch64 - steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v6 - with: - python-version: 3.14 - - name: Run Rust tests for Python bindings - run: cargo test --package sysand-py --verbose --no-default-features - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - - name: Build free-threaded wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.platform.target }} - args: --release --out dist --manifest-path bindings/py/Cargo.toml -i python3.13t - sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} - - name: Upload wheels - uses: actions/upload-artifact@v5 - with: - name: wheels-macos-${{ matrix.platform.target }} - path: dist - - name: Install uv - uses: astral-sh/setup-uv@v7 - - name: pytest - run: | - /bin/bash .github/scripts/run-pytest.sh - - sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - command: sdist - args: --out dist --manifest-path bindings/py/Cargo.toml - - name: Upload sdist - uses: actions/upload-artifact@v5 - with: - name: wheels-sdist - path: dist - - # release: - # name: Release - # runs-on: ubuntu-latest - # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - # needs: [linux, musllinux, windows, macos, sdist] - # permissions: - # # Use to sign the release artifacts - # id-token: write - # # Used to upload release artifacts - # contents: write - # # Used to generate artifact attestation - # attestations: write - # steps: - # - uses: actions/download-artifact@v4 - # - name: Generate artifact attestation - # uses: actions/attest-build-provenance@v2 - # with: - # subject-path: 'wheels-*/*' - # - name: Publish to PyPI - # if: ${{ startsWith(github.ref, 'refs/tags/') }} - # uses: PyO3/maturin-action@v1 - # env: - # MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - # with: - # command: upload - # args: --non-interactive --skip-existing wheels-*/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 285d7b86..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: CLI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -env: - CARGO_TERM_COLOR: always - RUST_BACKTRACE: 1 - -jobs: - test: - strategy: - matrix: - # macos-15-intel is x86, macos-latest is arm64 - os: [ubuntu-22.04, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest] - fail-fast: false - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v5 - - name: Cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: taiki-e/install-action@cargo-hack - - name: Clippy - run: cargo hack clippy --each-feature --no-dev-deps --features std --ignore-unknown-features -- --deny warnings - - name: Clippy for tests - run: cargo clippy --all-targets --all-features -- --deny warnings - - name: Format - run: cargo fmt --check - - name: Set up git user - run: | - git config --global user.email "user@sysand.org" - git config --global user.name "Test User" - - name: Test Core - run: cargo test --package sysand-core --verbose --features filesystem,js,python,alltests - - name: Test CLI - run: cargo test --package sysand --verbose --features alltests - - build: - strategy: - matrix: - # macos-15-intel is x86, macos-latest is arm64 - os: [ubuntu-22.04, ubuntu-24.04-arm, windows-latest, windows-11-arm, macos-15-intel, macos-latest] - runs-on: ${{ matrix.os }} - needs: [test] - steps: - - uses: actions/checkout@v5 - - name: Cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Build - run: cargo build --bin sysand --release - - name: Create the distribution directory - run: mkdir -p dist - - name: Copy binaries - if: matrix.os == 'windows-latest' || matrix.os == 'windows-11-arm' - run: cp target/release/sysand.exe dist/sysand-${{ matrix.os }}.exe - - name: Copy binaries - if: matrix.os != 'windows-latest' && matrix.os != 'windows-11-arm' - run: cp target/release/sysand dist/sysand-${{ matrix.os }} - - name: Upload binaries - uses: actions/upload-artifact@v5 - with: - name: sysand-cli-${{ matrix.os }} - path: dist/* - - nightly-release: - name: Nightly Release - runs-on: ubuntu-latest - needs: [test, build] - if: ${{ github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }} - permissions: - # Use to sign the release artifacts - id-token: write - # Used to upload release artifacts - contents: write - # Used to generate artifact attestation - attestations: write - steps: - - uses: actions/download-artifact@v6 - with: - path: artifacts - merge-multiple: true - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v3 - with: - subject-path: 'artifacts/*' - - name: Rename artifacts - shell: bash - run: | - mv artifacts/sysand-ubuntu-22.04 artifacts/sysand-linux-x86_64 - mv artifacts/sysand-ubuntu-24.04-arm artifacts/sysand-linux-arm64 - mv artifacts/sysand-windows-latest.exe artifacts/sysand-windows-x86_64.exe - mv artifacts/sysand-windows-11-arm.exe artifacts/sysand-windows-arm64.exe - mv artifacts/sysand-macos-15-intel artifacts/sysand-macos-x86_64 - mv artifacts/sysand-macos-latest artifacts/sysand-macos-arm64 - - name: Create release tag - shell: bash - run: echo "TAG_NAME=$(date +v-%Y-%m-%d-%H%M)" >> $GITHUB_ENV - - name: Create a nightly release - uses: softprops/action-gh-release@v2 - with: - prerelease: true - files: | - artifacts/* - overwrite_files: false - tag_name: ${{ env.TAG_NAME }} - name: Nightly Release ${{ env.TAG_NAME }} - - release: - name: Release - runs-on: ubuntu-latest - needs: [test, build] - if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} - permissions: - # Use to sign the release artifacts - id-token: write - # Used to upload release artifacts - contents: write - # Used to generate artifact attestation - attestations: write - steps: - - uses: actions/download-artifact@v6 - with: - path: artifacts - merge-multiple: true - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v3 - with: - subject-path: 'artifacts/*' - - name: Rename artifacts - shell: bash - run: | - mv artifacts/sysand-ubuntu-22.04 artifacts/sysand-linux-x86_64 - mv artifacts/sysand-ubuntu-24.04-arm artifacts/sysand-linux-arm64 - mv artifacts/sysand-windows-latest.exe artifacts/sysand-windows-x86_64.exe - mv artifacts/sysand-windows-11-arm.exe artifacts/sysand-windows-arm64.exe - mv artifacts/sysand-macos-15-intel artifacts/sysand-macos-x86_64 - mv artifacts/sysand-macos-latest artifacts/sysand-macos-arm64 - - name: Create a release - uses: softprops/action-gh-release@v2 - with: - make_latest: true - files: | - artifacts/* - overwrite_files: false - name: Release ${{ github.event.inputs.tag_name }} diff --git a/bindings/java/scripts/java-builder.py b/bindings/java/scripts/java-builder.py index 1e454706..c8819179 100755 --- a/bindings/java/scripts/java-builder.py +++ b/bindings/java/scripts/java-builder.py @@ -274,6 +274,28 @@ def build_plugin(version: str, release_jar_version: bool) -> None: target_pom_data = pom_data.replace("VERSION", full_version) target_pom_path.write_text(target_pom_data) + # # Ensure the sysand artifact is installed in the local Maven repository + # # before building the plugin, so Maven can resolve the dependency + # print("Ensuring sysand artifact is installed in local Maven repository...") + # jar_path = BUILD_DIR / "target" / f"sysand-{full_version}.jar" + # pom_file_path = BUILD_DIR / "pom.xml" + # if jar_path.exists() and pom_file_path.exists(): + # print(f"Installing sysand artifact from {jar_path}...") + # execute( + # [ + # mvn_executable(), + # "install:install-file", + # f"-Dfile={jar_path}", + # f"-DpomFile={pom_file_path}", + # ], + # cwd=BUILD_DIR, + # ) + # else: + # print( + # f"Warning: sysand JAR not found at {jar_path}. " + # "Make sure to run 'build' command first, or the plugin build may fail." + # ) + print("Building the sysand Maven plugin...") execute([mvn_executable(), "-B", "-DskipTests=false", "verify"], cwd=PLUGIN_DIR)