diff --git a/.github/workflows/deploy_tests.yml b/.github/workflows/deploy_tests.yml index 27b893f1..01c0cb13 100644 --- a/.github/workflows/deploy_tests.yml +++ b/.github/workflows/deploy_tests.yml @@ -66,7 +66,7 @@ jobs: with: name: distributions path: dist/ - + - name: Run rsconnect-python Tests env: CONNECT_LICENSE: "${{ secrets.RSC_LICENSE }}" @@ -76,16 +76,17 @@ jobs: RSC_AUTOMATION_PAT: "${{ secrets.CONNECT_PAT }}" ADMIN_API_KEY: "${{ secrets.ADMIN_API_KEY }}" QUARTO_VERSION: "1.4.546" - # This allows us to start Connect separately in our own docker container CONNECT_SERVER: "http://localhost:3939" remote: "yes" run: | cd integration-testing - docker compose pull connect - docker compose up -d connect - just ../test/connect-rsconnect-python/test/rsconnect-python/test-rsconnect-python-repo - + docker compose build connect-cli + docker compose build client-cli + docker compose up -d connect-cli + docker compose up -d client-cli + docker-compose run --rm client-cli just ../test/connect-rsconnect-python/test/rsconnect-python/_start-dev + # Videos are captured whether the suite fails or passes - name: Save videos uses: actions/upload-artifact@v3 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a4c43d69..859daf86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -201,7 +201,7 @@ jobs: run: | pytest tests/test_main_system_caches.py pytest -m 'vetiver' - + test-jupyter: runs-on: ubuntu-latest env: @@ -218,14 +218,15 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Containers run: | - just integration-testing/build + cd integration-testing + docker compose build client + docker compose build cypress - name: Start Connect + rsconnect-jupyter run: | just integration-testing/up - + - name: Run Cypress Tests run: | - export ADMIN_API_KEY="${{ secrets.ADMIN_API_KEY }}" just integration-testing/up-cypress # Videos are captured whether the suite fails or passes diff --git a/integration-testing/docker-compose.yml b/integration-testing/docker-compose.yml index 1e418a0e..b60f9265 100644 --- a/integration-testing/docker-compose.yml +++ b/integration-testing/docker-compose.yml @@ -19,9 +19,51 @@ services: working_dir: /rsconnect-python/integration-testing entrypoint: '' + client-cli: + build: + context: ./docker + dockerfile: cli.Dockerfile + args: + QUARTO_VERSION: ${QUARTO_VERSION} + PY_VERSION: ${PY_VERSION} + volumes: + - ../:/rsconnect-python + working_dir: /rsconnect-python/integration-testing + network_mode: host + entrypoint: '' + environment: + QUARTO_VERSION: ${QUARTO_VERSION} + PY_VERSION: ${PY_VERSION} + API_KEY: ${ADMIN_API_KEY} + + # customized connect built with updated quarto version + # used for nightly deploy_tests.yml that include quarto projects + connect-cli: + hostname: connect-cli + image: rstudio/rstudio-connect:jammy + build: + context: ./docker + dockerfile: connect.Dockerfile + args: + QUARTO_VERSION: ${QUARTO_VERSION} + PY_VERSION: ${PY_VERSION} + restart: always + ports: + - 3939:3939 + volumes: + - $PWD/docker/rstudio-connect-cli.gcfg:/etc/rstudio-connect/rstudio-connect.gcfg + privileged: true + environment: + RSTUDIO_CONNECT_HASTE: "enabled" + RSC_LICENSE: ${CONNECT_LICENSE} + QUARTO_VERSION: ${QUARTO_VERSION} + PY_VERSION: ${PY_VERSION} + + # connect from public docker hub + # used jupyter-notebook and deploy tests in CI, main.yml connect: hostname: connect - image: rstudio/rstudio-connect:bionic + image: rstudio/rstudio-connect:jammy restart: always ports: - 3939:3939 @@ -32,6 +74,7 @@ services: RSTUDIO_CONNECT_HASTE: "enabled" RSC_LICENSE: ${CONNECT_LICENSE} + cypress: image: cypress/included:12.7.0 depends_on: diff --git a/integration-testing/docker/cli.Dockerfile b/integration-testing/docker/cli.Dockerfile new file mode 100644 index 00000000..7913e6b0 --- /dev/null +++ b/integration-testing/docker/cli.Dockerfile @@ -0,0 +1,45 @@ +ARG PY_VERSION=${PY_VERSION} +FROM python:${PY_VERSION} +COPY ./requirements.txt . +EXPOSE 9999 +VOLUME ../../:/rsconnect-python/ + +WORKDIR /rsconnect-python/integration-testing +ARG QUARTO_VERSION + +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + build-essential \ + curl \ + ca-certificates \ + git \ + sudo \ + vim \ + jq \ + wget + +RUN mkdir -p /libs-client && \ + curl -fsSL https://github.com/casey/just/releases/download/1.1.2/just-1.1.2-x86_64-unknown-linux-musl.tar.gz \ + | tar -C /libs-client -xz just + +ENV PATH=$PATH:/libs-client + +RUN git clone --depth=1 https://github.com/bats-core/bats-core.git /libs/bats-core \ + && cd /libs/bats-core \ + && ./install.sh /libs/bats-core/installation \ + && git clone --depth=1 https://github.com/bats-core/bats-support.git /libs/bats-support \ + && git clone --depth=1 https://github.com/bats-core/bats-file.git /libs/bats-file \ + && git clone --depth=1 https://github.com/bats-core/bats-assert.git /libs/bats-assert + +RUN curl -fsSL -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh \ + && chmod 755 miniconda.sh \ + && ./miniconda.sh -b -p /opt/miniconda \ + && rm -rf miniconda.sh + +RUN pip install rsconnect-jupyter --pre && \ + pip install pipenv && \ + jupyter-nbextension install --sys-prefix --py rsconnect_jupyter + +RUN curl -fsSLO https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz && \ + mkdir /opt/quarto && tar xf quarto-${QUARTO_VERSION}-linux-amd64.tar.gz -C /opt/quarto --strip-components 1 && \ + ( echo ""; echo 'export PATH=$PATH:/opt/quarto/bin' ; echo "" ) >> ~/.profile && \ + . ~/.profile \ No newline at end of file diff --git a/integration-testing/docker/connect.Dockerfile b/integration-testing/docker/connect.Dockerfile new file mode 100644 index 00000000..2d68f746 --- /dev/null +++ b/integration-testing/docker/connect.Dockerfile @@ -0,0 +1,7 @@ +FROM rstudio/rstudio-connect:jammy +ARG QUARTO_VERSION + +RUN curl -fsSLO https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz && \ + tar xf quarto-${QUARTO_VERSION}-linux-amd64.tar.gz -C /opt/quarto --strip-components 1 && \ + ( echo ""; echo 'export PATH=$PATH:/opt/quarto/bin' ; echo "" ) >> ~/.profile && \ + source ~/.profile diff --git a/integration-testing/docker/rstudio-connect-cli.gcfg b/integration-testing/docker/rstudio-connect-cli.gcfg new file mode 100644 index 00000000..54857433 --- /dev/null +++ b/integration-testing/docker/rstudio-connect-cli.gcfg @@ -0,0 +1,37 @@ +; Posit Connect test environment configuration + +[Server] +SenderEmail = testuser@testrsc.com +EmailProvider = print +DataDir = /connect-rsconnect-data +EnableSitemap = true +AllowConfirmedUsers = true +Address = http://localhost:3939 +JumpStartEnabled = false + +[HTTP] +Listen = :3939 +NoWarning = true + +[Python] +Enabled = true +Executable = /opt/python/3.8.17/bin/python +Executable = /opt/python/3.9.17/bin/python + +[Quarto] +Enabled = true +Executable = /opt/quarto/bin/quarto + +[Authentication] +BasicAuth = true +InsecureDefaultUserAPIKey = true +APIKeyBcryptCost = 4 + +[Authorization] +DefaultUserRole = "publisher" + +[Database] +SeedUsers = true + +[Mount] +BaseDir = /connect-rsconnect-mount diff --git a/integration-testing/docker/rstudio-connect.gcfg b/integration-testing/docker/rstudio-connect.gcfg index 564d6b80..e1550d09 100644 --- a/integration-testing/docker/rstudio-connect.gcfg +++ b/integration-testing/docker/rstudio-connect.gcfg @@ -15,8 +15,8 @@ NoWarning = true [Python] Enabled = true -Executable = /opt/python/3.8.10/bin/python -Executable = /opt/python/3.9.5/bin/python +Executable = /opt/python/3.8.17/bin/python +Executable = /opt/python/3.9.17/bin/python [Quarto] Enabled = true @@ -34,4 +34,4 @@ DefaultUserRole = "publisher" SeedUsers = true [Mount] -BaseDir = /connect-rsconnect-mount +BaseDir = /connect-rsconnect-mount \ No newline at end of file diff --git a/integration-testing/justfile b/integration-testing/justfile index c4512232..5e654997 100644 --- a/integration-testing/justfile +++ b/integration-testing/justfile @@ -1,5 +1,6 @@ export RSC_LICENSE := env_var_or_default("RSC_LICENSE", "$CONNECT_LICENSE") export ADMIN_API_KEY := env_var_or_default('ADMIN_API_KEY', "${ADMIN_API_KEY}") +export QUARTO_VERSION := env_var_or_default('QUARTO_VERSION', '1.4.546') all: @@ -14,7 +15,7 @@ up: docker compose up -d client && docker compose up -d connect up-cypress: - docker compose up --exit-code-from cypress + docker compose up cypress --exit-code-from cypress # use this target if you want to run Cypress # without shutting down all containers after each run