Skip to content

Commit

Permalink
✨ feat(J17): :latest to J17
Browse files Browse the repository at this point in the history
:release continous with J8 and
J11
bump default dockerfile to J17
add _j11 docker file

close duncdrum#27
  • Loading branch information
duncdrum committed Feb 5, 2023
1 parent f426a2c commit d8a16ab
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 128 deletions.
87 changes: 20 additions & 67 deletions .github/workflows/ci-java11.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Java 11
name: Java 11 :release
on:
push:
pull_request:
schedule:
- cron: "11 */8 * * *"
- cron: "11 4 * * *"

env:
TEST_TAG: ${{ secrets.DOCKER_USERNAME }}/existdb:exist-ci
EXIST_VER: 6.2.0
# EXIST_VER: 6.2.0

jobs:
build:
Expand Down Expand Up @@ -62,16 +62,19 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
file: ./Dockerfile_j11
build-args: BRANCH=master
load: true
tags: ${{ env.TEST_TAG }}

- name: Build debug images for testing on CI
uses: docker/build-push-action@v4
with:
context: .
build-args: DISTRO_TAG=debug
file: ./Dockerfile
build-args: |
BRANCH=master
DISTRO_TAG=debug
file: ./Dockerfile_j11
load: true
tags: ${{ env.TEST_TAG }}-debug

Expand All @@ -80,9 +83,10 @@ jobs:
with:
context: .
build-args: |
BRANCH=master
DISTRO_TAG=nonroot
USR=nonroot:nonroot
file: ./Dockerfile
file: ./Dockerfile_j11
load: true
tags: ${{ env.TEST_TAG }}-nonroot

Expand All @@ -105,74 +109,23 @@ jobs:
- name: Run tests
run: bats --tap test/bats/*.bats

# DP: this dynamically set the version from develop
# DP: this dynamically set the version from master
# no longer necessary
# - name: Get SemVer string from test image
# run: |
# echo "EXIST_VER=$(docker exec exist-ci java org.exist.start.Main client --no-gui --xpath 'system:get-version()' | grep -i 'eXist version' | cut -d ' ' -f 3)" >> $GITHUB_ENV
# - name: Test GHA output
# run: echo $EXIST_VER
- name: Get SemVer string from test image
run: |
echo "EXIST_VER=$(docker exec exist-ci java org.exist.start.Main client --no-gui --xpath 'system:get-version()' | grep -i 'eXist version' | cut -d ' ' -f 3)" >> $GITHUB_ENV
- name: Test GHA output
run: echo $EXIST_VER

# PUSH
# Latest
- name: Push :latest to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: BRANCH=develop
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max

- name: Push :debug (latest) to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
DISTRO_TAG=debug
BRANCH=develop
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:debug
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max

- name: push :nonroot (latest) to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
DISTRO_TAG=nonroot
USR=nonroot:nonroot
BRANCH=develop
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:nonroot
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max

# Release
- name: Push :release to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
file: ./Dockerfile_j11
build-args: BRANCH=master
builder: ${{ steps.buildx.outputs.name }}
push: true
Expand All @@ -188,7 +141,7 @@ jobs:
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
file: ./Dockerfile_j11
build-args: |
DISTRO_TAG=debug
BRANCH=master
Expand All @@ -206,7 +159,7 @@ jobs:
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
file: ./Dockerfile_j11
build-args: |
DISTRO_TAG=nonroot
USR=nonroot:nonroot
Expand Down
166 changes: 166 additions & 0 deletions .github/workflows/ci-java17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Java 17 :latest
on:
push:
pull_request:
schedule:
- cron: "11 */8 * * *"

env:
TEST_TAG: ${{ secrets.DOCKER_USERNAME }}/existdb:exist-ci
# EXIST_VER: 6.2.0

jobs:
build:
name: Build and Test Images
runs-on: ubuntu-latest
# NOTE (DP): Test on PRs and pushes
if: github.ref == 'refs/heads/main' || github.base_ref == 'main'
steps:

# SETUP
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '17'

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
# platforms: all

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Make buildkit default
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true

- name: Install bats
# run: sudo apt-get install bats libsaxonb-java
run: sudo apt-get install bats

- name: Check local images
run: docker image ls

# TODO(DP) needs adjusting for multi-stage see #5
# - name: Modify logging config
# run: saxonb-xslt -s:dump/exist-distribution-${{ env.EXIST_VER }}/etc/log4j2.xml -xsl:log4j2-docker.xslt -o:log4j2.xml

# BUILD
- name: Build default images for testing on CI
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
load: true
tags: ${{ env.TEST_TAG }}

- name: Build debug images for testing on CI
uses: docker/build-push-action@v4
with:
context: .
build-args: DISTRO_TAG=debug
file: ./Dockerfile
load: true
tags: ${{ env.TEST_TAG }}-debug

- name: Build nonroot images for testing on CI
uses: docker/build-push-action@v4
with:
context: .
build-args: |
DISTRO_TAG=nonroot
USR=nonroot:nonroot
file: ./Dockerfile
load: true
tags: ${{ env.TEST_TAG }}-nonroot

# TEST
- name: Start exist-ci containers
run: |
docker run -dit -p 8080:8080 --name exist-ci --rm ${{ env.TEST_TAG }}
docker run -dit -p 8181:8080 -v $pwd/exist/autodeploy:/exist/autodeploy --name nonroot --rm ${{ env.TEST_TAG }}-nonroot
sleep 35s
# - name: Wait for exist-ci to boot
# run: |
# timeout 60 sh -c 'until docker logs exist-ci | grep -qe "Server has started"; do sleep 3; done' localhost 8080

- name: Check mem and cgroup config
run: |
docker logs exist-ci | grep -w "Approximate maximum amount of memory for JVM:"
docker logs exist-ci | grep -w "Number of processors available to JVM:"
- name: Run tests
run: bats --tap test/bats/*.bats

# DP: this dynamically set the version from develop
# no longer necessary
# - name: Get SemVer string from test image
# run: |
# echo "EXIST_VER=$(docker exec exist-ci java org.exist.start.Main client --no-gui --xpath 'system:get-version()' | grep -i 'eXist version' | cut -d ' ' -f 3)" >> $GITHUB_ENV
# - name: Test GHA output
# run: echo $EXIST_VER

# PUSH
# Latest
- name: Push :latest to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: BRANCH=develop
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:latest
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max

- name: Push :debug (latest) to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
DISTRO_TAG=debug
BRANCH=develop
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:debug
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max

- name: push :nonroot (latest) to Dockerhub
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: ./
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
DISTRO_TAG=nonroot
USR=nonroot:nonroot
BRANCH=develop
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/existdb:nonroot
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max
Loading

0 comments on commit d8a16ab

Please sign in to comment.