diff --git a/.github/workflows/test-v3.yml b/.github/workflows/test-v3.yml new file mode 100644 index 00000000000..4af10d7eb68 --- /dev/null +++ b/.github/workflows/test-v3.yml @@ -0,0 +1,74 @@ +# yamllint --format github .github/workflows/test-v3.yml +--- +name: test-v3 + +# We don't test documentation-only commits. +on: + # We run tests on non-tagged pushes to master that aren't a commit made by the release plugin + push: + tags: "" + branches: zipkin-v3 + paths-ignore: + - "**/*.md" + - "charts/**" + # We also run tests on pull requests targeted at the master branch. + pull_request: + branches: zipkin-v3 + paths-ignore: + - "**/*.md" + - "charts/**" + +jobs: + test: + runs-on: ubuntu-20.04 # newest available distribution, aka focal + if: "!contains(github.event.head_commit.message, 'maven-release-plugin')" + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 # full git history for license check + submodules: recursive + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + - name: Cache NPM Packages + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-packages-${{ hashFiles('zipkin-lens/package-lock.json') }} + - name: Test without Docker + run: build-bin/maven_go_offline && build-bin/test -Ddocker.skip=true -Dcheckstyle.skip=true + test_docker: + runs-on: ubuntu-20.04 # newest available distribution, aka focal + if: "!contains(github.event.head_commit.message, 'maven-release-plugin')" + strategy: + matrix: + include: + - name: receiver-zipkin-activemq + - name: receiver-zipkin-http + - name: receiver-zipkin-kafka + - name: receiver-zipkin-rabbitmq + - name: receiver-zipkin-scribe + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 # -Dlicense.skip=true so we don't need a full clone + submodules: recursive + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + # We can't cache Docker without using buildx because GH actions restricts /var/lib/docker + # That's ok because DOCKER_PARENT_IMAGE is always ghcr.io and local anyway. + - name: Test with Docker + run: + | # configure_test seeds NPM cache, which isn't needed for these tests + build-bin/maven/maven_go_offline && + build-bin/docker/configure_docker && + build-bin/test -pl :${{ matrix.name }} --am -Dlicense.skip=true -Dcheckstyle.skip=true \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index db68ea93322..8427d927349 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,24 +1,24 @@ # yamllint --format github .github/workflows/test.yml -#--- -#name: test -# -## We don't test documentation-only commits. -#on: -# # We run tests on non-tagged pushes to master that aren't a commit made by the release plugin -# push: -# tags: "" -# branches: master -# paths-ignore: -# - "**/*.md" -# - "charts/**" -# # We also run tests on pull requests targeted at the master branch. -# pull_request: -# branches: master -# paths-ignore: -# - "**/*.md" -# - "charts/**" -# -#jobs: +--- +name: test + +# We don't test documentation-only commits. +on: + # We run tests on non-tagged pushes to master that aren't a commit made by the release plugin + push: + tags: "" + branches: master + paths-ignore: + - "**/*.md" + - "charts/**" + # We also run tests on pull requests targeted at the master branch. + pull_request: + branches: master + paths-ignore: + - "**/*.md" + - "charts/**" + +jobs: # test: # runs-on: ubuntu-20.04 # newest available distribution, aka focal # if: "!contains(github.event.head_commit.message, 'maven-release-plugin')" diff --git a/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java b/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java index b89e3bdbee6..e7e6124a426 100644 --- a/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java +++ b/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java @@ -33,7 +33,7 @@ import zipkin2.Span; import static java.nio.charset.StandardCharsets.UTF_8; -import static zipkin2.storage.cassandra.internal.Resources.resourceToString; +import static zipkin2.codec.Resources.resourceToString; /** * The {@link SpanBytesEncoder bundled java codec} aims to be both small in size (i.e. does not diff --git a/benchmarks/src/main/java/zipkin2/codec/JsonCodecBenchmarks.java b/benchmarks/src/main/java/zipkin2/codec/JsonCodecBenchmarks.java index 8cf509146f5..823c144961b 100644 --- a/benchmarks/src/main/java/zipkin2/codec/JsonCodecBenchmarks.java +++ b/benchmarks/src/main/java/zipkin2/codec/JsonCodecBenchmarks.java @@ -36,7 +36,7 @@ import zipkin2.Span; import static java.nio.charset.StandardCharsets.UTF_8; -import static zipkin2.storage.cassandra.internal.Resources.resourceToString; +import static zipkin2.codec.Resources.resourceToString; @Measurement(iterations = 5, time = 1) @Warmup(iterations = 10, time = 1) diff --git a/benchmarks/src/main/java/zipkin2/codec/ProtoCodecBenchmarks.java b/benchmarks/src/main/java/zipkin2/codec/ProtoCodecBenchmarks.java index 07677191e6e..118faa73c60 100644 --- a/benchmarks/src/main/java/zipkin2/codec/ProtoCodecBenchmarks.java +++ b/benchmarks/src/main/java/zipkin2/codec/ProtoCodecBenchmarks.java @@ -36,7 +36,7 @@ import zipkin2.Span; import static java.nio.charset.StandardCharsets.UTF_8; -import static zipkin2.storage.cassandra.internal.Resources.resourceToString; +import static zipkin2.codec.Resources.resourceToString; @Measurement(iterations = 5, time = 1) @Warmup(iterations = 10, time = 1) diff --git a/benchmarks/src/main/java/zipkin2/codec/Resources.java b/benchmarks/src/main/java/zipkin2/codec/Resources.java new file mode 100644 index 00000000000..4239448365c --- /dev/null +++ b/benchmarks/src/main/java/zipkin2/codec/Resources.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015-2020 The OpenZipkin Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package zipkin2.codec; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.UncheckedIOException; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public final class Resources { + public static String resourceToString(String resource) { + try ( + Reader reader = new InputStreamReader(Resources.class.getResourceAsStream(resource), UTF_8)) { + char[] buf = new char[2048]; + StringBuilder builder = new StringBuilder(); + int read; + while ((read = reader.read(buf)) != -1) { + builder.append(buf, 0, read); + } + return builder.toString(); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } + + Resources() { + } +} diff --git a/benchmarks/src/test/java/zipkin2/codec/JacksonSpanDecoderTest.java b/benchmarks/src/test/java/zipkin2/codec/JacksonSpanDecoderTest.java index 64245347ce6..4beac58439f 100644 --- a/benchmarks/src/test/java/zipkin2/codec/JacksonSpanDecoderTest.java +++ b/benchmarks/src/test/java/zipkin2/codec/JacksonSpanDecoderTest.java @@ -15,7 +15,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.PooledByteBufAllocator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static zipkin2.TestObjects.CLIENT_SPAN; diff --git a/benchmarks/src/test/java/zipkin2/codec/MoshiSpanDecoderTest.java b/benchmarks/src/test/java/zipkin2/codec/MoshiSpanDecoderTest.java index e73f70f682f..9dc99bc1b78 100644 --- a/benchmarks/src/test/java/zipkin2/codec/MoshiSpanDecoderTest.java +++ b/benchmarks/src/test/java/zipkin2/codec/MoshiSpanDecoderTest.java @@ -15,7 +15,7 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.PooledByteBufAllocator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static zipkin2.TestObjects.TRACE; diff --git a/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java b/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java index a091f4b7160..88efcd9d870 100644 --- a/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java +++ b/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java @@ -19,7 +19,7 @@ import java.util.List; import okio.ByteString; import org.assertj.core.data.MapEntry; -import org.junit.Test; +import org.junit.jupiter.api.Test; import zipkin2.codec.SpanBytesDecoder; import zipkin2.codec.SpanBytesEncoder; import zipkin2.internal.Proto3ZipkinFields.TagField;