Skip to content

Commit

Permalink
Merge pull request #84 from clEsperanto/deploy-to-scijava
Browse files Browse the repository at this point in the history
Deploy to scijava
  • Loading branch information
StRigaud authored Oct 17, 2024
2 parents db07807 + bb1b425 commit f115a8a
Show file tree
Hide file tree
Showing 27 changed files with 862 additions and 65 deletions.
3 changes: 3 additions & 0 deletions .github/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh
sh ci-build.sh
3 changes: 3 additions & 0 deletions .github/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh
sh ci-setup-github-actions.sh
199 changes: 139 additions & 60 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,164 @@
---
name: build

on:
push:
branches: [ main ]
branches:
- main
- deploy-to-scijava
tags:
- "*-[0-9]+.*"
paths-ignore:
- .github/workflows/build_fast.yaml
pull_request:
branches: [ main ]


branches:
- main
env:
opencl-icd-loader-git-tag: "v2023.04.17"
opencl-headers-git-tag: "v2023.04.17"

opencl-icd-loader-git-tag: v2023.04.17
opencl-headers-git-tag: v2023.04.17
jobs:
build:
build-os:
strategy:
fail-fast: false
matrix:
name: [ubuntu, windows, macos]
name:
- ubuntu
- windows
- macos
include:
- name: ubuntu
os: ubuntu-latest
c-compiler: "gcc"
cxx-compiler: "g++"
cmake-build-type: "Release"
c-compiler: gcc
cxx-compiler: g++
cmake-build-type: Release
cmake-build-flag: ""
- name: windows
os: windows-latest
c-compiler: "cl.exe"
cxx-compiler: "cl.exe"
cmake-build-type: "Release"
cmake-build-flag: "-A x64"
c-compiler: cl.exe
cxx-compiler: cl.exe
cmake-build-type: Release
cmake-build-flag: -A x64
- name: macos
os: macos-13
c-compiler: "clang"
cxx-compiler: "clang++"
cmake-build-type: "Release"
os: macos-14
c-compiler: clang
cxx-compiler: clang++
cmake-build-type: Release
cmake-build-flag: ""
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: adopt
- name: Install ocl-icd-loader - windows
if: runner.os == 'Windows'
run: |
cd ..
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
git clone --branch ${{ env.opencl-icd-loader-git-tag }} https://github.com/KhronosGroup/OpenCL-ICD-Loader
- name: Install ocl-icd-loader - windows
if: runner.os == 'Windows'
run: |
cd ..
git clone --branch ${{ env.opencl-icd-loader-git-tag }} https://github.com/KhronosGroup/OpenCL-ICD-Loader
git clone --branch ${{ env.opencl-headers-git-tag }} https://github.com/KhronosGroup/OpenCL-Headers
cmake -S "./OpenCL-Headers" -B "./OpenCL-Headers/build"
cmake --build "./OpenCL-Headers/build" --parallel 6 --target install
cmake -D CMAKE_PREFIX_PATH="./OpenCL-Headers" -D OPENCL_ICD_LOADER_HEADERS_DIR="./OpenCL-Headers/" -S "./OpenCL-ICD-Loader" -B "./OpenCL-ICD-Loader/build" -A x64
cmake --build "./OpenCL-ICD-Loader/build" --parallel 6 --target install --config Release
shell: bash -l {0}
git clone --branch ${{ env.opencl-headers-git-tag }} https://github.com/KhronosGroup/OpenCL-Headers
cmake -S "./OpenCL-Headers" -B "./OpenCL-Headers/build"
cmake --build "./OpenCL-Headers/build" --parallel 6 --target install
cmake -D CMAKE_PREFIX_PATH="./OpenCL-Headers" -D OPENCL_ICD_LOADER_HEADERS_DIR="./OpenCL-Headers/" -S "./OpenCL-ICD-Loader" -B "./OpenCL-ICD-Loader/build" -A x64
cmake --build "./OpenCL-ICD-Loader/build" --parallel 6 --target install --config Release
shell: bash -l {0}
- name: Increase swapfile on Ubuntu
if: runner.os == 'Linux'
run: |
sudo swapoff -a
sudo fallocate -l 15G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
- name: Install openCL on Ubuntu
if: runner.os == 'Linux'
run: sudo apt install ocl-icd-opencl-dev
- name: Build with Maven
run: mvn clean install -DskipTests
shell: bash
- name: Run Java class (only possible on MacOS intel)
if: contains(matrix.os, 'macos')
run: >
if [[ $(uname -m) == 'x86_64' ]]; then
mvn dependency:build-classpath -Dmdep.outputFile=classpath.txt
java -cp target/classes:$(cat classpath.txt) net.clesperanto.ClesperantoJ
fi
- name: Get Maven Version and Upload Artifact
shell: bash
run: |
MVN_VERSION=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.version}' \
--non-recursive \
exec:exec)
MVN_NAME=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.name}' \
--non-recursive \
exec:exec)
echo "version=${MVN_VERSION}" >> $GITHUB_OUTPUT
echo "name=${MVN_NAME}" >> $GITHUB_OUTPUT
id: mvn_info
- name: Upload native library
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-artifact
path: target/${{steps.mvn_info.outputs.name}}-${{steps.mvn_info.outputs.version}}.jar
build:
needs: build-os
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: zulu
cache: maven
- name: Download all platform-specific JAR files
uses: actions/download-artifact@v4
- name: Get Maven Version
run: |
MVN_VERSION=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.version}' \
--non-recursive \
exec:exec)
MVN_NAME=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.name}' \
--non-recursive \
exec:exec)
echo "version=${MVN_VERSION}" >> $GITHUB_OUTPUT
echo "name=${MVN_NAME}" >> $GITHUB_OUTPUT
id: mvn_info
- name: Extract compiled native libraries to target fodler libs
run: |
jar xf ubuntu-artifact/${{steps.mvn_info.outputs.name}}-${{steps.mvn_info.outputs.version}}.jar net/clesperanto/linux-x86_64
- name: Increase swapfile on Ubuntu
if: runner.os == 'Linux'
run: |
sudo swapoff -a
sudo fallocate -l 15G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
jar xf windows-artifact/${{steps.mvn_info.outputs.name}}-${{steps.mvn_info.outputs.version}}.jar net/clesperanto/windows-x86_64
- name: Install openCL on Ubuntu
if: runner.os == 'Linux'
run: sudo apt install ocl-icd-opencl-dev
jar xf macos-artifact/${{steps.mvn_info.outputs.name}}-${{steps.mvn_info.outputs.version}}.jar net/clesperanto/macosx-arm64
- name: Build with Maven
run: mvn clean install -DskipTests
shell: bash
mkdir -p libs
- name: Run Java class (only possible on MacOS)
if: contains(matrix.os, 'macos')
run: |
mvn dependency:build-classpath -Dmdep.outputFile=classpath.txt
java -cp target/classes:$(cat classpath.txt) net.clesperanto.ClesperantoJ
mv net/clesperanto/* libs/
- name: Set up CI environment
run: .github/setup.sh
- name: Execute the build
run: .github/build.sh
env:
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
SIGNING_ASC: ${{ secrets.SIGNING_ASC }}
44 changes: 44 additions & 0 deletions .github/workflows/build_fast.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build fast
on:
push:
branches:
- main
- deploy-to-scijava
tags:
- "*-[0-9]+.*"
pull_request:
branches:
- main
env:
opencl-icd-loader-git-tag: v2023.04.17
opencl-headers-git-tag: v2023.04.17
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: zulu
cache: maven
- name: Check secrets are set
run: |
if [ -z "$GPG_KEY_NAME" ]; then echo "GPG_KEY_NAME is not set"; fi
if [ -z "$GPG_PASSPHRASE" ]; then echo "GPG_PASSPHRASE is not set"; fi
if [ -z "$MAVEN_USER" ]; then echo "MAVEN_USER is not set"; fi
if [ -z "$MAVEN_PASS" ]; then echo "MAVEN_PASS is not set"; fi
if [ -z "$OSSRH_PASS" ]; then echo "OSSRH_PASS is not set"; fi
if [ -z "$SIGNING_ASC" ]; then echo "SIGNING_ASC is not set"; fi
- name: Set up CI environment
run: .github/setup.sh
- name: Execute the build
run: .github/build.sh
env:
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
OSSRH_PASS: ${{ secrets.OSSRH_PASS }}
SIGNING_ASC: ${{ secrets.SIGNING_ASC }}
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: ClesperantoJ tests

on: [push]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
Expand Down
27 changes: 27 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2024 Stéphane Rigaud, Robert Haase, Institut Pasteur Paris, Max Planck Institute for Molecular Cell Biology and Genetics Dresden, ScaDS.AI, Leipzig University

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
<url>https://github.com/clEsperanto/clesperantoj_prototype/actions</url>
</ciManagement>



<profiles>
<profile>
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/net/clesperanto/ClesperantoJ.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@

/*
* Copyright 2024 Stéphane Rigaud, Robert Haase, Institut Pasteur Paris,
* Max Planck Institute for Molecular Cell Biology and Genetics Dresden,
* ScaDS.AI, Leipzig University
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

package net.clesperanto;

import net.clesperanto.core.*;
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/net/clesperanto/ImagePlusClesperantoJExample.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
/*
* Copyright 2024 Stéphane Rigaud, Robert Haase, Institut Pasteur Paris,
* Max Planck Institute for Molecular Cell Biology and Genetics Dresden,
* ScaDS.AI, Leipzig University
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

package net.clesperanto;

import ij.IJ;
Expand Down
Loading

0 comments on commit f115a8a

Please sign in to comment.