Skip to content

retry on serialization failure #151

retry on serialization failure

retry on serialization failure #151

Workflow file for this run

name: "deploy"
on:
push:
jobs:
build:
environment: production
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
with:
use-flakehub: false
- name: 'deploy stateless sql'
run: |
psql "$PG_DEV_URI" -v ON_ERROR_STOP=1 --single-transaction -c 'drop schema if exists cpres cascade' -f sql/cpres.sql
env:
PG_DEV_URI: ${{ secrets.PG_DEV_URI }}
- name: 'grant person to neondb_owner'
run: |
psql "$PG_DEV_URI" -v ON_ERROR_STOP=1 -c 'grant person to neondb_owner'
env:
PG_DEV_URI: ${{ secrets.PG_DEV_URI }}
- name: 'test sql'
run: |
psql "$PG_DEV_URI" -v ON_ERROR_STOP=1 $(find tests/sql -name '*.sql' -printf ' -f %h/%f\n' | sort -V | xargs)
env:
PG_DEV_URI: ${{ secrets.PG_DEV_URI }}
# - name: 'test httpg'
# run: |
# nix develop .
# nix run .#up
# nix --accept-flake-config build .#httpg-test
deploy:
needs: [build]
environment: production
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA }}'
project_id: 'gieze-421708'
- uses: 'google-github-actions/setup-gcloud@v3'
with:
project_id: 'gieze-421708'
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
with:
use-flakehub: false
- id: image_name
run: |
echo "image_name=docker.io/$(nix --accept-flake-config eval .#oci.imageRefUnsafe --raw)" | tee -a "$GITHUB_OUTPUT"
- run: |
sudo rm /etc/containers/registries.conf
- run: |
nix --accept-flake-config run nixpkgs#skopeo -- login docker.io -u docteurklein -p "$DOCKER_PASSWORD"
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- run: nix --accept-flake-config run .#oci.copyToRegistry
- id: 'deploy'
uses: 'google-github-actions/deploy-cloudrun@v3'
with:
project_id: 'gieze-421708'
region: europe-west1
service: 'httpg'
image: ${{ steps.image_name.outputs.image_name }}
- name: 'deploy url'
run: 'echo "${{ steps.deploy.outputs.url }}"'
migrate:
needs: [build]
environment: production
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'migrate'
run: |
psql "$PG_URI" -v ON_ERROR_STOP=1 $(find migration/cpres -name '*.sql' -printf ' -f %h/%f\n' | sort -V | xargs)
env:
PG_URI: ${{ secrets.PG_URI }}
- name: 'deploy stateless sql'
run: |
psql "$PG_URI" --single-transaction -f sql/url.sql -f sql/proc.sql -f sql/view.sql -f sql/translation.sql
env:
PG_URI: ${{ secrets.PG_URI }}