Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use postgres service in gh actions #3785

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 69 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ jobs:
NUM_RUNNERS: ${{ matrix.num_runners }}
RUNNER_INDEX: ${{ matrix.runner_index }}

services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
nick-mobilecoin marked this conversation as resolved.
Show resolved Hide resolved
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4
Expand All @@ -258,8 +270,6 @@ jobs:
then
echo '-p mc-util-keyfile -p mc-util-generate-sample-ledger' >> /tmp/fog-test-packages
fi
- name: Start postgres
run: service postgresql start
- name: Run tests
uses: ./.github/actions/run-mc-tests
with:
Expand All @@ -270,20 +280,30 @@ jobs:
env:
# TEST_DATABASE_URL points at the server, as Fog recovery DB tests
# create and drop PG databases.
TEST_DATABASE_URL: postgres://localhost
TEST_DATABASE_URL: postgres://postgres@postgres


fog-ingest-tests:
runs-on: [self-hosted, Linux, large]
container: mobilecoin/builder-install:v0.0.32

services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Start postgres
run: service postgresql start
- name: Run tests
uses: ./.github/actions/run-mc-tests
with:
Expand All @@ -293,22 +313,32 @@ jobs:
env:
# TEST_DATABASE_URL points at the server, as Fog recovery DB tests
# create and drop PG databases.
TEST_DATABASE_URL: postgres://localhost
TEST_DATABASE_URL: postgres://postgres@postgres


fog-conformance-tests:
runs-on: [self-hosted, Linux, large]
container: mobilecoin/builder-install:v0.0.32

services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
# FIXME: This fails with Python 3.10: "AttributeError: module
# 'importlib' has no attribute 'abc'. Did you mean: '_abc'?"
python-version: '3.9'
python-version: '3'
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Set up environment
Expand All @@ -320,13 +350,11 @@ jobs:
pip install -r requirements.txt
./build.sh

service postgresql start
- name: fog_conformance_tests.py
working-directory: tools/fog-local-network
env:
# TEST_DATABASE_URL points at the server, as Fog recovery DB tests
# create and drop PG databases.
TEST_DATABASE_URL: postgres://localhost
PGHOST: postgres
PGUSER: postgres
run: |
. ./env/bin/activate
python3 fog_conformance_tests.py --release
Expand All @@ -340,6 +368,18 @@ jobs:
runs-on: [self-hosted, Linux, large]
container: mobilecoin/builder-install:v0.0.32

services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -397,12 +437,10 @@ jobs:
# Generate sample Fog keys.
"$BIN_DIR/sample-keys" --num 4 --output-dir fog_keys --fog-report-url 'insecure-fog://localhost:6200' --fog-authority-root "$FOG_AUTHORITY_ROOT"

service postgresql start
- name: Run local network
env:
# TEST_DATABASE_URL points at the server, as Fog recovery DB tests
# create and drop PG databases.
TEST_DATABASE_URL: postgres://localhost
PGHOST: postgres
PGUSER: postgres
run: |
BIN_DIR="$PWD/target/release"
SCRIPT_DIR="$PWD/tools/fog-local-network"
Expand Down Expand Up @@ -527,6 +565,18 @@ jobs:
runs-on: [self-hosted, Linux, large]
container: mobilecoin/builder-install:v0.0.32

services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down Expand Up @@ -584,12 +634,10 @@ jobs:
# Generate sample Fog keys.
"$BIN_DIR/sample-keys" --num 4 --output-dir fog_keys --fog-report-url 'insecure-fog://localhost:6200' --fog-authority-root "$FOG_AUTHORITY_ROOT"

service postgresql start
- name: Run local network
env:
# TEST_DATABASE_URL points at the server, as Fog recovery DB tests
# create and drop PG databases.
TEST_DATABASE_URL: postgres://localhost
PGHOST: postgres
PGUSER: postgres
run: |
BIN_DIR="$PWD/target/release"
SCRIPT_DIR="$PWD/tools/fog-local-network"
Expand Down
4 changes: 2 additions & 2 deletions tools/fog-local-network/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
grpcio==1.53.0
grpcio-tools==1.36.1
grpcio==1.60.0
grpcio-tools==1.60.0
Loading