This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests and crossdock in github actions (#775)
- Loading branch information
1 parent
2be525b
commit 6b314cd
Showing
13 changed files
with
131 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: 'Setup BRANCH' | ||
description: 'Make BRANCH var accessible to job' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup BRANCH | ||
shell: bash | ||
run: | | ||
case ${GITHUB_EVENT_NAME} in | ||
pull_request) | ||
BRANCH=${GITHUB_HEAD_REF} | ||
;; | ||
push | release) | ||
BRANCH=${GITHUB_REF##*/} | ||
;; | ||
esac | ||
echo "we are on branch=${BRANCH}" | ||
echo "BRANCH=${BRANCH}" >> ${GITHUB_ENV} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Crossdock | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
crossdock: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
|
||
- uses: docker/login-action@v1 | ||
id: dockerhub-login | ||
with: | ||
username: jaegertracingbot | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
env: | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
if: env.DOCKERHUB_TOKEN != null | ||
|
||
- name: Export DOCKERHUB_LOGIN variable | ||
run: | | ||
echo "DOCKERHUB_LOGIN=true" >> $GITHUB_ENV | ||
if: steps.dockerhub-login.outcome == 'success' | ||
|
||
- name: Export BRANCH variable | ||
uses: ./.github/actions/setup-branch | ||
|
||
- name: Run Crossdock | ||
id: run-crossdock | ||
run: make crossdock-fresh | ||
|
||
- name: Output Crossdock Logs | ||
run: make crossdock-logs | ||
if: ${{ failure() }} | ||
|
||
- name: Publish Crossdock Image | ||
run: bash scripts/publish-crossdock.sh | ||
if: steps.run-crossdock.outcome == 'success' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
|
||
- name: Run unit tests | ||
run: make test-ci | ||
|
||
- name: Generate codecov report | ||
run: ./gradlew codeCoverageReport | ||
|
||
- name: Upload coverage to codecov | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
verbose: true | ||
fail_ci_if_error: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM openjdk:8u121-jdk-alpine | ||
FROM openjdk:8-jdk-alpine | ||
EXPOSE 8080-8082 | ||
|
||
ADD build/libs/jaeger-crossdock.jar / | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -euxf -o pipefail | ||
|
||
REPO=jaegertracing/xdock-java | ||
BRANCH=${BRANCH:?'missing BRANCH env var'} | ||
TAG=$([ "$BRANCH" == "master" ] && echo "latest" || echo "$BRANCH") | ||
COMMIT=${GITHUB_SHA::8} | ||
DOCKERHUB_LOGIN=${DOCKERHUB_LOGIN:-false} | ||
|
||
echo "REPO=$REPO, BRANCH=$BRANCH, TAG=$TAG, COMMIT=$COMMIT" | ||
|
||
# Only push the docker container to dockerhub for master branch and when dockerhub login is done | ||
if [[ "$BRANCH" == "master" && "$DOCKERHUB_LOGIN" == "true" ]]; then | ||
echo 'upload to Docker Hub' | ||
else | ||
echo 'skip docker upload for PR' | ||
exit 0 | ||
fi | ||
|
||
./gradlew shadowJar | ||
|
||
pushd 'jaeger-crossdock' | ||
docker build -f Dockerfile -t $REPO:$COMMIT . | ||
popd | ||
|
||
docker tag $REPO:$COMMIT $REPO:$TAG | ||
docker push $REPO |
File renamed without changes.
This file was deleted.
Oops, something went wrong.