Skip to content

Commit 8529849

Browse files
committed
Update GA
1 parent c09ce88 commit 8529849

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ jobs:
104104
- name: Build docker
105105
uses: docker/build-push-action@v3
106106
with:
107+
file: ./kafka-connect-fitbit-source/Dockerfile
107108
context: .
108109
cache-from: type=local,src=/tmp/.buildx-cache
109110
cache-to: ${{ steps.cache-parameters.outputs.cache-to }}

.github/workflows/oura.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Continuous integration, including test and integration test
2+
name: Main Oura test
3+
4+
# Run in master and dev branches and in all pull requests to those branches
5+
on:
6+
push:
7+
branches: [ master, dev ]
8+
pull_request:
9+
branches: [ master, dev ]
10+
11+
env:
12+
DOCKER_IMAGE: radarbase/kafka-connect-rest-oura-source
13+
14+
jobs:
15+
# Build and test the code
16+
kotlin:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23+
- uses: actions/checkout@v3
24+
25+
- uses: actions/setup-java@v3
26+
with:
27+
distribution: temurin
28+
java-version: 11
29+
30+
- name: Setup Gradle
31+
uses: gradle/gradle-build-action@v2
32+
33+
- name: Compile code
34+
run: ./gradlew assemble
35+
36+
# Gradle check
37+
- name: Check
38+
run: ./gradlew check
39+
40+
docker:
41+
# The type of runner that the job will run on
42+
runs-on: ubuntu-latest
43+
44+
# Steps represent a sequence of tasks that will be executed as part of the job
45+
steps:
46+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
47+
- uses: actions/checkout@v3
48+
49+
- name: Docker build parameters
50+
id: docker_params
51+
run: |
52+
HAS_DOCKER_LOGIN=${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
53+
echo "has_docker_login=$HAS_DOCKER_LOGIN" >> $GITHUB_OUTPUT
54+
if [ "${{ github.event_name == 'pull_request' }}" = "true" ] || [ "$HAS_DOCKER_LOGIN" = "false" ]; then
55+
echo "push=false" >> $GITHUB_OUTPUT
56+
echo "load=true" >> $GITHUB_OUTPUT
57+
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
58+
else
59+
echo "push=true" >> $GITHUB_OUTPUT
60+
echo "load=false" >> $GITHUB_OUTPUT
61+
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
62+
fi
63+
64+
- name: Cache Docker layers
65+
id: cache_buildx
66+
uses: actions/cache@v3
67+
with:
68+
path: /tmp/.buildx-cache
69+
key: ${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}-${{ hashFiles('**/Dockerfile', '**/*.gradle', 'gradle.properties', '.dockerignore', '*/src/main/**', 'docker/**') }}
70+
restore-keys: |
71+
${{ runner.os }}-buildx-${{ steps.docker_params.outputs.push }}-
72+
${{ runner.os }}-buildx-
73+
74+
- name: Login to Docker Hub
75+
if: steps.docker_params.outputs.has_docker_login == 'true'
76+
uses: docker/login-action@v2
77+
with:
78+
username: ${{ secrets.DOCKERHUB_USERNAME }}
79+
password: ${{ secrets.DOCKERHUB_TOKEN }}
80+
81+
# Add Docker labels and tags
82+
- name: Docker meta
83+
id: docker_meta
84+
uses: docker/metadata-action@v4
85+
with:
86+
images: ${{ env.DOCKER_IMAGE }}
87+
88+
# Setup docker build environment
89+
- name: Set up QEMU
90+
uses: docker/setup-qemu-action@v2
91+
92+
- name: Set up Docker Buildx
93+
uses: docker/setup-buildx-action@v2
94+
95+
- name: Cache parameters
96+
id: cache-parameters
97+
run: |
98+
if [ "${{ steps.cache_buildx.outputs.cache-hit }}" = "true" ]; then
99+
echo "::set-output name=cache-to::"
100+
else
101+
echo "::set-output name=cache-to::type=local,dest=/tmp/.buildx-cache-new,mode=max"
102+
fi
103+
104+
- name: Build docker
105+
uses: docker/build-push-action@v3
106+
with:
107+
file: ./kafka-connect-oura-source/Dockerfile
108+
context: .
109+
cache-from: type=local,src=/tmp/.buildx-cache
110+
cache-to: ${{ steps.cache-parameters.outputs.cache-to }}
111+
platforms: ${{ steps.docker_params.outputs.platforms }}
112+
load: ${{ steps.docker_params.outputs.load }}
113+
push: ${{ steps.docker_params.outputs.push }}
114+
tags: ${{ steps.docker_meta.outputs.tags }}
115+
# Use runtime labels from docker_meta as well as fixed labels
116+
labels: |
117+
${{ steps.docker_meta.outputs.labels }}
118+
maintainer=Pauline Conde <pauline.conde@kcl.ac.uk>, Yatharth Ranjan <yatharth.ranjan@kcl.ac.uk>
119+
org.opencontainers.image.description=RADAR-base upload connector backend application
120+
org.opencontainers.image.authors=Pauline Conde <pauline.conde@kcl.ac.uk>, Yatharth Ranjan <yatharth.ranjan@kcl.ac.uk>
121+
org.opencontainers.image.vendor=RADAR-base
122+
org.opencontainers.image.licenses=Apache-2.0
123+
124+
- name: Pull docker image
125+
if: steps.docker_params.outputs.load == 'false'
126+
run: docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
127+
128+
- name: Inspect docker image
129+
run: |
130+
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
131+
docker run --rm ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }} curl --version
132+
133+
134+
# https://github.com/docker/build-push-action/issues/252
135+
# https://github.com/moby/buildkit/issues/1896
136+
- name: Move docker build cache
137+
if: steps.cache_buildx.outputs.cache-hit != 'true'
138+
run: |
139+
rm -rf /tmp/.buildx-cache
140+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

.github/workflows/release-fitbit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
- name: Build docker
8080
uses: docker/build-push-action@v3
8181
with:
82+
file: ./kafka-connect-fitbit-source/Dockerfile
8283
context: .
8384
platforms: linux/amd64,linux/arm64
8485
push: true

0 commit comments

Comments
 (0)