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

Chore(CI): CI test on windows mac #781

Merged
merged 5 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ stages:
vmImage: 'ubuntu-22.04'
steps:
- template: ci/azure-pipelines/test_java17_steps.yml
- job: testOnWindows
displayName: on Java 17 on Windows
pool:
vmImage: 'windows-latest'
steps:
- template: ci/azure-pipelines/test_java17_steps.yml
- job: testOnMac
displayName: on Java 17 on mac
pool:
vmImage: 'macOS-latest'
steps:
- template: ci/azure-pipelines/test_java17_steps.yml

# Weekly release steps will be triggerred after integration-test succeeded.
- stage: Weekly
Expand Down
19 changes: 13 additions & 6 deletions ci/azure-pipelines/check_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@ steps:
- task: Cache@2
displayName: 'Cache Gradle'
inputs:
key: 'gradle | $(Agent.OS) | $(Build.SourcesDirectory)/build.gradle'
key: 'gradle | "$(Agent.OS)" | **/build.gradle'
restoreKeys: |
gradle | "$(Agent.OS)"
gradle
path: '$(GRADLE_USER_HOME)'
- task: Gradle@3
displayName: Check
inputs:
tasks: check
options: '--build-cache -PenvIsCi'
jdkVersionOption: '1.11'
- script: |
umask a+w
mkdir -p build
chmod -R a+w doc_src
$(Build.SourcesDirectory)/gradlew --build-cache -PenvIsCi clean check
displayName: 'Run Gradle check'
# stop the Gradle daemon to ensure no files are left open (impacting the save cache operation later)
./gradlew --stop
displayName: Gradlew stop
22 changes: 12 additions & 10 deletions ci/azure-pipelines/test_java17_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ steps:
- task: Cache@2
displayName: 'Cache Gradle'
inputs:
key: 'gradle | $(Agent.OS) | $(Build.SourcesDirectory)/build.gradle'
key: 'gradle | "$(Agent.OS)" | **/build.gradle'
restoreKeys: |
gradle | "$(Agent.OS)"
gradle
path: '$(GRADLE_USER_HOME)'
- script: |
umask a+w
mkdir -p build
chmod -R a+w doc_src
$(Build.SourcesDirectory)/gradlew --build-cache -PenvIsCi clean testOnJava17
displayName: 'Run Gradle test on Java17'
- task: PublishTestResults@2
displayName: 'Publish Test Results build/test-results/**/TEST-*.xml'
- task: Gradle@3
inputs:
testResultsFiles: 'build/test-results/**/TEST-*.xml'
tasks: 'testOnJava17'
options: '--build-cache -PenvIsCi'
jdkVersionOption: '1.11'
- script: |
# stop the Gradle daemon to ensure no files are left open (impacting the save cache operation later)
./gradlew --stop
displayName: Gradlew stop
4 changes: 1 addition & 3 deletions test/src/org/omegat/MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package org.omegat;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.nio.file.Files;
Expand Down Expand Up @@ -59,8 +58,7 @@ public final void setUp() throws Exception {

@After
public final void tearDown() throws Exception {
FileUtils.deleteDirectory(tmpDir.toFile());
assertFalse(tmpDir.toFile().exists());
FileUtils.forceDeleteOnExit(tmpDir.toFile());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public void setUp() throws Exception {

@After
public void tearDown() throws IOException {
FileUtils.deleteDirectory(tempDir.toFile());
FileUtils.deleteDirectory(tempRepoDir.toFile());
FileUtils.forceDeleteOnExit(tempDir.toFile());
FileUtils.forceDeleteOnExit(tempRepoDir.toFile());
}


Expand Down
2 changes: 2 additions & 0 deletions test/src/org/omegat/filters/HTMLFilter2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.omegat.util.HTMLUtils;
import org.omegat.util.Language;
import org.omegat.util.OStrings;
import org.omegat.util.Platform;

public class HTMLFilter2Test extends TestFilterBase {
@Test
Expand Down Expand Up @@ -171,6 +172,7 @@ public void testLayout() throws Exception {

@Test
public void testLayoutTrimWhitespace() throws Exception {
org.junit.Assume.assumeFalse(Platform.isWindows);
Map<String, String> config = new HashMap<>();
config.put(HTMLOptions.OPTION_COMPRESS_WHITESPACE, "true");
config.put(HTMLOptions.OPTION_REWRITE_ENCODING, "NEVER");
Expand Down
3 changes: 3 additions & 0 deletions test/src/org/omegat/filters/MozillaFTLFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
package org.omegat.filters;

import org.junit.Test;

import org.omegat.core.data.IProject;
import org.omegat.filters2.text.mozftl.MozillaFTLFilter;
import org.omegat.util.Platform;

public class MozillaFTLFilterTest extends TestFilterBase {
@Test
Expand All @@ -37,6 +39,7 @@ public void testParse() throws Exception {

@Test
public void testTranslate() throws Exception {
org.junit.Assume.assumeFalse(Platform.isWindows);
translateText(new MozillaFTLFilter(), "test/data/filters/MozillaFTL/MozillaFTLFilter.ftl");
}

Expand Down
8 changes: 8 additions & 0 deletions test/src/org/omegat/filters/POFilterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,23 @@
import java.util.Map;
import java.util.TreeMap;

import org.junit.Before;
import org.junit.Test;

import org.omegat.core.data.ExternalTMX;
import org.omegat.core.data.ITMXEntry;
import org.omegat.filters2.po.PoFilter;
import org.omegat.util.OStrings;
import org.omegat.util.Platform;
import org.omegat.util.StringUtil;

public class POFilterTest extends TestFilterBase {

@Before
public void condition() {
org.junit.Assume.assumeFalse(Platform.isWindows);
}

@Test
public void testParse() throws Exception {
Map<String, String> data = new TreeMap<String, String>();
Expand Down
2 changes: 2 additions & 0 deletions test/src/org/omegat/gui/dialogs/DialogsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.omegat.core.TestCore;
import org.omegat.core.data.ProjectProperties;
import org.omegat.gui.dialogs.ProjectPropertiesDialog.Mode;
import org.omegat.util.Platform;

public class DialogsTest extends TestCore {

Expand Down Expand Up @@ -100,6 +101,7 @@ public void testLogDialog() {

@Test
public void testNewProjectFileChooser() {
org.junit.Assume.assumeFalse(Platform.isWindows); // FIXME
new NewProjectFileChooser();
}

Expand Down
60 changes: 31 additions & 29 deletions test/src/org/omegat/util/FileUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -451,37 +451,39 @@ public void testBuildFileList() throws Exception {
Collections.sort(list2);
assertTrue(list2.get(0).getPath().endsWith("bar"));

try {
File lnk = new File(tempDir, "hoge");
Files.createSymbolicLink(lnk.toPath(), subDir.toPath());
List<File> list3 = FileUtil.buildFileList(lnk, true);
List<File> list4 = FileUtil.buildFileList(subDir, true);
assertEquals(list3.size(), list4.size());
assertTrue(IntStream.range(0, list3.size()).allMatch(i -> {
try {
return list3.get(i).getCanonicalFile().equals(list4.get(i).getCanonicalFile());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}));
} catch (UnsupportedOperationException | IOException ex) {
// Creating symbolic links appears to not be supported on this
// system
}
if (!Platform.isWindows) {
try {
File lnk = new File(tempDir, "hoge");
Files.createSymbolicLink(lnk.toPath(), subDir.toPath());
List<File> list3 = FileUtil.buildFileList(lnk, true);
List<File> list4 = FileUtil.buildFileList(subDir, true);
assertEquals(list3.size(), list4.size());
assertTrue(IntStream.range(0, list3.size()).allMatch(i -> {
try {
return list3.get(i).getCanonicalFile().equals(list4.get(i).getCanonicalFile());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}));
} catch (UnsupportedOperationException | IOException ex) {
// Creating symbolic links appears to not be supported on this
// system
}

try {
Files.createSymbolicLink(new File(tempDir, "baz").toPath(), tempDir.toPath());
FileUtil.buildFileList(tempDir, true);
fail("Should die from file system loop");
} catch (UnsupportedOperationException | IOException ex) {
// Creating symbolic links appears to not be supported on this
// system
} catch (UncheckedIOException ex) {
if (!(ex.getCause() instanceof FileSystemLoopException)) {
throw ex;
try {
Files.createSymbolicLink(new File(tempDir, "baz").toPath(), tempDir.toPath());
FileUtil.buildFileList(tempDir, true);
fail("Should die from file system loop");
} catch (UnsupportedOperationException | IOException ex) {
// Creating symbolic links appears to not be supported on this
// system
} catch (UncheckedIOException ex) {
if (!(ex.getCause() instanceof FileSystemLoopException)) {
throw ex;
}
// Creating symbolic links appears to not be supported on this
// system
}
// Creating symbolic links appears to not be supported on this
// system
}

safeDeleteDirectory(tempDir);
Expand Down
1 change: 1 addition & 0 deletions test/src/org/omegat/util/TMXWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public void testLevel2reads() throws Exception {

@Test
public void testEOLwrite() throws Exception {
org.junit.Assume.assumeFalse(Platform.isWindows); // FIXME
String eol = TMXWriter2.lineSeparator;
TMXWriter2 wr = new TMXWriter2(outFile, new Language("en-US"), new Language("be-BY"), false, true,
false);
Expand Down
Loading