You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/11/16 04:11:11 UTC
[iotdb] 01/04: try-github-action-to-replace-travis (#2051)
This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit aeda8b6406a17a3b8dfe34b4e0efb0d28df2201b
Author: Xiangdong Huang <hx...@apache.org>
AuthorDate: Mon Nov 16 11:06:18 2020 +0800
try-github-action-to-replace-travis (#2051)
---
.github/workflows/main-ci.yml | 112 +++++++++++++++++++++
.../fileOutputFactory/LocalFSOutputFactory.java | 3 +-
...SameMeasurementsWithDifferentDataTypesTest.java | 14 ++-
.../write/writer/ForceAppendTsFileWriterTest.java | 14 ++-
4 files changed, 137 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml
new file mode 100644
index 0000000..a7aec89
--- /dev/null
+++ b/.github/workflows/main-ci.yml
@@ -0,0 +1,112 @@
+# This workflow will build a Java project with Maven
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: Java CI with Maven
+
+on:
+ push:
+ branches:
+ - master
+ - 'rel/*'
+ paths-ignore:
+ - 'docs/**'
+ pull_request:
+ branches:
+ - master
+ - 'rel/*'
+ - cluster_new
+ paths-ignore:
+ - 'docs/**'
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ max-parallel: 20
+ matrix:
+ java: [8, 11.0.x]
+ os: [ubuntu-latest, macos-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: Cache Maven packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Check Apache Rat
+ run: mvn -B apache-rat:check
+ - name: Test with Maven
+ run: mvn -B clean integration-test -Dtest.port.closed=true
+
+ build-win:
+ strategy:
+ fail-fast: false
+ max-parallel: 20
+ matrix:
+ java: [8, 11.0.x]
+ os: [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: Cache Maven packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Check Apache Rat
+ run: mvn -B apache-rat:check
+ - name: Download Hadoop Tools if Needed
+ # Using Powershell ...
+ # github action put codes to d:\a
+ run: mkdir D:\a\hadoop\bin ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/winutils.exe -OutFile D:\a\hadoop\bin\winutils.exe ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hadoop.dll -OutFile C:\windows\system32\hadoop.dll ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hadoop -OutFile D:\a\hadoop\bin\hadoop ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hadoop.cmd -OutFile D:\a\hadoop\bin\hadoop.cmd ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hadoop.exp -OutFile D:\a\hadoop\bin\hadoop.exp ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hadoop.lib -OutFile D:\a\hadoop\bin\hadoop.lib ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hadoop.pdb -OutFile D:\a\hadoop\bin\hadoop.pdb ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs.dll -OutFile C:\windows\system32\hdfs.dll ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs -OutFile D:\a\hadoop\bin\hdfs ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs.cmd -OutFile D:\a\hadoop\bin\hdfs.cmd ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs.exp -OutFile D:\a\hadoop\bin\hdfs.exp ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs.lib -OutFile D:\a\hadoop\bin\hdfs.lib ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs.pdb -OutFile D:\a\hadoop\bin\hdfs.pdb ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/hdfs_static.lib -OutFile D:\a\hadoop\bin\hdfs_static.lib ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/libwinutils.lib -OutFile D:\a\hadoop\bin\libwinutils.lib ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/mapred -OutFile D:\a\hadoop\bin\mapred ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/mapred.cmd -OutFile D:\a\hadoop\bin\mapred.cmd ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/rcc -OutFile D:\a\hadoop\bin\rcc ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/winutils.pdb -OutFile D:\a\hadoop\bin\winutils.pdb ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/yarn -OutFile D:\a\hadoop\bin\yarn ; `
+ Invoke-WebRequest https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/yarn.cmd -OutFile D:\a\hadoop\bin\yarn.cmd ; `
+ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";D:\a\hadoop\bin", "User") ; `
+ [Environment]::SetEnvironmentVariable("HADOOP_HOME", "D:\a\hadoop", "User")
+ - name: Add Hadoop Path (Win)
+ shell: bash
+ run: echo 'export PATH=/d/a/hadoop/bin:$PATH' >> ~/.bash_profile && echo 'export HADOOP_HOME=/d/a/hadoop' >> ~/.bash_profile && source ~/.bash_profile
+ - name: Check Hadoop Path (Win)
+ shell: bash
+ run: source ~/.bash_profile && echo $PATH
+ - name: Cache Hadoop packages (Win)
+ uses: actions/cache@v2
+ with:
+ path: D:\a\hadoop
+ key: ${{ runner.os }}-hadoop-files${{ hashFiles('**/*.exe') }}
+ restore-keys: ${{ runner.os }}-hadoop-files
+ - name: Test with Maven
+ shell: bash
+ run: source ~/.bash_profile && mvn -B clean integration-test -Dtest.port.closed=true
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/LocalFSOutputFactory.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/LocalFSOutputFactory.java
index c21caed..5fba471 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/LocalFSOutputFactory.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/fileSystem/fileOutputFactory/LocalFSOutputFactory.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.tsfile.fileSystem.fileOutputFactory;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -34,7 +35,7 @@ public class LocalFSOutputFactory implements FileOutputFactory {
public TsFileOutput getTsFileOutput(String filePath, boolean append) {
try {
- return new LocalTsFileOutput(new FileOutputStream(filePath, append));
+ return new LocalTsFileOutput(new FileOutputStream(new File(filePath), append));
} catch (IOException e) {
logger.error("Failed to get TsFile output of file: {}, ", filePath, e);
return null;
diff --git a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/SameMeasurementsWithDifferentDataTypesTest.java b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/SameMeasurementsWithDifferentDataTypesTest.java
index 9e659b5..b50297b 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/SameMeasurementsWithDifferentDataTypesTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/SameMeasurementsWithDifferentDataTypesTest.java
@@ -19,9 +19,11 @@
package org.apache.iotdb.tsfile.write;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -61,8 +63,10 @@ public class SameMeasurementsWithDifferentDataTypesTest {
@After
public void after() {
File file = new File(tsfilePath);
- if (file.exists()) {
- file.delete();
+ try {
+ Files.deleteIfExists(file.toPath());
+ } catch (IOException e) {
+ fail(e.getMessage());
}
}
@@ -91,8 +95,10 @@ public class SameMeasurementsWithDifferentDataTypesTest {
private void writeFile(String tsfilePath) throws IOException, WriteProcessException {
File f = new File(tsfilePath);
- if (f.exists()) {
- f.delete();
+ try {
+ Files.deleteIfExists(f.toPath());
+ } catch (IOException e) {
+ fail(e.getMessage());
}
Schema schema = new Schema();
diff --git a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ForceAppendTsFileWriterTest.java b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ForceAppendTsFileWriterTest.java
index b512f0f..eed277b 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ForceAppendTsFileWriterTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/write/writer/ForceAppendTsFileWriterTest.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.tsfile.write.writer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.util.ArrayList;
@@ -44,12 +45,23 @@ import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
import org.junit.Test;
public class ForceAppendTsFileWriterTest {
- private static final String FILE_NAME = TestConstant.BASE_OUTPUT_PATH.concat("test.tsfile");
+ private static final String FILE_NAME = TestConstant.BASE_OUTPUT_PATH.concat("test1.tsfile");
private static FSFactory fsFactory = FSFactoryProducer.getFSFactory();
@Test
public void test() throws Exception {
File file = fsFactory.getFile(FILE_NAME);
+ if (file.exists()) {
+ fail("Do not know why the file exists...." + file.getAbsolutePath());
+ }
+ System.out.println(file.getAbsolutePath());
+ if (!file.getParentFile().exists()) {
+ fail("folder does not exist...." + file.getParentFile().getAbsolutePath());
+ }
+ if (!file.getParentFile().isDirectory()) {
+ fail("folder is not a directory...." + file.getParentFile().getAbsolutePath());
+ }
+
TsFileWriter writer = new TsFileWriter(file);
writer.registerTimeseries(new Path("d1", "s1"),
new MeasurementSchema("s1", TSDataType.FLOAT, TSEncoding.RLE));