diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..92e9dd2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: CI + +on: + push: + branches: [ main, test ] + pull_request: + branches: [ main, test ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up R + uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.5.0' + use-public-rspm: true + + - name: Install R system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev + + - name: Install R dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: | + any::remotes + any::roxygen2 + any::testthat + any::devtools + + - name: Install qg package + run: | + R CMD INSTALL . + shell: bash + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: Install nox + run: | + uv tool install nox + + - name: Run tests with nox + run: | + cd config_tests + uvx nox -s tests diff --git a/config_tests/tests/conftest.py b/config_tests/tests/conftest.py index 64b7a7c..df7ae5b 100644 --- a/config_tests/tests/conftest.py +++ b/config_tests/tests/conftest.py @@ -5,6 +5,7 @@ import rpy2.robjects.pandas2ri from contextlib import contextmanager from inline_snapshot import snapshot +from pathlib import Path from rpy2.rinterface_lib.embedded import RRuntimeError from rpy2.robjects.packages import importr @@ -64,8 +65,9 @@ def qg_mod(): # Load devtools if needed devtools = importr("devtools") - # Load the development version from the specified path - devtools.load_all("/Users/leo/code/qg") + # Load the development version from the qg root + qg_root = Path(__file__).parents[2] + devtools.load_all(str(qg_root)) # Return the loaded module return importr("qg")