test github action (#136)

* changed github action
This commit is contained in:
André Bauer 2020-02-27 00:33:46 +01:00 committed by GitHub
parent 7fe85067fa
commit 33beea77df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 23 deletions

8
.env
View File

@ -1,8 +1,6 @@
# don't forget to add the minus before the version # don't forget to add the minus before the version
# example: VERSION=-3.2.0-12
IMAGE_REPO=zammad/zammad-docker-compose IMAGE_REPO=zammad/zammad-docker-compose
VERSION=-3.2.0-13
RESTART=always
POSTGRES_USER=zammad
POSTGRES_PASS=zammad POSTGRES_PASS=zammad
POSTGRES_USER=zammad
RESTART=always
VERSION=-3.2.0-13

View File

@ -5,15 +5,9 @@
set -o errexit set -o errexit
CONFIG_DIR=".github"
HOOKS_DIR="hooks"
CONTAINER_DIR="containers"
TMP_FILE="$(mktemp)" TMP_FILE="$(mktemp)"
find "${CONFIG_DIR}" -type f -name "*.sh" > "${TMP_FILE}" find . -type f -name "*.sh" > "${TMP_FILE}"
find "${HOOKS_DIR}" -type f -name "*.sh" >> "${TMP_FILE}"
find "${CONTAINER_DIR}" -type f -name "*.sh" >> "${TMP_FILE}"
while read -r FILE; do while read -r FILE; do
echo lint "${FILE}" echo lint "${FILE}"

20
.github/tests.sh vendored Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#
# run zammad tests
#
set -o errexit
set -o pipefail
docker-compose logs --timestamps --follow &
until (curl -I --silent --fail localhost | grep -iq "HTTP/1.1 200 OK"); do
echo "wait for zammad to be ready..."
sleep 15
done
sleep 10
echo
echo "Success - Zammad is up :)"
echo

View File

@ -14,14 +14,37 @@ jobs:
with: with:
args: .github/lint-scripts.sh args: .github/lint-scripts.sh
install-docker-compose: lint-docker-files:
name: install-docker-compose
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: lint-bash-scripts needs: lint-bash-scripts
steps:
- name: Checkout
uses: actions/checkout@v1
- name: lint zammad dockerfile
uses: brpaz/hadolint-action@master
with:
dockerfile: containers/zammad-elasticsearch/Dockerfile
- name: lint elasticsearch dockerfile
uses: brpaz/hadolint-action@master
with:
dockerfile: containers/zammad-postgresql/Dockerfile
- name: lint postgresql dockerfile
uses: brpaz/hadolint-action@master
with:
dockerfile: containers/zammad/Dockerfile
test-docker-compose:
timeout-minutes: 30
runs-on: ubuntu-latest
needs: lint-docker-files
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
- name: get containers - name: pull container images
run: docker-compose pull run: docker-compose pull
- name: install - name: run docker-compose up
run: docker-compose up run: docker-compose up --detach
- name: run tests
run: .github/tests.sh

View File

@ -1,4 +1,3 @@
MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE ARG BUILD_DATE
LABEL org.label-schema.build-date="$BUILD_DATE" \ LABEL org.label-schema.build-date="$BUILD_DATE" \

View File

@ -1,5 +1,4 @@
FROM docker.elastic.co/elasticsearch/elasticsearch:7.6.0 FROM docker.elastic.co/elasticsearch/elasticsearch:7.6.0
MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE ARG BUILD_DATE
LABEL org.label-schema.build-date="$BUILD_DATE" \ LABEL org.label-schema.build-date="$BUILD_DATE" \
@ -13,4 +12,6 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.schema-version="3.2.0" \ org.label-schema.schema-version="3.2.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
RUN yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment RUN yes | /usr/share/elasticsearch/bin/elasticsearch-plugin install ingest-attachment

View File

@ -1,6 +1,5 @@
FROM postgres:9.6.17-alpine FROM postgres:9.6.17-alpine
MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE ARG BUILD_DATE
LABEL org.label-schema.build-date="$BUILD_DATE" \ LABEL org.label-schema.build-date="$BUILD_DATE" \
@ -14,6 +13,8 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.schema-version="3.2.0" \ org.label-schema.schema-version="3.2.0" \
org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up" org.label-schema.docker.cmd="sysctl -w vm.max_map_count=262144;docker-compose up"
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
# copy backup script # copy backup script
COPY containers/zammad-postgresql/backup.sh /usr/local/bin/ COPY containers/zammad-postgresql/backup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/backup.sh RUN chmod +x /usr/local/bin/backup.sh

2
containers/zammad-postgresql/backup.sh Normal file → Executable file
View File

@ -33,7 +33,7 @@ function zammad_backup {
fi fi
#db backup #db backup
pg_dump --dbname=postgresql://"${POSTGRESQL_USER}:${POSTGRESQL_PASSWORD}"@"${POSTGRESQL_HOST}":"${POSTGRESQL_PORT}"/"${POSTGRESQL_DB}" | gzip > "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_db.psql.gz pg_dump --dbname=postgresql://"${POSTGRESQL_USER}:${POSTGRESQL_PASSWORD}@${POSTGRESQL_HOST}:${POSTGRESQL_PORT}/${POSTGRESQL_DB}" | gzip > "${BACKUP_DIR}"/"${TIMESTAMP}"_zammad_db.psql.gz
} }
if [ "$1" = 'zammad-backup' ]; then if [ "$1" = 'zammad-backup' ]; then

View File

@ -2,7 +2,6 @@ FROM ruby:2.5.5-slim AS builder
# note: zammad is currently incompatible to alpine because of: # note: zammad is currently incompatible to alpine because of:
# https://github.com/docker-library/ruby/issues/113 # https://github.com/docker-library/ruby/issues/113
MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE ARG BUILD_DATE
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
@ -17,6 +16,8 @@ ENV ZAMMAD_READY_FILE ${ZAMMAD_DIR}/tmp/zammad.ready
ENV ZAMMAD_TMP_DIR /tmp/zammad-${GIT_BRANCH} ENV ZAMMAD_TMP_DIR /tmp/zammad-${GIT_BRANCH}
ENV ZAMMAD_USER zammad ENV ZAMMAD_USER zammad
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
# install zammad # install zammad
COPY containers/zammad/setup.sh /tmp COPY containers/zammad/setup.sh /tmp
RUN chmod +x /tmp/setup.sh; \ RUN chmod +x /tmp/setup.sh; \
@ -25,7 +26,6 @@ RUN chmod +x /tmp/setup.sh; \
FROM ruby:2.5.5-slim FROM ruby:2.5.5-slim
MAINTAINER Zammad <info@zammad.org>
ARG BUILD_DATE ARG BUILD_DATE
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive

1
containers/zammad/setup.sh Normal file → Executable file
View File

@ -10,6 +10,7 @@ fi
apt-get update apt-get update
apt-get upgrade -y apt-get upgrade -y
# shellcheck disable=SC2086
apt-get install -y --no-install-recommends ${PACKAGES} apt-get install -y --no-install-recommends ${PACKAGES}
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*