Compare commits

..

4 commits

Author SHA1 Message Date
dependabot[bot]
e01ecce080
Bump actions/checkout from 4 to 5 ()
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-12 18:15:15 +02:00
Fco. Javier Delgado del Hoyo
4bacd0dc7c
Merge pull request from fradelg/bugfix/skip-dump-date
Fixed database name on dumps
2024-12-09 12:35:48 +01:00
Fco. Javier Delgado del Hoyo
1d3c439b65 split test and build jobs 2024-12-09 12:32:31 +01:00
Fco. Javier Delgado del Hoyo
8a15e59c1f skip only timestamps when needed 2024-12-09 12:23:08 +01:00
4 changed files with 30 additions and 26 deletions

View file

@ -1,37 +1,17 @@
name: build docker image name: build docker image
on: on:
workflow_dispatch:
push: push:
branches:
- "**"
tags: tags:
- "**" - "**"
jobs: jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout the code
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: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: test
steps: steps:
- name: Checkout the code - name: Checkout the code
uses: actions/checkout@v4 uses: actions/checkout@v5
# https://github.com/docker/setup-qemu-action # https://github.com/docker/setup-qemu-action
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3

26
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: build docker image
on:
workflow_dispatch:
push:
branches:
- "**"
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout the code
uses: actions/checkout@v5
- 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

View file

@ -32,8 +32,7 @@ do
BASIC_OPTS="--single-transaction" BASIC_OPTS="--single-transaction"
if [ -n "$REMOVE_DUPLICATES" ] if [ -n "$REMOVE_DUPLICATES" ]
then then
echo "WARNING: disabling comments in backup to remove deuplicate backups. Automatic database name detection won't work so set MYSQL_DATABASE on restore" BASIC_OPTS="$BASIC_OPTS --skip-dump-date"
BASIC_OPTS="$BASIC_OPTS" --skip-comments
fi fi
if mysqldump $BASIC_OPTS $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME" if mysqldump $BASIC_OPTS $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME"
then then
@ -52,7 +51,7 @@ do
cd /backup || exit && ln -s "$BASENAME" "$(basename "$LATEST")" cd /backup || exit && ln -s "$BASENAME" "$(basename "$LATEST")"
if [ -n "$REMOVE_DUPLICATES" ] if [ -n "$REMOVE_DUPLICATES" ]
then then
echo "=> Removing duplicate database dumps" echo "==> Removing duplicate database dumps"
fdupes -idN /backup/ fdupes -idN /backup/
fi fi
if [ -n "$MAX_BACKUPS" ] if [ -n "$MAX_BACKUPS" ]

View file

@ -30,7 +30,6 @@ services:
environment: environment:
- MYSQL_HOST=my_mariadb - MYSQL_HOST=my_mariadb
- MYSQL_USER=root - MYSQL_USER=root
- MYSQL_DATABASE=${DATABASE_NAME}
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD} - MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
- MAX_BACKUPS=1 - MAX_BACKUPS=1
- INIT_BACKUP=1 - INIT_BACKUP=1