Skip to content

Commit a38baeb

Browse files
Merge pull request #564 from rstudio/kg-quarto-test
Use Dockerfile for tests
2 parents f4f61a0 + a71a5d0 commit a38baeb

File tree

8 files changed

+150
-15
lines changed

8 files changed

+150
-15
lines changed

.github/workflows/deploy_tests.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
with:
6767
name: distributions
6868
path: dist/
69-
69+
7070
- name: Run rsconnect-python Tests
7171
env:
7272
CONNECT_LICENSE: "${{ secrets.RSC_LICENSE }}"
@@ -76,16 +76,17 @@ jobs:
7676
RSC_AUTOMATION_PAT: "${{ secrets.CONNECT_PAT }}"
7777
ADMIN_API_KEY: "${{ secrets.ADMIN_API_KEY }}"
7878
QUARTO_VERSION: "1.4.546"
79-
8079
# This allows us to start Connect separately in our own docker container
8180
CONNECT_SERVER: "http://localhost:3939"
8281
remote: "yes"
8382
run: |
8483
cd integration-testing
85-
docker compose pull connect
86-
docker compose up -d connect
87-
just ../test/connect-rsconnect-python/test/rsconnect-python/test-rsconnect-python-repo
88-
84+
docker compose build connect-cli
85+
docker compose build client-cli
86+
docker compose up -d connect-cli
87+
docker compose up -d client-cli
88+
docker-compose run --rm client-cli just ../test/connect-rsconnect-python/test/rsconnect-python/_start-dev
89+
8990
# Videos are captured whether the suite fails or passes
9091
- name: Save videos
9192
uses: actions/upload-artifact@v3

.github/workflows/main.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ jobs:
201201
run: |
202202
pytest tests/test_main_system_caches.py
203203
pytest -m 'vetiver'
204-
204+
205205
test-jupyter:
206206
runs-on: ubuntu-latest
207207
env:
@@ -218,14 +218,15 @@ jobs:
218218
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
219219
- name: Build Containers
220220
run: |
221-
just integration-testing/build
221+
cd integration-testing
222+
docker compose build client
223+
docker compose build cypress
222224
- name: Start Connect + rsconnect-jupyter
223225
run: |
224226
just integration-testing/up
225-
227+
226228
- name: Run Cypress Tests
227229
run: |
228-
export ADMIN_API_KEY="${{ secrets.ADMIN_API_KEY }}"
229230
just integration-testing/up-cypress
230231
231232
# Videos are captured whether the suite fails or passes

integration-testing/docker-compose.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,51 @@ services:
1919
working_dir: /rsconnect-python/integration-testing
2020
entrypoint: ''
2121

22+
client-cli:
23+
build:
24+
context: ./docker
25+
dockerfile: cli.Dockerfile
26+
args:
27+
QUARTO_VERSION: ${QUARTO_VERSION}
28+
PY_VERSION: ${PY_VERSION}
29+
volumes:
30+
- ../:/rsconnect-python
31+
working_dir: /rsconnect-python/integration-testing
32+
network_mode: host
33+
entrypoint: ''
34+
environment:
35+
QUARTO_VERSION: ${QUARTO_VERSION}
36+
PY_VERSION: ${PY_VERSION}
37+
API_KEY: ${ADMIN_API_KEY}
38+
39+
# customized connect built with updated quarto version
40+
# used for nightly deploy_tests.yml that include quarto projects
41+
connect-cli:
42+
hostname: connect-cli
43+
image: rstudio/rstudio-connect:jammy
44+
build:
45+
context: ./docker
46+
dockerfile: connect.Dockerfile
47+
args:
48+
QUARTO_VERSION: ${QUARTO_VERSION}
49+
PY_VERSION: ${PY_VERSION}
50+
restart: always
51+
ports:
52+
- 3939:3939
53+
volumes:
54+
- $PWD/docker/rstudio-connect-cli.gcfg:/etc/rstudio-connect/rstudio-connect.gcfg
55+
privileged: true
56+
environment:
57+
RSTUDIO_CONNECT_HASTE: "enabled"
58+
RSC_LICENSE: ${CONNECT_LICENSE}
59+
QUARTO_VERSION: ${QUARTO_VERSION}
60+
PY_VERSION: ${PY_VERSION}
61+
62+
# connect from public docker hub
63+
# used jupyter-notebook and deploy tests in CI, main.yml
2264
connect:
2365
hostname: connect
24-
image: rstudio/rstudio-connect:bionic
66+
image: rstudio/rstudio-connect:jammy
2567
restart: always
2668
ports:
2769
- 3939:3939
@@ -32,6 +74,7 @@ services:
3274
RSTUDIO_CONNECT_HASTE: "enabled"
3375
RSC_LICENSE: ${CONNECT_LICENSE}
3476

