From a11c724bcf8c72ab2711a7ab974020ea898995fe Mon Sep 17 00:00:00 2001 From: "Ching Yi, Chan" Date: Tue, 7 Nov 2023 16:07:55 +0800 Subject: [PATCH] Rearrange tests Signed-off-by: Ching Yi, Chan --- .github/workflows/tests.yaml | 9 +-------- .github/workflows/tox.yaml | 36 +++++++++++++++++++++++++++++++++++ Makefile | 1 - tox-ruamel.ini | 8 ++++++-- tox.ini => tox-sqlalchemy.ini | 17 +++++++---------- 5 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/tox.yaml rename tox.ini => tox-sqlalchemy.ini (52%) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 09661f5d7..aab0e065d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,22 +15,15 @@ on: jobs: build: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: [ '3.9', '3.10', '3.11' ] - sqlalchemy: [ "sqlalchemy>=1.4,<2.0", "sqlalchemy>=2.0" ] - steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.version }} + python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip - pip install "${{ matrix.sqlalchemy }}" if [ -f requirements.txt ]; then pip install -r requirements.txt; fi pip install -e '.[duckdb]' - name: Run tests diff --git a/.github/workflows/tox.yaml b/.github/workflows/tox.yaml new file mode 100644 index 000000000..77186ae0f --- /dev/null +++ b/.github/workflows/tox.yaml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Run tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install -e '.[duckdb]' + - name: Run tox-sqlalchemy + run: tox -c tox-sqlalchemy.ini + - name: Run tox-ruamel + run: tox -c tox-ruamel.ini + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index 9205ca833..f537992bb 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ flake8: test: dev-requires python3 -m pytest --cov=piperider_cli --cov-report html tests - tox -c tox-ruamel.ini pre-release: dev-requires pip install build diff --git a/tox-ruamel.ini b/tox-ruamel.ini index e5d0d9291..50836429f 100644 --- a/tox-ruamel.ini +++ b/tox-ruamel.ini @@ -1,6 +1,6 @@ [tox] env_list = - py-ruamel-{0.17.21,0.17.22} + py{38,39,310,311}-ruamel-{0.17.21,0.17.22} minversion = 4.7.0 [testenv] @@ -9,7 +9,10 @@ package = wheel wheel_build_env = .pkg basepython = - py: python3.11 + py38: python3.8 + py39: python3.9 + py310: python3.10 + py311: python3.11 deps = pytest>=6 @@ -18,6 +21,7 @@ deps = ruamel-0.17.21: ruamel.yaml<=0.17.21 ruamel-0.17.22: ruamel.yaml>0.17.21,<0.18 + commands = pytest {tty:--color=yes} {posargs} diff --git a/tox.ini b/tox-sqlalchemy.ini similarity index 52% rename from tox.ini rename to tox-sqlalchemy.ini index 5bb01bc80..a851345cf 100644 --- a/tox.ini +++ b/tox-sqlalchemy.ini @@ -1,7 +1,6 @@ [tox] env_list = - py38-dbt13 - py{39,310,311}-dbt{14,15,16} + py{38,39,310,311}-sqlalchemy-{14,20} minversion = 4.7.0 [testenv] @@ -13,17 +12,15 @@ basepython = py38: python3.8 py39: python3.9 py310: python3.10 + py311: python3.11 deps = pytest>=6 - py38-dbt13: dbt-core>=1.3,<1.4 - py38-dbt13: dbt-duckdb>=1.3,<1.4 - dbt14: dbt-core>=1.4,<1.5 - dbt14: dbt-duckdb>=1.4,<1.5 - dbt15: dbt-core>=1.5,<1.6 - dbt15: dbt-duckdb>=1.5,<1.6 - dbt16: dbt-core>=1.6,<1.7 - dbt16: dbt-duckdb>=1.6,<1.7 + dbt-core>=1.6,<1.7 + dbt-duckdb>=1.6,<1.7 + sqlalchemy-14: sqlalchemy>=1.4,<2.0 + sqlalchemy-20: sqlalchemy>=2.0 + commands = pytest {tty:--color=yes} {posargs}