Skip to content

Commit

Permalink
Merge branch 'master' into oidc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeidnx authored Oct 24, 2023
2 parents 0eb2351 + ea6da37 commit 9b7246a
Show file tree
Hide file tree
Showing 47 changed files with 796 additions and 204 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17 ]
java: [ 21 ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
distribution: zulu
cache: "gradle"
- name: Run Build
run: ./gradlew build
31 changes: 17 additions & 14 deletions .github/workflows/docker-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,46 @@ on:
pull_request:

jobs:
build-jdk:
uses: ./.github/workflows/fat-build.yml

build-test:
runs-on: ubuntu-latest
needs: build-jdk
strategy:
matrix:
docker-compose-file:
- docker-compose.yml
- testing/docker-compose.hsqldb.yml
- testing/docker-compose.cockroachdb.yml
- testing/docker-compose.yugabytedb.yml
dockerfile:
- Dockerfile.ci
- Dockerfile.azul.ci
- Dockerfile.openj9.ci
#- Dockerfile.openj9.ci
- Dockerfile.graalvm-jvm.ci
include:
- sleep: 20
- docker-compose-file: testing/docker-compose.cockroachdb.yml
sleep: 30
- docker-compose-file: testing/docker-compose.yugabytedb.yml
sleep: 120
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: piped.jar
- name: Create Version File
run: echo $(git log -1 --date=short --pretty=format:%cd)-$(git rev-parse --short HEAD) > VERSION
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: "gradle"
- name: Run Build
run: ./gradlew shadowJar
- run: mv build/libs/piped-*-all.jar piped.jar
- name: Build Image Locally
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
load: true
file: ${{ matrix.dockerfile }}
tags: 1337kavin/piped:latest
- name: Start Docker-Compose services
run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep 20
run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep ${{ matrix.sleep }}
- name: Run tests
run: ./testing/api-test.sh
- name: Collect services logs
Expand Down
30 changes: 14 additions & 16 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,46 @@ on:
- master

jobs:
build-jdk:
uses: ./.github/workflows/fat-build.yml

build-docker:
needs: build-jdk
runs-on: ubuntu-latest
strategy:
matrix:
include:
- image: 1337kavin/piped:openj9
dockerfile: ./Dockerfile.openj9.ci
# - image: 1337kavin/piped:openj9
# dockerfile: ./Dockerfile.openj9.ci
- image: 1337kavin/piped:hotspot
dockerfile: ./Dockerfile.ci
- image: 1337kavin/piped:latest,1337kavin/piped:azul-zulu
dockerfile: ./Dockerfile.azul.ci
- image: 1337kavin/piped:graalvm-jvm
dockerfile: ./Dockerfile.graalvm-jvm.ci
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: piped.jar
- name: Create Version File
run: echo $(git log -1 --date=short --pretty=format:%cd)-$(git rev-parse --short HEAD) > VERSION
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: "gradle"
- name: Run Build
run: ./gradlew shadowJar
- run: mv build/libs/piped-*-all.jar piped.jar
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/docker-migrations-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Docker-Compose Build and Test Migration

on:
pull_request:
paths:
- "src/main/resources/changelog/**"
- "src/main/java/me/kavin/piped/utils/obj/db/**"

jobs:
build-new:
uses: ./.github/workflows/fat-build.yml
build-old:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: zulu
cache: "gradle"
- name: Run Build
run: ./gradlew shadowJar
- run: mv build/libs/piped-*-all.jar piped.jar
- uses: actions/upload-artifact@v3
with:
name: piped-old.jar
path: piped.jar

docker-build-test:
needs: [ build-new, build-old ]
runs-on: ubuntu-latest
strategy:
matrix:
docker-compose-file:
- docker-compose.yml
- testing/docker-compose.cockroachdb.yml
- testing/docker-compose.yugabytedb.yml
dockerfile:
- Dockerfile.azul.ci
include:
- sleep: 20
- docker-compose-file: testing/docker-compose.cockroachdb.yml
sleep: 30
- docker-compose-file: testing/docker-compose.yugabytedb.yml
sleep: 120
fail-fast: false
steps:
- uses: actions/checkout@v4
- run: echo "unknown" > VERSION
- uses: actions/download-artifact@v3
with:
name: piped-old.jar
- name: Build Old Image Locally
uses: docker/build-push-action@v5
with:
context: .
load: true
file: ${{ matrix.dockerfile }}
tags: 1337kavin/piped:latest
- name: Start Docker-Compose services
run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep ${{ matrix.sleep }}
- run: rm piped.jar
- uses: actions/download-artifact@v3
with:
name: piped.jar
- name: Build New Image Locally
uses: docker/build-push-action@v5
with:
context: .
load: true
file: ${{ matrix.dockerfile }}
tags: 1337kavin/piped:latest
- name: Start Docker-Compose services
run: docker-compose -f ${{ matrix.docker-compose-file }} up -d && sleep ${{ matrix.sleep }}
- name: Run tests
run: ./testing/api-test.sh
- name: Collect services logs
if: failure()
run: docker-compose -f ${{ matrix.docker-compose-file }} logs
24 changes: 24 additions & 0 deletions .github/workflows/fat-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Fat JAR Build

on:
workflow_call:

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: zulu
cache: "gradle"
- name: Run Build
run: ./gradlew shadowJar
- run: mv build/libs/piped-*-all.jar piped.jar
- uses: actions/upload-artifact@v3
with:
name: piped.jar
path: piped.jar
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:17-jdk AS build
FROM eclipse-temurin:21-jdk AS build

WORKDIR /app/

Expand All @@ -7,16 +7,25 @@ COPY . /app/
RUN --mount=type=cache,target=/root/.gradle/caches/ \
./gradlew shadowJar

FROM eclipse-temurin:17-jre
FROM eclipse-temurin:21-jre

RUN --mount=type=cache,target=/var/cache/apt/ \
apt-get update && \
apt-get install -y --no-install-recommends \
curl \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app/

COPY hotspot-entrypoint.sh /
COPY hotspot-entrypoint.sh docker-healthcheck.sh /

COPY --from=build /app/build/libs/piped-1.0-all.jar /app/piped.jar

COPY VERSION .

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 CMD /docker-healthcheck.sh
ENTRYPOINT ["/hotspot-entrypoint.sh"]
15 changes: 12 additions & 3 deletions Dockerfile.azul
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM azul/zulu-openjdk:17-latest AS build
FROM azul/zulu-openjdk:21-latest AS build

WORKDIR /app/

Expand All @@ -7,16 +7,25 @@ COPY . /app/
RUN --mount=type=cache,target=/root/.gradle/caches/ \
./gradlew shadowJar

FROM azul/zulu-openjdk:17-jre-headless-latest
FROM azul/zulu-openjdk:21-jre-headless-latest

RUN --mount=type=cache,target=/var/cache/apt/ \
apt-get update && \
apt-get install -y --no-install-recommends \
curl \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app/

COPY hotspot-entrypoint.sh /
COPY hotspot-entrypoint.sh docker-healthcheck.sh /

COPY --from=build /app/build/libs/piped-1.0-all.jar /app/piped.jar

COPY VERSION .

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 CMD /docker-healthcheck.sh
ENTRYPOINT ["/hotspot-entrypoint.sh"]
13 changes: 11 additions & 2 deletions Dockerfile.azul.ci
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
FROM azul/zulu-openjdk:17-jre-headless-latest
FROM azul/zulu-openjdk:21-jre-headless-latest

RUN --mount=type=cache,target=/var/cache/apt/ \
apt-get update && \
apt-get install -y --no-install-recommends \
curl \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app/

COPY hotspot-entrypoint.sh /
COPY hotspot-entrypoint.sh docker-healthcheck.sh /

COPY ./piped.jar /app/piped.jar

COPY VERSION .

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 CMD /docker-healthcheck.sh
ENTRYPOINT ["/hotspot-entrypoint.sh"]
13 changes: 11 additions & 2 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
FROM eclipse-temurin:17-jre
FROM eclipse-temurin:21-jre

RUN --mount=type=cache,target=/var/cache/apt/ \
apt-get update && \
apt-get install -y --no-install-recommends \
curl \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /app/

COPY hotspot-entrypoint.sh /
COPY hotspot-entrypoint.sh docker-healthcheck.sh /

COPY ./piped.jar /app/piped.jar

COPY VERSION .

EXPOSE 8080

HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 CMD /docker-healthcheck.sh
ENTRYPOINT ["/hotspot-entrypoint.sh"]
Loading

0 comments on commit 9b7246a

Please sign in to comment.