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