From 7ff37a5c485963b57fb5f98e037281646e4597f4 Mon Sep 17 00:00:00 2001 From: Pau Rodriguez-Estivill Date: Sat, 26 Feb 2022 14:22:07 +0100 Subject: [PATCH] Add CI script test --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 44 insertions(+) create mode 100644 .gitignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3926c7..fb2f029 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,8 +7,51 @@ on: - '!master' jobs: + test: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: "database" + POSTGRES_USER: "user" + POSTGRES_PASSWORD: "test" + ports: + - 5432:5432 + # Set health checks to wait until postgres has started + options: + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v2 + + - name: Test backup script + env: + POSTGRES_DB: "database" + POSTGRES_USER: "user" + POSTGRES_PASSWORD: "test" + POSTGRES_HOST: "127.0.0.1" + POSTGRES_PORT: 5432 + POSTGRES_EXTRA_OPTS: "-Z0" + BACKUP_DIR: ".data" + # Defaults + POSTGRES_DB_FILE: "**None**" + POSTGRES_USER_FILE: "**None**" + POSTGRES_PASSWORD_FILE: "**None**" + POSTGRES_PASSFILE_STORE: "**None**" + POSTGRES_CLUSTER: "FALSE" + BACKUP_SUFFIX: ".sql.gz" + BACKUP_KEEP_DAYS: 7 + BACKUP_KEEP_WEEKS: 4 + BACKUP_KEEP_MONTHS: 6 + run: | + mkdir -p "$BACKUP_DIR" + sh -xe backup.sh build: runs-on: ubuntu-latest + needs: [ test ] steps: - uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c8691c4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.data \ No newline at end of file