Skip to content

Commit 326ccdb

Browse files
nealrichardsontdsteinclaude
authored
ci: Use with-connect instead of bespoke integration test setup (#429)
Also bumps github action versions and adds latest Connect releases to the matrix. --------- Co-authored-by: tdstein <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Taylor Steinberg <[email protected]>
1 parent 5546854 commit 326ccdb

File tree

5 files changed

+50
-163
lines changed

5 files changed

+50
-163
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
lint:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- uses: astral-sh/setup-uv@v6
14+
- uses: actions/checkout@v5
15+
- uses: astral-sh/setup-uv@v7
1616
- run: uv python install
1717
- run: make dev
1818
- run: make lint
@@ -31,8 +31,8 @@ jobs:
3131
- "3.12"
3232
- "3.13"
3333
steps:
34-
- uses: actions/checkout@v4
35-
- uses: astral-sh/setup-uv@v6
34+
- uses: actions/checkout@v5
35+
- uses: astral-sh/setup-uv@v7
3636
- run: uv python install ${{ matrix.python-version }}
3737
- run: make dev
3838
- run: make test
@@ -58,16 +58,17 @@ jobs:
5858
matrix:
5959
CONNECT_VERSION: ${{ fromJson(needs.setup-integration-test.outputs.versions) }}
6060
steps:
61-
- uses: actions/checkout@v4
62-
- uses: docker/setup-buildx-action@v3
63-
- name: Write Posit Connect license to disk
64-
run: echo "$CONNECT_LICENSE" > ./integration/license.lic
65-
env:
66-
CONNECT_LICENSE: ${{ secrets.CONNECT_LICENSE }}
67-
- uses: astral-sh/setup-uv@v6
61+
- uses: actions/checkout@v5
62+
- uses: astral-sh/setup-uv@v7
6863
- run: uv python install
69-
- run: make -C ./integration ${{ matrix.CONNECT_VERSION }}
70-
- uses: actions/upload-artifact@v4
64+
- name: Run integration tests
65+
uses: posit-dev/with-connect@main
66+
with:
67+
version: ${{ matrix.CONNECT_VERSION }}
68+
license: ${{ secrets.CONNECT_LICENSE }}
69+
command:
70+
make -C ./integration test-${{ matrix.CONNECT_VERSION }}
71+
- uses: actions/upload-artifact@v5
7172
if: always()
7273
with:
7374
name: ${{ matrix.CONNECT_VERSION }} - Integration Test Report
@@ -81,7 +82,7 @@ jobs:
8182
pull-requests: write
8283
if: always()
8384
steps:
84-
- uses: actions/download-artifact@v4
85+
- uses: actions/download-artifact@v6
8586
with:
8687
path: artifacts
8788
- uses: EnricoMi/publish-unit-test-result-action@v2
@@ -94,8 +95,8 @@ jobs:
9495
build:
9596
runs-on: ubuntu-latest
9697
steps:
97-
- uses: actions/checkout@v4
98-
- uses: astral-sh/setup-uv@v6
98+
- uses: actions/checkout@v5
99+
- uses: astral-sh/setup-uv@v7
99100
- run: uv python install
100101
- run: make dev
101102
- run: make build

Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include vars.mk
22

33
.DEFAULT_GOAL := all
44

5-
.PHONY: build clean cov default dev docker-deps docs ensure-uv fmt fix install it lint test uninstall version help
5+
.PHONY: build clean cov default dev docs ensure-uv fmt fix install it lint test uninstall version help
66

77
$(UV_LOCK): dev
88
$(UV) lock
@@ -35,12 +35,6 @@ cov-xml: dev
3535
dev: ensure-uv
3636
$(UV) pip install --upgrade -e .
3737

38-
docker-deps: ensure-uv
39-
# Sync given the `uv.lock` file
40-
# --frozen : assert that the lock file exists
41-
# --no-install-project : do not install the project itself, but install its dependencies
42-
$(UV) sync --frozen --no-install-project
43-
4438
docs: ensure-uv
4539
$(MAKE) -C ./docs
4640

integration/Makefile

Lines changed: 32 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,26 @@
11
include ../vars.mk
22

3-
# Docker settings
4-
DOCKER_COMPOSE ?= docker compose
5-
DOCKER_CONNECT_IMAGE ?= rstudio/rstudio-connect
6-
DOCKER_PROJECT_IMAGE_TAG ?= $(PROJECT_NAME):latest
7-
8-
# Connect settings
9-
CONNECT_BOOTSTRAP_SECRETKEY ?= $(shell head -c 32 /dev/random | base64)
10-
113
# pytest settings
124
PYTEST_ARGS ?= "-s"
135

146
.DEFAULT_GOAL := latest
157

8+
define GET_PORT
9+
$(UV) run -- python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'
10+
endef
11+
1612
.PHONY: $(CONNECT_VERSIONS) \
1713
all \
18-
build \
19-
down \
20-
down-% \
14+
clean \
2115
latest \
22-
test \
23-
up \
24-
up-% \
25-
help
16+
print-versions \
17+
help \
18+
test-%
2619

2720
# Versions
2821
CONNECT_VERSIONS := \
22+
2025.10.0 \
23+
2025.09.1 \
2924
2025.07.0 \
3025
2025.06.0 \
3126
2025.05.0 \
@@ -59,88 +54,46 @@ clean:
5954
rm -rf logs reports
6055
find . -type d -empty -delete
6156

62-
# Run test suite for a specific Connect version.
63-
$(CONNECT_VERSIONS): %: down-% up-%
57+
# Run pytest for a specific version (assumes Connect is already running).
58+
test-%:
59+
@mkdir -p logs reports
60+
$(UV) run pytest $(PYTEST_ARGS) \
61+
--junitxml=reports/junit-$*.xml | tee logs/$*.log
62+
63+
# Spin up Connect for a specific version and run tests.
64+
$(CONNECT_VERSIONS): %:
65+
PORT=$$($(GET_PORT)); \
66+
uv run --with https://github.com/posit-dev/with-connect.git \
67+
with-connect --version $* --port $$PORT \
68+
-- $(MAKE) test-$*
6469

6570
# Run test suite against all Connect versions.
66-
all: $(CONNECT_VERSIONS:%=%) preview
71+
all: $(CONNECT_VERSIONS:%=%)
6772

6873
# Run test suite against latest Connect version.
6974
latest:
7075
$(MAKE) $(firstword $(CONNECT_VERSIONS))
7176

72-
# Run test suite against preview Connect version.
73-
preview:
74-
$(MAKE) \
75-
DOCKER_CONNECT_IMAGE=rstudio/rstudio-connect-preview \
76-
DOCKER_CONNECT_IMAGE_TAG=dev-jammy-daily \
77-
down-preview up-preview
78-
79-
# Build Dockerfile
80-
build:
81-
make -C .. $(UV_LOCK)
82-
docker build -t $(DOCKER_PROJECT_IMAGE_TAG) ..
83-
84-
# Tear down resources.
85-
down: $(CONNECT_VERSIONS:%=down-%)
86-
down-%: DOCKER_CONNECT_IMAGE_TAG=jammy-$*
87-
down-%: CONNECT_VERSION=$*
88-
down-%:
89-
CONNECT_BOOTSTRAP_SECRETKEY=$(CONNECT_BOOTSTRAP_SECRETKEY) \
90-
CONNECT_VERSION=$* \
91-
DOCKER_CONNECT_IMAGE_TAG=$(DOCKER_CONNECT_IMAGE_TAG) \
92-
DOCKER_CONNECT_IMAGE=$(DOCKER_CONNECT_IMAGE) \
93-
DOCKER_PROJECT_IMAGE_TAG=$(DOCKER_PROJECT_IMAGE_TAG) \
94-
PYTEST_ARGS="$(PYTEST_ARGS)" \
95-
$(DOCKER_COMPOSE) -p $(PROJECT_NAME)-$(subst .,-,$(CONNECT_VERSION)) down -v
96-
97-
# Create, start, and run Docker Compose.
98-
up: $(CONNECT_VERSIONS:%=up-%)
99-
up-%: CONNECT_VERSION=$*
100-
up-%: DOCKER_CONNECT_IMAGE_TAG=jammy-$*
101-
up-%: build
102-
CONNECT_BOOTSTRAP_SECRETKEY=$(CONNECT_BOOTSTRAP_SECRETKEY) \
103-
CONNECT_VERSION=$* \
104-
DOCKER_CONNECT_IMAGE_TAG=$(DOCKER_CONNECT_IMAGE_TAG) \
105-
DOCKER_CONNECT_IMAGE=$(DOCKER_CONNECT_IMAGE) \
106-
DOCKER_PROJECT_IMAGE_TAG=$(DOCKER_PROJECT_IMAGE_TAG) \
107-
PYTEST_ARGS="$(PYTEST_ARGS)" \
108-
$(DOCKER_COMPOSE) -p $(PROJECT_NAME)-$(subst .,-,$(CONNECT_VERSION)) up -V --abort-on-container-exit --no-build
109-
11077
# Show available versions
11178
print-versions:
11279
@printf "%s\n" $(strip $(CONNECT_VERSIONS))
11380

11481
# Show help message.
11582
help:
11683
@echo "Makefile Targets:"
117-
@echo " all (default) Run test suite for all Connect versions."
118-
@echo " latest Run test suite for latest Connect version."
119-
@echo " preview Run test suite for preview Connect version."
120-
@echo " <version> Run test suite for the specified Connect version. (e.g., make 2024.05.0)"
121-
@echo " up Start Docker Compose for all Connect versions."
122-
@echo " down Tear down Docker resources for all Connect versions."
123-
@echo " clean Clean up the project directory."
84+
@echo " latest (default) Run test suite for latest Connect version."
85+
@echo " all Run test suite for all Connect versions."
86+
@echo " <version> Run test suite for the specified Connect version. (e.g., make 2025.10.0)"
87+
@echo " clean Clean up logs and reports directories."
12488
@echo " print-versions Show the available Connect versions."
12589
@echo " help Show this help message."
12690
@echo
12791
@echo "Common Usage:"
128-
@echo " make -j 4 Run test suite in parallel for all Connect versions."
92+
@echo " make Run test suite for latest Connect version (default)."
12993
@echo " make latest Run test suite for latest Connect version."
130-
@echo " make preview Run test suite for preview Connect version."
131-
@echo " make 2024.05.0 Run test suite for specific Connect version."
94+
@echo " make 2025.10.0 Run test suite for specific Connect version."
95+
@echo " make all Run test suite for all Connect versions."
96+
@echo " make -j 4 all Run test suite in parallel for all Connect versions."
13297
@echo
13398
@echo "Environment Variables:"
134-
@echo " DOCKER_COMPOSE Command to invoke Docker Compose. Default: docker compose"
135-
@echo " DOCKER_CONNECT_IMAGE Docker image name for Connect. Default: rstudio/rstudio-connect"
136-
@echo " DOCKER_PROJECT_IMAGE_TAG Docker image name and tag for the project image. Default: $(PROJECT_NAME):latest"
137-
@echo " PYTEST_ARGS Arguments to pass to pytest. Default: \"-s\""
138-
139-
# Run tests.
140-
test:
141-
mkdir -p logs
142-
set -o pipefail; \
143-
CONNECT_VERSION=${CONNECT_VERSION} \
144-
CONNECT_API_KEY="$(shell $(UV) run rsconnect bootstrap -i -s http://connect:3939 --raw)" \
145-
$(UV) run pytest $(PYTEST_ARGS) --junit-xml=./reports/$(CONNECT_VERSION).xml | \
146-
tee ./logs/$(CONNECT_VERSION).log;
99+
@echo " PYTEST_ARGS Arguments to pass to pytest. Default: \"-s\""

integration/compose.yaml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)