Merge pull request #239 from pynbody/mysql-optimize #604
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: Build and Test | |
on: [push] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.9, "3.10", "3.11", "3.12"] | |
sqlalchemy-version: ["1.4", "2.0"] | |
numpy-version: ["1.22", "1.26"] | |
TANGOS_TESTING_DB_BACKEND: [sqlite, mysql+pymysql, postgresql+psycopg2] | |
exclude: | |
- python-version: "3.12" | |
sqlalchemy-version: "1.4" | |
- python-version: "3.12" | |
numpy-version: "1.22" | |
runs-on: ${{ matrix.os }} | |
env: | |
C: gcc-10 | |
CXX: g++-10 | |
TANGOS_TESTING_DB_USER: root | |
TANGOS_TESTING_DB_PASSWORD: root | |
TANGOS_TESTING_DB_BACKEND: ${{ matrix.TANGOS_TESTING_DB_BACKEND }} | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: root | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/checkout@v2 | |
- name: Install gcc | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update -qq | |
sudo apt install gcc-10 g++-10 | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install numpy~=${{ matrix.numpy-version}} sqlalchemy~=${{ matrix.sqlalchemy-version}} | |
- name: Build and install tangos | |
run: | | |
pip install -e .[test,rmdbs] | |
- name: Check that tangos can import without pynbody | |
run: | | |
python -c "import tangos" | |
- name: Install pynbody and yt | |
run: python -m pip install pynbody yt --no-build-isolation | |
- name: Set up MySQL | |
if: ${{ matrix.TANGOS_TESTING_DB_BACKEND == 'mysql+pymysql' }} | |
run: | | |
sudo /etc/init.d/mysql start | |
- name: Run all tests | |
working-directory: tests | |
run: python -m pytest |