diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index e639e5f..1fe4d25 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -16,6 +16,16 @@ jobs: uses: actions/checkout@v4 - name: Test Bash scripts run: sudo apt-get -qq update && sudo apt-get install -y devscripts shellcheck && make test + - name: Test image + env: + VOLUME_PATH: /tmp/mariadb + DATABASE_NAME: foo + MARIADB_ROOT_PASSWORD: abcd + run: | + docker-compose up -d mariadb + docker-compose run backup /backup.sh + docker-compose run backup /restore.sh /backup/latest.foo.sql.gz + docker-compose stop build: runs-on: ubuntu-22.04 needs: test diff --git a/Dockerfile b/Dockerfile index 95ad9bc..851a5c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,4 +44,4 @@ VOLUME ["/backup"] HEALTHCHECK --interval=2s --retries=1800 \ CMD stat /HEALTHY.status || exit 1 -ENTRYPOINT dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh \ No newline at end of file +CMD dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh diff --git a/restore.sh b/restore.sh index 0607d6f..6c03634 100755 --- a/restore.sh +++ b/restore.sh @@ -13,6 +13,7 @@ if [ "$#" -ne 1 ] then echo "You must pass the path of the backup file to restore" + exit 1 fi set -o pipefail