Skip to content
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

Actions on PR and tag #3626

Closed
wants to merge 20 commits into from
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Build with Maven and Ant

on: [push, pull_request]

jobs:
build:
strategy:
matrix:
java: [1.8, 11]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build with Maven
run: ./tools/test-build maven
- name: Build with Ant
run: ./tools/test-build ant
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Build and publish packages

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build artifacts
run: |
./tools/test-build ant
ant release
ant docs
- name: Create and Upload Release Assets
run: |
set -x
assets=()
touch SHASUMS
touch MD5
for asset in ./artifacts/*; do
assets+=("-a" "$asset")
filename=$(basename -- "$asset")
sha=$(sha256sum $asset)
IFS=' ' read -r -a array <<< "$sha"
echo "${array[0]} $filename" >> SHASUMS
md5=$(md5sum $asset)
IFS=' ' read -r -a array <<< "$md5"
echo "${array[0]} $filename" >> MD5
done
assets+=("-a" SHASUMS)
assets+=("-a" MD5)
tag_name="${GITHUB_REF##*/}"
hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package loci.formats.utests;

import java.io.File;
import loci.common.Constants;
import loci.formats.FormatTools;

Expand All @@ -44,6 +45,7 @@
import org.testng.annotations.Test;



/**
* Unit tests for {@link loci.formats.FormatTools}.
*/
Expand Down Expand Up @@ -262,6 +264,13 @@ public void testParseLength(String value, String unit, Length length) {

@Test(dataProvider = "fileLists")
public void testGetRequiredDirectories(String[] files, int number) {
assertEquals(number, FormatTools.getRequiredDirectories(files));
String[] newfiles = null;
if (files != null) {
newfiles = new String[files.length];
for (int i = 0; i < files.length; i++) {
newfiles[i] = files[i].replace('/', File.separatorChar);
}
}
assertEquals(number, FormatTools.getRequiredDirectories(newfiles));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class UpgradeChecker {
* Location of the JAR artifacts for the stable releases.
*/
public static final String STABLE_BUILD =
"http://downloads.openmicroscopy.org/bio-formats/" + STABLE_VERSION + "/artifacts/";
"http://downloads.openmicroscopy.org/bio-formats/";

/** Name of the ueber tools JAR. */
public static final String TOOLS = "bioformats_package.jar";
Expand Down
5 changes: 3 additions & 2 deletions tools/bump_maven_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def check_version_format(version):
"""Check format of version number"""
pattern = '^[0-9]+[\.][0-9]+[\.][0-9]+(\-.+)*$'
pattern = r'^[0-9]+[\.][0-9]+[\.][0-9]+(\-.+)*$'
return re.match(pattern, version) is not None


Expand All @@ -18,6 +18,7 @@ def check_version_format(version):
".*<artifactId>pom-bio-formats</artifactId>\n"
".*<version>).*(</version>)")


class Replacer(object):

def __init__(self, old_group="ome", new_group="ome"):
Expand Down Expand Up @@ -76,7 +77,7 @@ def bump_stable_version(self, version):
ns = parser.parse_args()

if not check_version_format(ns.version):
print "Invalid version format"
print("Invalid version format")
sys.exit(1)

replacer = Replacer(old_group=ns.old_group, new_group=ns.new_group)
Expand Down
4 changes: 1 addition & 3 deletions tools/source-archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import os
from subprocess import call
import sys
import time
import zipfile
import tarfile
import StringIO
import platform

# This script archives the base tree and repacks it into a single zip which is
Expand Down Expand Up @@ -163,7 +161,7 @@
basetar.close()
try:
call(['xz', "%s/%s.tar" % (options.target, prefix)])
except:
except Exception:
# This is expected to fail on Windows when xz is unavailable,
# but is always an error on all other platforms.
if platform.system() != 'Windows':
Expand Down