Skip to content

Commit c16397b

Browse files
authored
ci: migrating to GitHub actions (#98)
* adds gha * uses helm script * removes cci * trying to set env github-ref * trying to set env github-ref * runs e2e only on PR with branch tag * cleanup * fix: e2e * test: e2e * fix: e2e * Update helm.sh
1 parent cec31b1 commit c16397b

File tree

11 files changed

+288
-187
lines changed

11 files changed

+288
-187
lines changed

.circleci/config.yml

Lines changed: 0 additions & 162 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
# Each line is a file pattern followed by one or more owners.
33

44
# global
5-
* @hypertrace/trace-pipeline-owners
5+
* @hypertrace/trace-pipeline-owners
6+
7+
# GH action
8+
.github/ @aaron-steinfeld @jbahire @kotharironak @buchi-busireddy

.github/workflows/docker-tests.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,57 @@ on:
55
- main
66
paths-ignore:
77
- '**/*.md'
8-
- '**/*.txt'
9-
pull_request:
8+
pull_request_target:
9+
branches:
10+
- main
1011
# workflow_dispatch will let us manually trigger the workflow from GitHub actions dashboard.
1112
# See https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/manually-running-a-workflow
1213
workflow_dispatch:
1314

1415
jobs:
1516
build-on-linux:
16-
# Ubuntu-20.04 runner comes with docker 19.03 and OpenJDK 11 and we are using that here.
17+
# Ubuntu-20.04 runner comes with docker 19.03 and OpenJDK 11 and we are using that here.
1718
runs-on: ubuntu-20.04
1819
name: Build and run Docker images
1920
steps:
2021
- name: Checkout Repository
2122
uses: actions/checkout@v2
2223
with:
24+
ref: ${{github.event.pull_request.head.ref}}
25+
repository: ${{github.event.pull_request.head.repo.full_name}}
2326
fetch-depth: 0
2427
submodules: recursive
25-
- name: Cache Gradle
26-
uses: actions/cache@v1
28+
29+
- name: create checksum file
30+
uses: hypertrace/github-actions/checksum@main
31+
32+
- name: Cache packages
33+
id: cache-packages
34+
uses: actions/cache@v2
2735
with:
2836
path: ~/.gradle
29-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle.kts') }}
30-
restore-keys: ${{ runner.os }}-gradle
31-
- name: Invoke Docker build with Gradle
32-
uses: eskatos/gradle-command-action@v1
33-
with:
34-
arguments: dockerBuildImages
37+
key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }}
38+
restore-keys: |
39+
gradle-packages-${{ runner.os }}-${{ github.job }}
40+
gradle-packages-${{ runner.os }}
41+
42+
- name: Build with Gradle
43+
uses: hypertrace/github-actions/gradle@main
44+
with:
45+
args: dockerBuildImages
46+
3547
- name: Verify hypertrace image
3648
working-directory: ./.github/workflows/hypertrace-ingester
3749
# Below tests a docker-compose.yml service named 'sut' with a valid HEALTHCHECK instruction:
3850
run: |
3951
docker-compose -f docker-compose.yml -f docker-compose-zipkin-example.yml up -d || { ../scripts/inspect.sh ; exit 1 ; }
52+
4053
- name: Waits for some stability
4154
working-directory: ./.github/workflows/hypertrace-ingester
4255
run: |
4356
sleep 60 # you can decrease it but never increase it
4457
docker-compose -f docker-compose.yml ps
58+
4559
- name: Runs tests
4660
working-directory: ./.github/workflows/hypertrace-ingester/scripts
4761
run: ./tests.sh

.circleci/helm.sh renamed to .github/workflows/helm.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#!/bin/sh
22
set -eu
33

4-
script=$0
5-
6-
SCRIPT_DIR="$( cd "$( dirname "$script" )" >/dev/null 2>&1 && pwd )"
7-
ROOT_PROJECT_DIR="$(dirname "${SCRIPT_DIR}")"
8-
cd $ROOT_PROJECT_DIR
94
SUB_PROJECTS_DIRS=$(find . -iname "helm" | sed 's/\(.*\)\/.*/\1/')
105

116
subcommand=$1; shift
@@ -18,22 +13,22 @@ case "$subcommand" in
1813
helm dependency update ./helm/
1914
helm lint --strict ./helm/
2015
helm template ./helm/
21-
cd $ROOT_PROJECT_DIR
16+
cd ..
2217
done
2318
;;
2419
package)
25-
CHART_VERSION=$(git describe --abbrev=0)
20+
CHART_VERSION=$(echo ${GITHUB_REF} | cut -d/ -f 3)
2621
for SUB_PROJ_DIR in $SUB_PROJECTS_DIRS; do
2722
cd $SUB_PROJ_DIR
2823
echo "*******"
2924
echo "building charts for:$(pwd)"
3025
helm dependency update ./helm/
3126
helm package --version ${CHART_VERSION} --app-version ${CHART_VERSION} ./helm/
32-
cd $ROOT_PROJECT_DIR
27+
cd ..
3328
done
3429
;;
3530
publish)
36-
CHART_VERSION=$(git describe --abbrev=0)
31+
CHART_VERSION=$(echo ${GITHUB_REF} | cut -d/ -f 3)
3732
export GOOGLE_APPLICATION_CREDENTIALS=${HOME}/helm-gcs-key.json
3833
echo ${HELM_GCS_CREDENTIALS} > ${GOOGLE_APPLICATION_CREDENTIALS}
3934
helm repo add helm-gcs ${HELM_GCS_REPOSITORY}
@@ -43,7 +38,7 @@ case "$subcommand" in
4338
echo "publishing charts for:$(pwd)"
4439
CHART_NAME=$(awk '/^name:/ {print $2}' ./helm/Chart.yaml)
4540
helm gcs push ${CHART_NAME}-${CHART_VERSION}.tgz helm-gcs --public --retry
46-
cd $ROOT_PROJECT_DIR
41+
cd ..
4742
done
4843
;;
4944
*)

.github/workflows/hypertrace-ingester/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ services:
3838
condition: service_healthy
3939

4040
sut:
41-
image: hypertrace/hypertrace-ingester:test
41+
image: hypertrace/hypertrace-ingester:main
4242
container_name: sut
4343
environment:
4444
- KAFKA_BOOTSTRAP_SERVERS=kafka:9092
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: merge-publish
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
merge-publish:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
# Set fetch-depth: 0 to fetch commit history and tags for use in version calculation
13+
- name: Check out code
14+
uses: actions/[email protected]
15+
with:
16+
fetch-depth: 0
17+
18+
- name: create checksum file
19+
uses: hypertrace/github-actions/checksum@main
20+
21+
- name: Cache packages
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.gradle
25+
key: gradle-packages-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/checksum.txt') }}
26+
restore-keys: |
27+
gradle-packages-${{ runner.os }}-${{ github.job }}
28+
gradle-packages-${{ runner.os }}
29+
30+
- name: Login to Docker Hub
31+
uses: docker/login-action@v1
32+
with:
33+
username: ${{ secrets.DOCKERHUB_READ_USER }}
34+
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
35+
36+
- name: push docker image
37+
uses: hypertrace/github-actions/gradle@main
38+
with:
39+
args: dockerPushImages
40+
env:
41+
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
42+
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)