Tests on Managed PostgreSQL #360
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: Tests on Managed PostgreSQL | |
on: | |
schedule: | |
- cron: "0 3 * * 6" | |
workflow_dispatch: | |
inputs: {} | |
push: | |
branches: | |
- cloud-test | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.3' | |
# Build virtualenv | |
- name: Handle virtualenv | |
uses: syphar/restore-virtualenv@v1 | |
id: venv-cache | |
with: | |
requirement_files: | | |
setup.py | |
pyproject.toml | |
custom_cache_key_element: v2 | |
- name: Install Python dependencies | |
if: steps.venv-cache.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
set -e | |
python -m pip install -U pip setuptools wheel build | |
bdeps_script="import build; print('\n'.join(build.ProjectBuilder('.').build_system_requires))" | |
readarray -t build_deps < <(python -c "${bdeps_script}") | |
python -m pip download --dest=$VIRTUAL_ENV/deps "${build_deps[@]}" .[test] | |
python -m pip install -U --no-index --find-links=$VIRTUAL_ENV/deps $VIRTUAL_ENV/deps/* | |
# Prepare environment variables and shared artifacts | |
- name: Compute cache keys | |
run: | | |
mkdir -p .tmp | |
python setup.py -q ci_helper --type cli > .tmp/edgedbcli_git_rev.txt | |
python setup.py -q ci_helper --type rust >.tmp/rust_cache_key.txt | |
python setup.py -q ci_helper --type ext >.tmp/ext_cache_key.txt | |
python setup.py -q ci_helper --type parsers >.tmp/parsers_cache_key.txt | |
python setup.py -q ci_helper --type postgres >.tmp/postgres_git_rev.txt | |
echo 'v0.17.0' >.tmp/stolon_git_rev.txt | |
python setup.py -q ci_helper --type bootstrap >.tmp/bootstrap_cache_key.txt | |
echo EDGEDBCLI_GIT_REV=$(cat .tmp/edgedbcli_git_rev.txt) >> $GITHUB_ENV | |
echo POSTGRES_GIT_REV=$(cat .tmp/postgres_git_rev.txt) >> $GITHUB_ENV | |
echo STOLON_GIT_REV=$(cat .tmp/stolon_git_rev.txt) >> $GITHUB_ENV | |
echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV | |
echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV | |
- name: Upload shared artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: shared-artifacts | |
path: .tmp | |
retention-days: 1 | |
# Restore binary cache | |
- name: Handle cached EdgeDB CLI binaries | |
uses: actions/cache@v3 | |
id: cli-cache | |
with: | |
path: build/cli | |
key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} | |
- name: Handle cached Rust extensions | |
uses: actions/cache@v3 | |
id: rust-cache | |
with: | |
path: build/rust_extensions | |
key: edb-rust-v3-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
restore-keys: | | |
edb-rust-v3- | |
- name: Handle cached Cython extensions | |
uses: actions/cache@v3 | |
id: ext-cache | |
with: | |
path: build/extensions | |
key: edb-ext-v4-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Handle cached PostgreSQL build | |
uses: actions/cache@v3 | |
id: postgres-cache | |
with: | |
path: build/postgres/install | |
key: edb-postgres-v2-${{ env.POSTGRES_GIT_REV }} | |
- name: Handle cached Stolon build | |
uses: actions/cache@v3 | |
id: stolon-cache | |
with: | |
path: build/stolon/bin | |
key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} | |
# Install system dependencies for building | |
- name: Install system deps | |
if: | | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' || | |
steps.ext-cache.outputs.cache-hit != 'true' || | |
steps.stolon-cache.outputs.cache-hit != 'true' || | |
steps.postgres-cache.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y uuid-dev libreadline-dev bison flex | |
- name: Install rust toolchain | |
if: | | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
# Build EdgeDB CLI | |
- name: Handle EdgeDB CLI build cache | |
uses: actions/cache@v3 | |
if: steps.cli-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ env.BUILD_TEMP }}/rust/cli | |
key: edb-cli-build-v7-${{ env.EDGEDBCLI_GIT_REV }} | |
restore-keys: | | |
edb-cli-build-v7- | |
- name: Build EdgeDB CLI | |
env: | |
CARGO_HOME: ${{ env.BUILD_TEMP }}/rust/cli/cargo_home | |
CACHE_HIT: ${{ steps.cli-cache.outputs.cache-hit }} | |
run: | | |
if [[ "$CACHE_HIT" == "true" ]]; then | |
cp -v build/cli/bin/edgedb edb/cli/edgedb | |
else | |
python setup.py -v build_cli | |
fi | |
# Build Rust extensions | |
- name: Handle Rust extensions build cache | |
uses: actions/cache@v3 | |
if: steps.rust-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ env.BUILD_TEMP }}/rust/extensions | |
key: edb-rust-build-v1-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
restore-keys: | | |
edb-rust-build-v1- | |
- name: Build Rust extensions | |
env: | |
CARGO_HOME: ${{ env.BUILD_TEMP }}/rust/extensions/cargo_home | |
CACHE_HIT: ${{ steps.rust-cache.outputs.cache-hit }} | |
run: | | |
if [[ "$CACHE_HIT" != "true" ]]; then | |
rm -rf ${BUILD_LIB} | |
mkdir -p build/rust_extensions | |
rsync -av ./build/rust_extensions/ ${BUILD_LIB}/ | |
python setup.py -v build_rust | |
rsync -av ${BUILD_LIB}/ build/rust_extensions/ | |
rm -rf ${BUILD_LIB} | |
fi | |
rsync -av ./build/rust_extensions/edb/ ./edb/ | |
# Build libpg_query | |
- name: Build libpg_query | |
run: | | |
python setup.py build_libpg_query | |
# Build extensions | |
- name: Handle Cython extensions build cache | |
uses: actions/cache@v3 | |
if: steps.ext-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ env.BUILD_TEMP }}/edb | |
key: edb-ext-build-v3-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Build Cython extensions | |
env: | |
CACHE_HIT: ${{ steps.ext-cache.outputs.cache-hit }} | |
BUILD_EXT_MODE: py-only | |
run: | | |
if [[ "$CACHE_HIT" != "true" ]]; then | |
rm -rf ${BUILD_LIB} | |
mkdir -p ./build/extensions | |
rsync -av ./build/extensions/ ${BUILD_LIB}/ | |
BUILD_EXT_MODE=py-only python setup.py -v build_ext | |
rsync -av ${BUILD_LIB}/ ./build/extensions/ | |
rm -rf ${BUILD_LIB} | |
fi | |
rsync -av ./build/extensions/edb/ ./edb/ | |
# Build parsers | |
- name: Handle compiled parsers cache | |
uses: actions/cache@v3 | |
id: parsers-cache | |
with: | |
path: build/lib | |
key: edb-parsers-v2-${{ hashFiles('.tmp/parsers_cache_key.txt') }} | |
restore-keys: | | |
edb-parsers-v2- | |
- name: Build parsers | |
env: | |
CACHE_HIT: ${{ steps.parsers-cache.outputs.cache-hit }} | |
run: | | |
if [[ "$CACHE_HIT" != "true" ]]; then | |
rm -rf ${BUILD_LIB} | |
mkdir -p ./build/lib | |
rsync -av ./build/lib/ ${BUILD_LIB}/ | |
python setup.py -v build_parsers | |
rsync -av ${BUILD_LIB}/ ./build/lib/ | |
rm -rf ${BUILD_LIB} | |
fi | |
rsync -av ./build/lib/edb/ ./edb/ | |
# Build PostgreSQL | |
- name: Build PostgreSQL | |
env: | |
CACHE_HIT: ${{ steps.postgres-cache.outputs.cache-hit }} | |
run: | | |
if [[ "$CACHE_HIT" == "true" ]]; then | |
cp build/postgres/install/stamp build/postgres/ | |
else | |
python setup.py build_postgres | |
cp build/postgres/stamp build/postgres/install/ | |
fi | |
# Build Stolon | |
- name: Set up Go | |
if: steps.stolon-cache.outputs.cache-hit != 'true' | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.16 | |
- uses: actions/checkout@v3 | |
if: steps.stolon-cache.outputs.cache-hit != 'true' | |
with: | |
repository: sorintlab/stolon | |
path: build/stolon | |
ref: ${{ env.STOLON_GIT_REV }} | |
fetch-depth: 0 | |
submodules: false | |
- name: Build Stolon | |
if: steps.stolon-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p build/stolon/bin/ | |
curl -fsSL https://releases.hashicorp.com/consul/1.10.1/consul_1.10.1_linux_amd64.zip | zcat > build/stolon/bin/consul | |
chmod +x build/stolon/bin/consul | |
cd build/stolon && make | |
# Install edgedb-server and populate egg-info | |
- name: Install edgedb-server and populate egg-info | |
env: | |
CACHE_HIT: ${{ steps.venv-cache.outputs.cache-hit }} | |
BUILD_EXT_MODE: skip | |
run: | | |
if [[ "$CACHE_HIT" == "true" ]]; then | |
rsync -av $VIRTUAL_ENV/edgedb_server.egg-info/ ./edgedb_server.egg-info/ | |
else | |
# --no-build-isolation because we have explicitly installed all deps | |
# and don't want them to be reinstalled in an "isolated env". | |
pip install --no-build-isolation --no-deps -e .[test,docs] | |
rsync -av ./edgedb_server.egg-info/ $VIRTUAL_ENV/edgedb_server.egg-info/ | |
fi | |
# Refresh the bootstrap cache | |
- name: Handle bootstrap cache | |
uses: actions/cache@v3 | |
id: bootstrap-cache | |
with: | |
path: build/cache | |
key: edb-bootstrap-v2-${{ hashFiles('.tmp/bootstrap_cache_key.txt') }} | |
restore-keys: | | |
edb-bootstrap-v2- | |
- name: Bootstrap EdgeDB Server | |
if: steps.bootstrap-cache.outputs.cache-hit != 'true' | |
run: | | |
edb server --bootstrap-only | |
setup-aws-rds: | |
runs-on: ubuntu-latest | |
outputs: | |
pghost: ${{ steps.pghost.outputs.stdout }} | |
defaults: | |
run: | |
working-directory: .github/aws-rds | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Setup AWS RDS | |
env: | |
TF_VAR_sg_id: ${{ secrets.AWS_SECURITY_GROUP }} | |
TF_VAR_password: ${{ secrets.AWS_RDS_PASSWORD }} | |
run: | | |
terraform apply -auto-approve | |
- name: Store Terraform state | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aws-rds-tfstate | |
path: .github/aws-rds/terraform.tfstate | |
retention-days: 1 | |
- name: Get RDS host | |
id: pghost | |
run: | | |
terraform output -raw db_instance_address | |
test-aws-rds: | |
runs-on: ubuntu-latest | |
needs: [setup-aws-rds, build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.3' | |
- name: Handle virtualenv | |
uses: syphar/restore-virtualenv@v1 | |
id: venv-cache | |
with: | |
requirement_files: | | |
setup.py | |
pyproject.toml | |
custom_cache_key_element: v2 | |
# Restore the artifacts and environment variables | |
- name: Download shared artifacts | |
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 | |
with: | |
action: actions/download-artifact@v3 | |
with: | | |
name: shared-artifacts | |
path: .tmp | |
- name: Set environment variables | |
run: | | |
echo EDGEDBCLI_GIT_REV=$(cat .tmp/edgedbcli_git_rev.txt) >> $GITHUB_ENV | |
echo POSTGRES_GIT_REV=$(cat .tmp/postgres_git_rev.txt) >> $GITHUB_ENV | |
echo STOLON_GIT_REV=$(cat .tmp/stolon_git_rev.txt) >> $GITHUB_ENV | |
echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV | |
echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV | |
# Restore build cache | |
- name: Restore cached EdgeDB CLI binaries | |
uses: actions/cache@v3 | |
id: cli-cache | |
with: | |
path: build/cli | |
key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} | |
- name: Restore cached Rust extensions | |
uses: actions/cache@v3 | |
id: rust-cache | |
with: | |
path: build/rust_extensions | |
key: edb-rust-v3-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
- name: Restore cached Cython extensions | |
uses: actions/cache@v3 | |
id: ext-cache | |
with: | |
path: build/extensions | |
key: edb-ext-v4-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Restore compiled parsers cache | |
uses: actions/cache@v3 | |
id: parsers-cache | |
with: | |
path: build/lib | |
key: edb-parsers-v2-${{ hashFiles('.tmp/parsers_cache_key.txt') }} | |
- name: Restore cached PostgreSQL build | |
uses: actions/cache@v3 | |
id: postgres-cache | |
with: | |
path: build/postgres/install | |
key: edb-postgres-v2-${{ env.POSTGRES_GIT_REV }} | |
- name: Restore cached Stolon build | |
uses: actions/cache@v3 | |
id: stolon-cache | |
with: | |
path: build/stolon/bin | |
key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} | |
- name: Restore bootstrap cache | |
uses: actions/cache@v3 | |
id: bootstrap-cache | |
with: | |
path: build/cache | |
key: edb-bootstrap-v2-${{ hashFiles('.tmp/bootstrap_cache_key.txt') }} | |
- name: Stop if we cannot retrieve the cache | |
if: | | |
steps.venv-cache.outputs.cache-hit != 'true' || | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' || | |
steps.ext-cache.outputs.cache-hit != 'true' || | |
steps.parsers-cache.outputs.cache-hit != 'true' || | |
steps.postgres-cache.outputs.cache-hit != 'true' || | |
steps.stolon-cache.outputs.cache-hit != 'true' || | |
steps.bootstrap-cache.outputs.cache-hit != 'true' | |
run: | | |
echo ::error::Cannot retrieve build cache. | |
exit 1 | |
- name: Restore cache into the source tree | |
run: | | |
cp -v build/cli/bin/edgedb edb/cli/edgedb | |
rsync -av ./build/rust_extensions/edb/ ./edb/ | |
rsync -av ./build/extensions/edb/ ./edb/ | |
rsync -av ./build/lib/edb/ ./edb/ | |
cp build/postgres/install/stamp build/postgres/ | |
rsync -av $VIRTUAL_ENV/edgedb_server.egg-info/ ./edgedb_server.egg-info/ | |
# Run the test | |
- name: Test | |
env: | |
EDGEDB_TEST_BACKEND_DSN: postgres://edbtest:${{ secrets.AWS_RDS_PASSWORD }}@${{ needs.setup-aws-rds.outputs.pghost }}/postgres | |
run: | | |
edb server --bootstrap-only --backend-dsn=$EDGEDB_TEST_BACKEND_DSN --testmode | |
edb test -j2 -v --backend-dsn=$EDGEDB_TEST_BACKEND_DSN | |
teardown-aws-rds: | |
runs-on: ubuntu-latest | |
needs: test-aws-rds | |
if: ${{ always() }} | |
defaults: | |
run: | |
working-directory: .github/aws-rds | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: aws-rds-tfstate | |
path: .github/aws-rds | |
- name: Destroy AWS RDS | |
run: terraform destroy -auto-approve | |
env: | |
TF_VAR_sg_id: ${{ secrets.AWS_SECURITY_GROUP }} | |
TF_VAR_password: ${{ secrets.AWS_RDS_PASSWORD }} | |
- name: Overwrite Terraform state | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aws-rds-tfstate | |
path: .github/aws-rds/terraform.tfstate | |
retention-days: 1 | |
setup-do-database: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: .github/do-database | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Setup DigitalOcean Database | |
env: | |
TF_VAR_do_token: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
run: | | |
terraform apply -auto-approve | |
- name: Store Terraform state | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: do-database-tfstate | |
path: .github/do-database/terraform.tfstate | |
retention-days: 1 | |
test-do-database: | |
runs-on: ubuntu-latest | |
needs: [setup-do-database, build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.3' | |
- name: Handle virtualenv | |
uses: syphar/restore-virtualenv@v1 | |
id: venv-cache | |
with: | |
requirement_files: | | |
setup.py | |
pyproject.toml | |
custom_cache_key_element: v2 | |
# Restore the artifacts and environment variables | |
- name: Download shared artifacts | |
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 | |
with: | |
action: actions/download-artifact@v3 | |
with: | | |
name: shared-artifacts | |
path: .tmp | |
- name: Set environment variables | |
run: | | |
echo EDGEDBCLI_GIT_REV=$(cat .tmp/edgedbcli_git_rev.txt) >> $GITHUB_ENV | |
echo POSTGRES_GIT_REV=$(cat .tmp/postgres_git_rev.txt) >> $GITHUB_ENV | |
echo STOLON_GIT_REV=$(cat .tmp/stolon_git_rev.txt) >> $GITHUB_ENV | |
echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV | |
echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV | |
# Restore build cache | |
- name: Restore cached EdgeDB CLI binaries | |
uses: actions/cache@v3 | |
id: cli-cache | |
with: | |
path: build/cli | |
key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} | |
- name: Restore cached Rust extensions | |
uses: actions/cache@v3 | |
id: rust-cache | |
with: | |
path: build/rust_extensions | |
key: edb-rust-v3-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
- name: Restore cached Cython extensions | |
uses: actions/cache@v3 | |
id: ext-cache | |
with: | |
path: build/extensions | |
key: edb-ext-v4-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Restore compiled parsers cache | |
uses: actions/cache@v3 | |
id: parsers-cache | |
with: | |
path: build/lib | |
key: edb-parsers-v2-${{ hashFiles('.tmp/parsers_cache_key.txt') }} | |
- name: Restore cached PostgreSQL build | |
uses: actions/cache@v3 | |
id: postgres-cache | |
with: | |
path: build/postgres/install | |
key: edb-postgres-v2-${{ env.POSTGRES_GIT_REV }} | |
- name: Restore cached Stolon build | |
uses: actions/cache@v3 | |
id: stolon-cache | |
with: | |
path: build/stolon/bin | |
key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} | |
- name: Restore bootstrap cache | |
uses: actions/cache@v3 | |
id: bootstrap-cache | |
with: | |
path: build/cache | |
key: edb-bootstrap-v2-${{ hashFiles('.tmp/bootstrap_cache_key.txt') }} | |
- name: Stop if we cannot retrieve the cache | |
if: | | |
steps.venv-cache.outputs.cache-hit != 'true' || | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' || | |
steps.ext-cache.outputs.cache-hit != 'true' || | |
steps.parsers-cache.outputs.cache-hit != 'true' || | |
steps.postgres-cache.outputs.cache-hit != 'true' || | |
steps.stolon-cache.outputs.cache-hit != 'true' || | |
steps.bootstrap-cache.outputs.cache-hit != 'true' | |
run: | | |
echo ::error::Cannot retrieve build cache. | |
exit 1 | |
- name: Restore cache into the source tree | |
run: | | |
cp -v build/cli/bin/edgedb edb/cli/edgedb | |
rsync -av ./build/rust_extensions/edb/ ./edb/ | |
rsync -av ./build/extensions/edb/ ./edb/ | |
rsync -av ./build/lib/edb/ ./edb/ | |
cp build/postgres/install/stamp build/postgres/ | |
rsync -av $VIRTUAL_ENV/edgedb_server.egg-info/ ./edgedb_server.egg-info/ | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Initialize Terraform | |
working-directory: .github/do-database | |
run: terraform init | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: do-database-tfstate | |
path: .github/do-database | |
- name: Get Database host | |
id: pghost | |
working-directory: .github/do-database | |
run: | | |
terraform output -raw db_instance_address | |
- name: Get Database port | |
id: pgport | |
working-directory: .github/do-database | |
run: | | |
terraform output -raw db_instance_port | |
- name: Get Database user | |
id: pguser | |
working-directory: .github/do-database | |
run: | | |
terraform output -raw db_instance_user | |
- name: Get Database password | |
id: pgpass | |
working-directory: .github/do-database | |
run: | | |
terraform output -raw db_instance_password | |
- name: Get Database dbname | |
id: pgdatabase | |
working-directory: .github/do-database | |
run: | | |
terraform output -raw db_instance_database | |
# Run the test | |
- name: Test | |
env: | |
EDGEDB_TEST_BACKEND_DSN: postgres://${{ steps.pguser.outputs.stdout }}:${{ steps.pgpass.outputs.stdout }}@${{ steps.pghost.outputs.stdout }}:${{ steps.pgport.outputs.stdout }}/${{ steps.pgdatabase.outputs.stdout }} | |
run: | | |
edb server --bootstrap-only --backend-dsn=$EDGEDB_TEST_BACKEND_DSN --testmode | |
edb test -j2 -v --backend-dsn=$EDGEDB_TEST_BACKEND_DSN | |
teardown-do-database: | |
runs-on: ubuntu-latest | |
needs: test-do-database | |
if: ${{ always() }} | |
defaults: | |
run: | |
working-directory: .github/do-database | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: do-database-tfstate | |
path: .github/do-database | |
- name: Destroy DigitalOcean Database | |
run: terraform destroy -auto-approve | |
env: | |
TF_VAR_do_token: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
- name: Overwrite Terraform state | |
uses: actions/upload-artifact@v3 | |
with: | |
name: do-database-tfstate | |
path: .github/do-database/terraform.tfstate | |
retention-days: 1 | |
setup-gcp-cloud-sql: | |
runs-on: ubuntu-latest | |
outputs: | |
pghost: ${{ steps.pghost.outputs.stdout }} | |
defaults: | |
run: | |
working-directory: .github/gcp-cloud-sql | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure GCP Credentials | |
uses: google-github-actions/setup-gcloud@main | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- name: Setup GCP Cloud SQL | |
env: | |
TF_VAR_password: ${{ secrets.AWS_RDS_PASSWORD }} | |
run: | | |
terraform apply -auto-approve | |
- name: Store Terraform state | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gcp-cloud-sql-tfstate | |
path: .github/gcp-cloud-sql/terraform.tfstate | |
retention-days: 1 | |
- name: Get Cloud SQL host | |
id: pghost | |
run: | | |
terraform output -raw db_instance_address | |
test-gcp-cloud-sql: | |
runs-on: ubuntu-latest | |
needs: [setup-gcp-cloud-sql, build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.3' | |
- name: Handle virtualenv | |
uses: syphar/restore-virtualenv@v1 | |
id: venv-cache | |
with: | |
requirement_files: | | |
setup.py | |
pyproject.toml | |
custom_cache_key_element: v2 | |
# Restore the artifacts and environment variables | |
- name: Download shared artifacts | |
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 | |
with: | |
action: actions/download-artifact@v3 | |
with: | | |
name: shared-artifacts | |
path: .tmp | |
- name: Set environment variables | |
run: | | |
echo EDGEDBCLI_GIT_REV=$(cat .tmp/edgedbcli_git_rev.txt) >> $GITHUB_ENV | |
echo POSTGRES_GIT_REV=$(cat .tmp/postgres_git_rev.txt) >> $GITHUB_ENV | |
echo STOLON_GIT_REV=$(cat .tmp/stolon_git_rev.txt) >> $GITHUB_ENV | |
echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV | |
echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV | |
# Restore build cache | |
- name: Restore cached EdgeDB CLI binaries | |
uses: actions/cache@v3 | |
id: cli-cache | |
with: | |
path: build/cli | |
key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} | |
- name: Restore cached Rust extensions | |
uses: actions/cache@v3 | |
id: rust-cache | |
with: | |
path: build/rust_extensions | |
key: edb-rust-v3-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
- name: Restore cached Cython extensions | |
uses: actions/cache@v3 | |
id: ext-cache | |
with: | |
path: build/extensions | |
key: edb-ext-v4-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Restore compiled parsers cache | |
uses: actions/cache@v3 | |
id: parsers-cache | |
with: | |
path: build/lib | |
key: edb-parsers-v2-${{ hashFiles('.tmp/parsers_cache_key.txt') }} | |
- name: Restore cached PostgreSQL build | |
uses: actions/cache@v3 | |
id: postgres-cache | |
with: | |
path: build/postgres/install | |
key: edb-postgres-v2-${{ env.POSTGRES_GIT_REV }} | |
- name: Restore cached Stolon build | |
uses: actions/cache@v3 | |
id: stolon-cache | |
with: | |
path: build/stolon/bin | |
key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} | |
- name: Restore bootstrap cache | |
uses: actions/cache@v3 | |
id: bootstrap-cache | |
with: | |
path: build/cache | |
key: edb-bootstrap-v2-${{ hashFiles('.tmp/bootstrap_cache_key.txt') }} | |
- name: Stop if we cannot retrieve the cache | |
if: | | |
steps.venv-cache.outputs.cache-hit != 'true' || | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' || | |
steps.ext-cache.outputs.cache-hit != 'true' || | |
steps.parsers-cache.outputs.cache-hit != 'true' || | |
steps.postgres-cache.outputs.cache-hit != 'true' || | |
steps.stolon-cache.outputs.cache-hit != 'true' || | |
steps.bootstrap-cache.outputs.cache-hit != 'true' | |
run: | | |
echo ::error::Cannot retrieve build cache. | |
exit 1 | |
- name: Restore cache into the source tree | |
run: | | |
cp -v build/cli/bin/edgedb edb/cli/edgedb | |
rsync -av ./build/rust_extensions/edb/ ./edb/ | |
rsync -av ./build/extensions/edb/ ./edb/ | |
rsync -av ./build/lib/edb/ ./edb/ | |
cp build/postgres/install/stamp build/postgres/ | |
rsync -av $VIRTUAL_ENV/edgedb_server.egg-info/ ./edgedb_server.egg-info/ | |
# Run the test | |
- name: Test | |
env: | |
EDGEDB_TEST_BACKEND_DSN: postgres://postgres:${{ secrets.AWS_RDS_PASSWORD }}@${{ needs.setup-gcp-cloud-sql.outputs.pghost }}/postgres | |
run: | | |
edb server --bootstrap-only --backend-dsn=$EDGEDB_TEST_BACKEND_DSN --testmode | |
edb test -j2 -v --backend-dsn=$EDGEDB_TEST_BACKEND_DSN | |
teardown-gcp-cloud-sql: | |
runs-on: ubuntu-latest | |
needs: test-gcp-cloud-sql | |
if: ${{ always() }} | |
defaults: | |
run: | |
working-directory: .github/gcp-cloud-sql | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure GCP Credentials | |
uses: google-github-actions/setup-gcloud@main | |
with: | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: gcp-cloud-sql-tfstate | |
path: .github/gcp-cloud-sql | |
- name: Destroy GCP Cloud SQL | |
run: terraform destroy -auto-approve | |
env: | |
TF_VAR_password: ${{ secrets.AWS_RDS_PASSWORD }} | |
- name: Overwrite Terraform state | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gcp-cloud-sql-tfstate | |
path: .github/gcp-cloud-sql/terraform.tfstate | |
retention-days: 1 | |
setup-aws-aurora: | |
runs-on: ubuntu-latest | |
outputs: | |
pghost: ${{ steps.pghost.outputs.stdout }} | |
defaults: | |
run: | |
working-directory: .github/aws-aurora | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Setup AWS RDS Aurora | |
env: | |
TF_VAR_sg_id: ${{ secrets.AWS_SECURITY_GROUP }} | |
TF_VAR_password: ${{ secrets.AWS_RDS_PASSWORD }} | |
TF_VAR_vpc_id: ${{ secrets.AWS_VPC_ID }} | |
run: | | |
terraform apply -auto-approve | |
- name: Store Terraform state | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aws-aurora-tfstate | |
path: .github/aws-aurora/terraform.tfstate | |
retention-days: 1 | |
- name: Get RDS Aurora host | |
id: pghost | |
run: | | |
terraform output -raw rds_cluster_endpoint | |
test-aws-aurora: | |
runs-on: ubuntu-latest | |
needs: [setup-aws-aurora, build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.3' | |
- name: Handle virtualenv | |
uses: syphar/restore-virtualenv@v1 | |
id: venv-cache | |
with: | |
requirement_files: | | |
setup.py | |
pyproject.toml | |
custom_cache_key_element: v2 | |
# Restore the artifacts and environment variables | |
- name: Download shared artifacts | |
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 | |
with: | |
action: actions/download-artifact@v3 | |
with: | | |
name: shared-artifacts | |
path: .tmp | |
- name: Set environment variables | |
run: | | |
echo EDGEDBCLI_GIT_REV=$(cat .tmp/edgedbcli_git_rev.txt) >> $GITHUB_ENV | |
echo POSTGRES_GIT_REV=$(cat .tmp/postgres_git_rev.txt) >> $GITHUB_ENV | |
echo STOLON_GIT_REV=$(cat .tmp/stolon_git_rev.txt) >> $GITHUB_ENV | |
echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV | |
echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV | |
# Restore build cache | |
- name: Restore cached EdgeDB CLI binaries | |
uses: actions/cache@v3 | |
id: cli-cache | |
with: | |
path: build/cli | |
key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} | |
- name: Restore cached Rust extensions | |
uses: actions/cache@v3 | |
id: rust-cache | |
with: | |
path: build/rust_extensions | |
key: edb-rust-v3-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
- name: Restore cached Cython extensions | |
uses: actions/cache@v3 | |
id: ext-cache | |
with: | |
path: build/extensions | |
key: edb-ext-v4-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Restore compiled parsers cache | |
uses: actions/cache@v3 | |
id: parsers-cache | |
with: | |
path: build/lib | |
key: edb-parsers-v2-${{ hashFiles('.tmp/parsers_cache_key.txt') }} | |
- name: Restore cached PostgreSQL build | |
uses: actions/cache@v3 | |
id: postgres-cache | |
with: | |
path: build/postgres/install | |
key: edb-postgres-v2-${{ env.POSTGRES_GIT_REV }} | |
- name: Restore cached Stolon build | |
uses: actions/cache@v3 | |
id: stolon-cache | |
with: | |
path: build/stolon/bin | |
key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} | |
- name: Restore bootstrap cache | |
uses: actions/cache@v3 | |
id: bootstrap-cache | |
with: | |
path: build/cache | |
key: edb-bootstrap-v2-${{ hashFiles('.tmp/bootstrap_cache_key.txt') }} | |
- name: Stop if we cannot retrieve the cache | |
if: | | |
steps.venv-cache.outputs.cache-hit != 'true' || | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' || | |
steps.ext-cache.outputs.cache-hit != 'true' || | |
steps.parsers-cache.outputs.cache-hit != 'true' || | |
steps.postgres-cache.outputs.cache-hit != 'true' || | |
steps.stolon-cache.outputs.cache-hit != 'true' || | |
steps.bootstrap-cache.outputs.cache-hit != 'true' | |
run: | | |
echo ::error::Cannot retrieve build cache. | |
exit 1 | |
- name: Restore cache into the source tree | |
run: | | |
cp -v build/cli/bin/edgedb edb/cli/edgedb | |
rsync -av ./build/rust_extensions/edb/ ./edb/ | |
rsync -av ./build/extensions/edb/ ./edb/ | |
rsync -av ./build/lib/edb/ ./edb/ | |
cp build/postgres/install/stamp build/postgres/ | |
rsync -av $VIRTUAL_ENV/edgedb_server.egg-info/ ./edgedb_server.egg-info/ | |
# Run the test | |
- name: Test | |
env: | |
EDGEDB_TEST_BACKEND_DSN: postgres://edbtest:${{ secrets.AWS_RDS_PASSWORD }}@${{ needs.setup-aws-aurora.outputs.pghost }}/postgres | |
run: | | |
edb server --bootstrap-only --backend-dsn=$EDGEDB_TEST_BACKEND_DSN --testmode | |
edb test -j1 -v --backend-dsn=$EDGEDB_TEST_BACKEND_DSN | |
teardown-aws-aurora: | |
runs-on: ubuntu-latest | |
needs: test-aws-aurora | |
if: ${{ always() }} | |
defaults: | |
run: | |
working-directory: .github/aws-aurora | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: aws-aurora-tfstate | |
path: .github/aws-aurora | |
- name: Destroy AWS RDS Aurora | |
run: terraform destroy -auto-approve | |
env: | |
TF_VAR_sg_id: ${{ secrets.AWS_SECURITY_GROUP }} | |
TF_VAR_password: ${{ secrets.AWS_RDS_PASSWORD }} | |
TF_VAR_vpc_id: ${{ secrets.AWS_VPC_ID }} | |
- name: Overwrite Terraform state | |
uses: actions/upload-artifact@v3 | |
with: | |
name: aws-aurora-tfstate | |
path: .github/aws-aurora/terraform.tfstate | |
retention-days: 1 | |
setup-heroku-postgres: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: .github/heroku-postgres | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Setup Heroku Postgres | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }} | |
run: | | |
terraform apply -auto-approve | |
- name: Store Terraform state | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: heroku-postgres-tfstate | |
path: .github/heroku-postgres/terraform.tfstate | |
retention-days: 1 | |
test-heroku-postgres: | |
runs-on: ubuntu-latest | |
needs: [setup-heroku-postgres, build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.3' | |
- name: Handle virtualenv | |
uses: syphar/restore-virtualenv@v1 | |
id: venv-cache | |
with: | |
requirement_files: | | |
setup.py | |
pyproject.toml | |
custom_cache_key_element: v2 | |
# Restore the artifacts and environment variables | |
- name: Download shared artifacts | |
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0 | |
with: | |
action: actions/download-artifact@v3 | |
with: | | |
name: shared-artifacts | |
path: .tmp | |
- name: Set environment variables | |
run: | | |
echo EDGEDBCLI_GIT_REV=$(cat .tmp/edgedbcli_git_rev.txt) >> $GITHUB_ENV | |
echo POSTGRES_GIT_REV=$(cat .tmp/postgres_git_rev.txt) >> $GITHUB_ENV | |
echo STOLON_GIT_REV=$(cat .tmp/stolon_git_rev.txt) >> $GITHUB_ENV | |
echo BUILD_LIB=$(python setup.py -q ci_helper --type build_lib) >> $GITHUB_ENV | |
echo BUILD_TEMP=$(python setup.py -q ci_helper --type build_temp) >> $GITHUB_ENV | |
# Restore build cache | |
- name: Restore cached EdgeDB CLI binaries | |
uses: actions/cache@v3 | |
id: cli-cache | |
with: | |
path: build/cli | |
key: edb-cli-v3-${{ env.EDGEDBCLI_GIT_REV }} | |
- name: Restore cached Rust extensions | |
uses: actions/cache@v3 | |
id: rust-cache | |
with: | |
path: build/rust_extensions | |
key: edb-rust-v3-${{ hashFiles('.tmp/rust_cache_key.txt') }} | |
- name: Restore cached Cython extensions | |
uses: actions/cache@v3 | |
id: ext-cache | |
with: | |
path: build/extensions | |
key: edb-ext-v4-${{ hashFiles('.tmp/ext_cache_key.txt') }} | |
- name: Restore compiled parsers cache | |
uses: actions/cache@v3 | |
id: parsers-cache | |
with: | |
path: build/lib | |
key: edb-parsers-v2-${{ hashFiles('.tmp/parsers_cache_key.txt') }} | |
- name: Restore cached PostgreSQL build | |
uses: actions/cache@v3 | |
id: postgres-cache | |
with: | |
path: build/postgres/install | |
key: edb-postgres-v2-${{ env.POSTGRES_GIT_REV }} | |
- name: Restore cached Stolon build | |
uses: actions/cache@v3 | |
id: stolon-cache | |
with: | |
path: build/stolon/bin | |
key: edb-stolon-v2-${{ env.STOLON_GIT_REV }} | |
- name: Restore bootstrap cache | |
uses: actions/cache@v3 | |
id: bootstrap-cache | |
with: | |
path: build/cache | |
key: edb-bootstrap-v2-${{ hashFiles('.tmp/bootstrap_cache_key.txt') }} | |
- name: Stop if we cannot retrieve the cache | |
if: | | |
steps.venv-cache.outputs.cache-hit != 'true' || | |
steps.cli-cache.outputs.cache-hit != 'true' || | |
steps.rust-cache.outputs.cache-hit != 'true' || | |
steps.ext-cache.outputs.cache-hit != 'true' || | |
steps.parsers-cache.outputs.cache-hit != 'true' || | |
steps.postgres-cache.outputs.cache-hit != 'true' || | |
steps.stolon-cache.outputs.cache-hit != 'true' || | |
steps.bootstrap-cache.outputs.cache-hit != 'true' | |
run: | | |
echo ::error::Cannot retrieve build cache. | |
exit 1 | |
- name: Restore cache into the source tree | |
run: | | |
cp -v build/cli/bin/edgedb edb/cli/edgedb | |
rsync -av ./build/rust_extensions/edb/ ./edb/ | |
rsync -av ./build/extensions/edb/ ./edb/ | |
rsync -av ./build/lib/edb/ ./edb/ | |
cp build/postgres/install/stamp build/postgres/ | |
rsync -av $VIRTUAL_ENV/edgedb_server.egg-info/ ./edgedb_server.egg-info/ | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v1 | |
- name: Initialize Terraform | |
working-directory: .github/heroku-postgres | |
run: terraform init | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: heroku-postgres-tfstate | |
path: .github/heroku-postgres | |
- name: Get Heroku Postgres DSN | |
id: pgdsn | |
working-directory: .github/heroku-postgres | |
run: | | |
terraform output -raw heroku_postgres_dsn | |
# Run the test | |
- name: Test | |
env: | |
EDGEDB_TEST_BACKEND_VENDOR: heroku-postgres | |
EDGEDB_TEST_BACKEND_DSN: ${{ steps.pgdsn.outputs.stdout }} | |
run: | | |
edb server --bootstrap-only --backend-dsn=$EDGEDB_TEST_BACKEND_DSN --testmode | |
edb test -j1 -v --backend-dsn=$EDGEDB_TEST_BACKEND_DSN | |
teardown-heroku-postgres: | |
runs-on: ubuntu-latest | |
needs: test-heroku-postgres | |
if: ${{ always() }} | |
defaults: | |
run: | |
working-directory: .github/heroku-postgres | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: false | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Initialize Terraform | |
run: terraform init | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Restore Terraform state | |
uses: actions/download-artifact@v3 | |
with: | |
name: heroku-postgres-tfstate | |
path: .github/heroku-postgres | |
- name: Destroy Heroku Postgres | |
run: terraform destroy -auto-approve | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }} | |
- name: Overwrite Terraform state | |
uses: actions/upload-artifact@v3 | |
with: | |
name: heroku-postgres-tfstate | |
path: .github/heroku-postgres/terraform.tfstate | |
retention-days: 1 | |
workflow-notifications: | |
if: failure() && github.event_name != 'pull_request' | |
name: Notify in Slack on failures | |
needs: | |
- setup-aws-rds | |
- test-aws-rds | |
- teardown-aws-rds | |
- setup-do-database | |
- test-do-database | |
- teardown-do-database | |
- setup-gcp-cloud-sql | |
- test-gcp-cloud-sql | |
- teardown-gcp-cloud-sql | |
- setup-aws-aurora | |
- test-aws-aurora | |
- teardown-aws-aurora | |
- setup-heroku-postgres | |
- test-heroku-postgres | |
- teardown-heroku-postgres | |
runs-on: ubuntu-latest | |
permissions: | |
actions: 'read' | |
steps: | |
- name: Slack Workflow Notification | |
uses: Gamesight/slack-workflow-status@26a36836c887f260477432e4314ec3490a84f309 | |
with: | |
repo_token: ${{secrets.GITHUB_TOKEN}} | |
slack_webhook_url: ${{secrets.ACTIONS_SLACK_WEBHOOK_URL}} | |
name: 'Workflow notifications' | |
icon_emoji: ':hammer:' | |
include_jobs: 'on-failure' |