Skip to content

Commit

Permalink
Merge pull request ome#4154 from melissalinkert/gha-updates
Browse files Browse the repository at this point in the history
Update GitHub actions versions and add M1/Java 21 build
  • Loading branch information
sbesson authored Mar 18, 2024
2 parents 83df5ca + a07fcde commit c824ed0
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Upload artifacts
# upload just one set of artifacts for easier PR review
if: matrix.os == 'ubuntu-latest' && matrix.java == '8'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: artifacts/
retention-days: 30
13 changes: 8 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ jobs:
matrix:
java: [8, 11, 17]
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- java: '21'
os: 'macos-14'
runs-on: ${{ matrix.os }}
env:
maven_commands: install # default is install
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
Expand All @@ -33,7 +36,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Retrieve version
id: get_version
run: |
Expand All @@ -48,7 +51,7 @@ jobs:
echo server='ome.releases' >> $GITHUB_OUTPUT
fi
- name: Set up Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
Expand All @@ -66,7 +69,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Retrieve version
id: get_version
run: |
Expand All @@ -81,7 +84,7 @@ jobs:
echo server='ome.releases' >> $GITHUB_OUTPUT
fi
- name: Set up Repository
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'zulu'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

/**
Expand All @@ -72,46 +73,17 @@ public class ImageConverterTest {
private File outFile;
private int width = 512;
private int resolutionCount;
private final SecurityManager oldSecurityManager = System.getSecurityManager();
private final PrintStream oldOut = System.out;
private final PrintStream oldErr = System.err;

protected static class ExitException extends SecurityException {
public final int status;
public ExitException(int status) {
this.status = status;
}
}

private static class NoExitSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm) {}

@Override
public void checkPermission(Permission perm, Object context) {}

@Override
public void checkExit(int status) {
super.checkExit(status);
throw new ExitException(status);
}
}

@BeforeMethod
public void setUp() throws IOException {
System.setSecurityManager(new NoExitSecurityManager());

tempDir = Files.createTempDirectory(this.getClass().getName());
tempDir.toFile().deleteOnExit();
width = 512;
resolutionCount = 1;
}

@AfterMethod
public void resetSecurityManager() {
System.setSecurityManager(oldSecurityManager);
}

@AfterClass
public void tearDown() {
System.setOut(oldOut);
Expand Down Expand Up @@ -166,21 +138,25 @@ public void assertConversion(String[] args) throws FormatException, IOException
}

public void assertConversion(String[] args, String outFileToCheck, int expectedWidth, int expectedTileWidth) throws FormatException, IOException {
boolean success = false;
try {
ImageConverter.main(args);
} catch (ExitException e) {
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
outFile.deleteOnExit();
assertEquals(e.status, 0);
assertTrue(success);
checkImage(outFileToCheck, expectedWidth, expectedTileWidth);
}
}

public void assertConversion(String[] args, String outFileToCheck, int expectedWidth) throws FormatException, IOException {
boolean success = false;
try {
ImageConverter.main(args);
} catch (ExitException e) {
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
outFile.deleteOnExit();
assertEquals(e.status, 0);
assertTrue(success);
checkImage(outFileToCheck, expectedWidth);
}
}
Expand Down Expand Up @@ -225,13 +201,15 @@ public void testBadArgument() throws FormatException, IOException {
System.setOut(new PrintStream(outContent));
outFile = getOutFile("test.ome.tiff");
String[] args = {"-foo", "test.fake", outFile.getAbsolutePath()};
boolean success = false;
try {
ImageConverter.main(args);
} catch (ExitException e) {
assertEquals(e.status, 1);
assertEquals(
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
assertFalse(success);
assertTrue(outContent.toString().endsWith(
"Found unknown command flag: -foo; exiting." +
System.getProperty("line.separator"), outContent.toString());
System.getProperty("line.separator")));
}
}

Expand All @@ -244,12 +222,14 @@ public void testCompanion() throws FormatException, IOException {
"-option", OMETiffWriter.COMPANION_KEY, compFile.getAbsolutePath(),
"test.fake", outFile.getAbsolutePath()
};
boolean success = false;
try {
ImageConverter.main(args);
} catch (ExitException e) {
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
outFile.deleteOnExit();
compFile.deleteOnExit();
assertEquals(e.status, 0);
assertTrue(success);
assertTrue(compFile.exists());
checkImage();
}
Expand All @@ -272,11 +252,13 @@ public void testCrop() throws FormatException, IOException {
"-tilex", "128", "-tiley", "128",
"-crop", "256,256,256,256", "test.fake", outFile.getAbsolutePath()};
width = 256;
boolean success = false;
try {
ImageConverter.main(args);
} catch (ExitException e) {
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
outFile.deleteOnExit();
assertEquals(e.status, 0);
assertTrue(success);
checkImage();
}
}
Expand All @@ -289,12 +271,13 @@ public void testCropOddTileSize() throws FormatException, IOException {
"-crop", "123,127,129,131", "test.fake", outFile.getAbsolutePath()
};
width = 129;
boolean success = false;
try {
ImageConverter.main(args);
}
catch (ExitException e) {
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
outFile.deleteOnExit();
assertEquals(e.status, 0);
assertTrue(success);
checkImage();
}
}
Expand All @@ -307,12 +290,13 @@ public void testCropLargerThanTileSize() throws FormatException, IOException {
"-crop", "0,0,256,256", "test&sizeX=128&sizeY=128.fake", outFile.getAbsolutePath()
};
width = 128;
boolean success = false;
try {
ImageConverter.main(args);
}
catch (ExitException e) {
ImageConverter converter = new ImageConverter();
success = converter.testConvert(new ImageWriter(), args);
} finally {
outFile.deleteOnExit();
assertEquals(e.status, 0);
assertTrue(success);
checkImage();
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/formats-bsd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<dependency>
<groupId>cisd</groupId>
<artifactId>jhdf5</artifactId>
<version>19.04.0</version>
<version>19.04.1</version>
</dependency>
<dependency>
<groupId>com.drewnoakes</groupId>
Expand Down

0 comments on commit c824ed0

Please sign in to comment.