Java 8 :dev6 #815
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
name: Java 8 :dev6 | |
# was :release see #35 | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "11 4 * * *" | |
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@v4 | |
with: | |
fetch-depth: 1 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '8' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
# platforms: all | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Make buildkit default | |
uses: docker/setup-buildx-action@v3 | |
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 | |
# see https://github.com/eXist-db/exist/issues/4911 | |
- name: Build local images for testing on CI | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: BRANCH=develop-6.x.x | |
file: ./Dockerfile_j8 | |
load: true | |
tags: ${{ env.TEST_TAG }} | |
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache | |
- name: Build debug images for testing on CI | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: | | |
DISTRO_TAG=debug | |
BRANCH=develop-6.x.x | |
file: ./Dockerfile_j8 | |
load: true | |
tags: ${{ env.TEST_TAG }}-debug | |
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache | |
- name: Build nonroot images for testing on CI | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: | | |
BRANCH=develop-6.x.x | |
DISTRO_TAG=nonroot | |
USR=nonroot:nonroot | |
file: ./Dockerfile_j8 | |
load: true | |
tags: ${{ env.TEST_TAG }}-nonroot | |
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache | |
# TEST | |
- name: Start exist-ci container | |
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: Run tests | |
run: bats --tap test/bats/*.bats | |
# DP: This is dynamically setting Version number of latest | |
# 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 | |
# Release | |
- name: Push :dev6 to Dockerhub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
platforms: linux/amd64,linux/arm64 | |
file: ./Dockerfile_j8 | |
build-args: BRANCH=develop-6.x.x | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: | | |
${{ secrets.DOCKER_USERNAME }}/existdb:dev6-j8 | |
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 (dev6) to Dockerhub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
platforms: linux/amd64,linux/arm64 | |
file: ./Dockerfile_j8 | |
build-args: | | |
DISTRO_TAG=debug | |
BRANCH=develop-6.x.x | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: | | |
${{ secrets.DOCKER_USERNAME }}/existdb:dev6-debug-j8 | |
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 (dev6) to Dockerhub | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
platforms: linux/amd64,linux/arm64 | |
file: ./Dockerfile_j8 | |
build-args: | | |
DISTRO_TAG=nonroot | |
USR=nonroot:nonroot | |
BRANCH=develop-6.x.x | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: | | |
${{ secrets.DOCKER_USERNAME }}/existdb:dev6-nonroot-j8 | |
cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache | |
cache-to: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/existdb:buildcache,mode=max |