Fix query test for sqlite #953
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: Data Registry CI | |
on: | |
- push | |
- pull_request | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
# Service containers to run with `runner-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: desc_data_registry | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# Our strategy lists the OS and Python versions we want to test on. | |
strategy: | |
# Don't quit all jobs if only one job fails. | |
fail-fast: false | |
matrix: | |
python-version: ["3.12"] | |
include: | |
- python-version: "3.9" | |
if: github.event_name == 'pull_request' | |
- python-version: "3.10" | |
if: github.event_name == 'pull_request' | |
- python-version: "3.11" | |
if: github.event_name == 'pull_request' | |
# Our CI steps for this job. | |
steps: | |
# Check out this repository code. | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Install Python. | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install our package. | |
- name: Install dataregistry | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install pytest | |
# GitPython is needed when creating a new database | |
- name: Install GitPython | |
run: | | |
python -m pip install GitPython | |
# Make a dummy config file. | |
- name: Create dummy config file | |
run: | | |
echo "sqlalchemy.url : postgresql://postgres:postgres@localhost:5432/desc_data_registry" > $HOME/.config_reg_access | |
# Create schemas | |
- name: Create data registry schemas | |
run: | | |
python scripts/create_registry_schema.py --config $HOME/.config_reg_access --create_both | |
# Run CI tests | |
- name: Run CI tests | |
run: | | |
pytest -v -s tests/unit_tests | |
end-to-end-tests: | |
runs-on: ubuntu-latest | |
env: | |
DATAREG_CONFIG: "${{ github.workspace }}/config.txt" | |
DATAREG_BACKEND: "postgres" | |
# Service containers to run with `runner-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: desc_data_registry | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# Our strategy lists the OS and Python versions we want to test on. | |
strategy: | |
# Don't quit all jobs if only one job fails. | |
fail-fast: false | |
matrix: | |
python-version: ["3.12"] | |
include: | |
- python-version: "3.9" | |
if: github.event_name == 'pull_request' | |
- python-version: "3.10" | |
if: github.event_name == 'pull_request' | |
- python-version: "3.11" | |
if: github.event_name == 'pull_request' | |
# Our CI steps for this job. | |
steps: | |
# Check out this repository code. | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Install Python. | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install our package. | |
- name: Install dataregistry | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install pytest | |
# GitPython is needed when creating a new database | |
- name: Install GitPython | |
run: | | |
python -m pip install GitPython | |
# Make a dummy config file. | |
- name: Create dummy config file | |
run: | | |
echo "sqlalchemy.url : postgresql://postgres:postgres@localhost:5432/desc_data_registry" > $DATAREG_CONFIG | |
# Create schemas | |
- name: Create data registry schemas | |
run: | | |
python scripts/create_registry_schema.py --config $DATAREG_CONFIG --create_both | |
# Run CI tests | |
- name: Run CI tests | |
run: | | |
cd tests/end_to_end_tests | |
# Run some test queries | |
pytest -v test_*.py | |
sqlite-end-to-end-tests: | |
runs-on: ubuntu-latest | |
env: | |
DATAREG_CONFIG: "${{ github.workspace }}/config.txt" | |
DATAREG_BACKEND: "sqlite" | |
# Our strategy lists the OS and Python versions we want to test on. | |
strategy: | |
# Don't quit all jobs if only one job fails. | |
fail-fast: false | |
matrix: | |
python-version: ["3.12"] | |
include: | |
- python-version: "3.9" | |
if: github.event_name == 'pull_request' | |
- python-version: "3.10" | |
if: github.event_name == 'pull_request' | |
- python-version: "3.11" | |
if: github.event_name == 'pull_request' | |
# Our CI steps for this job. | |
steps: | |
# Check out this repository code. | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
# Install Python. | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install our package. | |
- name: Install dataregistry | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install pytest | |
# GitPython is needed when creating a new database | |
- name: Install GitPython | |
run: | | |
python -m pip install GitPython | |
# Make a dummy config file. | |
- name: Create dummy config file | |
run: | | |
echo "sqlalchemy.url : sqlite:///${HOME}/registry.db" > $DATAREG_CONFIG | |
# Create schema | |
- name: Create data registry default schema | |
run: | | |
python scripts/create_registry_schema.py --config $DATAREG_CONFIG | |
# Run CI tests | |
- name: Run CI tests | |
run: | | |
cd tests/end_to_end_tests | |
# Run some test queries | |
pytest -v -m "not skip" test_*.py |