postgres: change backup format from plain SQL to pg_dump custom #120
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install pre-commit | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade pre-commit | |
ansible-galaxy collection install --force ansible.posix | |
ansible-galaxy collection install --force community.postgresql | |
- name: Run pre-commit | |
run: | | |
python -m pre_commit run --all-files --show-diff-on-failure | |
python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install pytest / Ruff | |
run: | | |
python -m pip install pytest ruff | |
- name: Run Python linter | |
run: | | |
ruff format --check | |
ruff check | |
- name: Run Python tests | |
run: | | |
pushd roles/postgres/files | |
PATH=$PWD:$PATH pytest -v . | |
popd | |
ansible: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Ansible | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade ansible | |
ansible-galaxy collection install --force ansible.posix | |
ansible-galaxy collection install --force community.postgresql | |
- name: Remove pre-baked PostgreSQL | |
run: | |
# Existing pre-baked PostgreSQL installation may conflict with the | |
# PostgreSQL installed by our playbook. We better remove it for a | |
# greater good. | |
sudo apt purge 'postgresql-*' | |
- name: Create block storage device (volume) | |
run: | | |
VOLUME_DEVICE="$(losetup -f)" | |
VOLUME_IMAGE="${{ runner.temp }}/diskimage" | |
dd if=/dev/zero of=$VOLUME_IMAGE bs=1M count=1024 | |
sudo losetup $VOLUME_DEVICE $VOLUME_IMAGE | |
echo "uri=$VOLUME_DEVICE" >> $GITHUB_OUTPUT | |
id: volume-device | |
- name: Add server names to /etc/hosts | |
run: | | |
echo "127.0.0.1 xsnippet.local" | sudo tee -a /etc/hosts | |
echo "127.0.0.1 api.xsnippet.local" | sudo tee -a /etc/hosts | |
- name: Run the playbook | |
run: | | |
ansible-playbook \ | |
-vvv \ | |
-e volume_device="${{ steps.volume-device.outputs.uri }}" \ | |
--inventory inventories/ci \ | |
site.yml |