77+
3578
cypress:
3679
image: cypress/included:12.7.0
3780
depends_on:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
ARG PY_VERSION=${PY_VERSION}
2+
FROM python:${PY_VERSION}
3+
COPY ./requirements.txt .
4+
EXPOSE 9999
5+
VOLUME ../../:/rsconnect-python/
6+
7+
WORKDIR /rsconnect-python/integration-testing
8+
ARG QUARTO_VERSION
9+
10+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
11+
build-essential \
12+
curl \
13+
ca-certificates \
14+
git \
15+
sudo \
16+
vim \
17+
jq \
18+
wget
19+
20+
RUN mkdir -p /libs-client && \
21+
curl -fsSL https://github.com/casey/just/releases/download/1.1.2/just-1.1.2-x86_64-unknown-linux-musl.tar.gz \
22+
| tar -C /libs-client -xz just
23+
24+
ENV PATH=$PATH:/libs-client
25+
26+
RUN git clone --depth=1 https://github.com/bats-core/bats-core.git /libs/bats-core \
27+
&& cd /libs/bats-core \
28+
&& ./install.sh /libs/bats-core/installation \
29+
&& git clone --depth=1 https://github.com/bats-core/bats-support.git /libs/bats-support \
30+
&& git clone --depth=1 https://github.com/bats-core/bats-file.git /libs/bats-file \
31+
&& git clone --depth=1 https://github.com/bats-core/bats-assert.git /libs/bats-assert
32+
33+
RUN curl -fsSL -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64.sh \
34+
&& chmod 755 miniconda.sh \
35+
&& ./miniconda.sh -b -p /opt/miniconda \
36+
&& rm -rf miniconda.sh
37+
38+
RUN pip install rsconnect-jupyter --pre && \
39+
pip install pipenv && \
40+
jupyter-nbextension install --sys-prefix --py rsconnect_jupyter
41+
42+
RUN curl -fsSLO https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz && \
43+
mkdir /opt/quarto && tar xf quarto-${QUARTO_VERSION}-linux-amd64.tar.gz -C /opt/quarto --strip-components 1 && \
44+
( echo ""; echo 'export PATH=$PATH:/opt/quarto/bin' ; echo "" ) >> ~/.profile && \
45+
. ~/.profile
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM rstudio/rstudio-connect:jammy
2+
ARG QUARTO_VERSION
3+
4+
RUN curl -fsSLO https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz && \
5+
tar xf quarto-${QUARTO_VERSION}-linux-amd64.tar.gz -C /opt/quarto --strip-components 1 && \
6+
( echo ""; echo 'export PATH=$PATH:/opt/quarto/bin' ; echo "" ) >> ~/.profile && \
7+
source ~/.profile
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; Posit Connect test environment configuration
2+
3+
[Server]
4+
SenderEmail = [email protected]
5+
EmailProvider = print
6+
DataDir = /connect-rsconnect-data
7+
EnableSitemap = true
8+
AllowConfirmedUsers = true
9+
Address = http://localhost:3939
10+
JumpStartEnabled = false
11+
12+
[HTTP]
13+
Listen = :3939
14+
NoWarning = true
15+
16+
[Python]
17+
Enabled = true
18+
Executable = /opt/python/3.8.17/bin/python
19+
Executable = /opt/python/3.9.17/bin/python
20+
21+
[Quarto]
22+
Enabled = true
23+
Executable = /opt/quarto/bin/quarto
24+
25+
[Authentication]
26+
BasicAuth = true
27+
InsecureDefaultUserAPIKey = true
28+
APIKeyBcryptCost = 4
29+
30+
[Authorization]
31+
DefaultUserRole = "publisher"
32+
33+
[Database]
34+
SeedUsers = true
35+
36+
[Mount]
37+
BaseDir = /connect-rsconnect-mount

integration-testing/docker/rstudio-connect.gcfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ NoWarning = true
1515

1616
[Python]
1717
Enabled = true
18-
Executable = /opt/python/3.8.10/bin/python
19-
Executable = /opt/python/3.9.5/bin/python
18+
Executable = /opt/python/3.8.17/bin/python
19+
Executable = /opt/python/3.9.17/bin/python
2020

2121
[Quarto]
2222
Enabled = true
@@ -34,4 +34,4 @@ DefaultUserRole = "publisher"
3434
SeedUsers = true
3535

3636
[Mount]
37-
BaseDir = /connect-rsconnect-mount
37+
BaseDir = /connect-rsconnect-mount

integration-testing/justfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export RSC_LICENSE := env_var_or_default("RSC_LICENSE", "$CONNECT_LICENSE")
22
export ADMIN_API_KEY := env_var_or_default('ADMIN_API_KEY', "${ADMIN_API_KEY}")
3+
export QUARTO_VERSION := env_var_or_default('QUARTO_VERSION', '1.4.546')
34

45

56
all:
@@ -14,7 +15,7 @@ up:
1415
docker compose up -d client && docker compose up -d connect
1516

1617
up-cypress:
17-
docker compose up --exit-code-from cypress
18+
docker compose up cypress --exit-code-from cypress
1819

1920
# use this target if you want to run Cypress
2021
# without shutting down all containers after each run

0 commit comments

Comments
 (0)