Skip to content

Commit

Permalink
Test combine workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joeshannon committed May 22, 2024
1 parent 824c7d5 commit 9a3ac21
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 28 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/assemble-java-combined.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Assemble combined all-platform jar

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ combine-workflow ]
#pull_request:
# branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

build-linux:
uses: ./.github/workflows/build-java-linux.yml

build-macos:
uses: ./.github/workflows/build-java-macos.yml
with:
cross_build: y

build-win32:
uses: ./.github/workflows/build-java-win32.yml

assemble:
needs: [build-linux, build-macos, build-win32]
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

- uses: actions/checkout@v3

- name: Download hdf5-build-linux
uses: actions/download-artifact@v3
with:
name: hdf5-build-linux
path: hdf5-build-linux

- name: Download hdf5-build-macos
uses: actions/download-artifact@v3
with:
name: hdf5-build-macos
path: hdf5-build-macos

- name: Download hdf5-build-win32
uses: actions/download-artifact@v3
with:
name: hdf5-build-win32
path: hdf5-build-win32

- name: Download Java source
uses: actions/download-artifact@v3
with:
name: hdf5-java-source
path: java-combined/src/main/java

- name: List
run: |
./releng/prepare_java_project.sh
ls -l
tree
# Could build and publish here but for now just provide maven project
# For manual build and deploy

# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# java-version: '17'
# distribution: 'temurin'

# - name: Build with Maven
# run: mvn --batch-mode clean verify
# working-directory: java-combined

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: prepared-maven-project
path: "java-combined"

3 changes: 3 additions & 0 deletions .github/workflows/build-java-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Reusable workflow
workflow_call:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-java-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ on:
required: false
default: false

# Reusable workflow
workflow_call:
inputs:
cross_build:
description: 'Cross compile for universal2 (n/y)'
required: false
default: n
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-java-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
required: false
default: false

# Reusable workflow
workflow_call:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Expand Down
28 changes: 0 additions & 28 deletions LICENSE

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
1 change: 1 addition & 0 deletions java-combined/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
117 changes: 117 additions & 0 deletions java-combined/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.ac.diamond.hdf5</groupId>
<artifactId>hdf5-all</artifactId>
<version>1.10.10-SNAPSHOT</version>
<packaging>bundle</packaging>
<organization>
<name>Diamond Light Source</name>
</organization>
<name>HDF5 Java Native Bindings</name>
<description>Wrapping of HDF5 Java API containing native libries and several HDF5 plugins</description>
<url>https://github.com/DiamondLightSource/dawn-hdf5-build</url>
<licenses>
<license>
<name>BSD 3-Clause License</name>
<url>https://opensource.org/license/bsd-3-clause/</url>
</license>
</licenses>
<developers>
<developer>
<name>Peter Chang</name>
<email>[email protected]</email>
<organization>Diamond Light Source</organization>
<organizationUrl>https://www.diamond.ac.uk</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/DiamondLightSource/dawn-hdf5-build.git</connection>
<developerConnection>scm:git:ssh://github.com:DiamondLightSource/dawn-hdf5-build.git</developerConnection>
<url>https://github.com/DiamondLightSource/dawn-hdf5-build/tree/main</url>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>hdf*</Export-Package>
<Eclipse-BundleShape>dir</Eclipse-BundleShape>
<Bundle-SymbolicName>hdf.hdf5lib</Bundle-SymbolicName>
<Bundle-NativeCode>lib/linux-x86_64/libhdf5.so; lib/linux-x86_64/libhdf5_java.so;osname=Linux; processor=x86_64,
lib/macosx-x86_64/libhdf5.103.dylib; lib/macosx-x86_64/libhdf5_java.dylib;osname=MacOSX; processor=x86_64,
lib/win32-x86_64/hdf5.dll; lib/win32-x86_64/hdf5_java.dll;osname=Win32; processor=x86_64,
lib/linux-aarch64/libhdf5.so; lib/linux-aarch64/libhdf5_java.so;osname=Linux; processor=aarch64,
lib/macosx-aarch64/libhdf5.103.dylib; lib/macosx-aarch64/libhdf5_java.dylib;osname=MacOSX; processor=aarch64
,*</Bundle-NativeCode>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>lib/</excludes>
<archive>
<manifestEntries>
<Bundle-Name>${project.name} Source</Bundle-Name>
<Bundle-SymbolicName>hdf.hdf5lib.source</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
<Eclipse-SourceBundle>hdf.hdf5lib;version="${project.version}"</Eclipse-SourceBundle>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>


</project>
28 changes: 28 additions & 0 deletions java-combined/src/main/resources/META-INF/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2023, Diamond Light Source

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.
2 changes: 2 additions & 0 deletions releng/build_codecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ download_check_extract_pushd() {
exit 1
fi
fi
set +e # Allow this to exit with non-zero for win32 strangeness
tar xzf $DL_TARBALL
set -e
fi
pushd $DL_SRC
}
Expand Down
32 changes: 32 additions & 0 deletions releng/prepare_java_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e

# Transfom artifacts from platform builds into the structure
# required for the final bundle/jar.

# Copy native artifacts into Maven resources location
resources_location=java-combined/src/main/resources

mkdir -pv ${resources_location}/lib/linux-aarch64
mkdir -pv ${resources_location}/lib/linux-x86_64
mkdir -pv ${resources_location}/lib/macosx-aarch64
mkdir -pv ${resources_location}/lib/macosx-x86_64
mkdir -pv ${resources_location}/lib/win32-x86_64

cp -a hdf5-build-linux/*/linux/aarch64/* ${resources_location}/lib/linux-aarch64
cp -a hdf5-build-linux/*/linux/x86_64/* ${resources_location}/lib/linux-x86_64
cp -a hdf5-build-macos/*/macos/arm64/* ${resources_location}/lib/macosx-aarch64
cp -a hdf5-build-macos/*/macos/x86_64/* ${resources_location}/lib/macosx-x86_64
cp -a hdf5-build-win32/*/win32/x86_64/* ${resources_location}/lib/win32-x86_64

# Delete original jars
find ${resources_location}/lib -name *.jar -exec rm -v {} \;

# Delete unrequired files from java souce
rm java-combined/src/main/java/CMakeLists.txt
rm java-combined/src/main/java/hdf/CMakeLists.txt
rm java-combined/src/main/java/hdf/hdf5lib/CMakeLists.txt
rm java-combined/src/main/java/Makefile.am
rm java-combined/src/main/java/Makefile.in
rm -r java-combined/src/main/java/jni

0 comments on commit 9a3ac21

Please sign in to comment.