Skip to content

Commit e3ab722

Browse files
committed
remove rspace-docker, playwright and rely on rspace-web project to init rspace instance
1 parent 700d482 commit e3ab722

5 files changed

Lines changed: 104 additions & 135 deletions

File tree

.env.example

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
RSPACE_URL=
2-
RSPACE_API_KEY=
3-
4-
RSPACE_USERNAME=
5-
RSPACE_PASSWORD=
2+
RSPACE_API_KEY=

.github/scripts/get_rspace_api_key.py

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

.github/workflows/codeql-and-tests.yml

Lines changed: 98 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,42 @@ jobs:
7979
needs: test
8080
permissions:
8181
contents: read
82+
env:
83+
RS_FILE_BASE: /tmp/e2e-filestore
84+
services:
85+
db:
86+
image: mariadb:lts-jammy
87+
env:
88+
MARIADB_ROOT_PASSWORD: rspacedbpwd
89+
MARIADB_DATABASE: rspace
90+
MARIADB_USER: rspacedbuser
91+
MARIADB_PASSWORD: rspacedbpwd
92+
ports:
93+
- 3306:3306
94+
options: >-
95+
--tmpfs /var/lib/mysql:rw,noexec,nosuid,size=2g
96+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
97+
--health-interval=5s
98+
--health-timeout=5s
99+
--health-retries=40
100+
--health-start-period=30s
101+
# RSpace's chemistry-gated integrations only render when this is reachable.
102+
chemistry:
103+
image: rspaceops/oss-chemistry:latest
104+
ports:
105+
- 8090:8090
82106

83107
steps:
84-
- name: Checkout repository
108+
- name: Checkout rspace-client-python
85109
uses: actions/checkout@v4
86110

111+
- name: Checkout rspace-web
112+
uses: actions/checkout@v4
113+
with:
114+
repository: rspace-os/rspace-web
115+
path: rspace-web
116+
persist-credentials: false
117+
87118
- name: Set up Python 3.12
88119
uses: actions/setup-python@v5
89120
with:
@@ -99,13 +130,20 @@ jobs:
99130
- name: Install dependencies
100131
run: poetry install --no-interaction
101132

102-
- name: Clone rspace-docker
103-
run: git clone https://github.com/rspace-os/rspace-docker.git /tmp/rspace-docker
133+
- name: Set up JDK
134+
uses: actions/setup-java@v5
135+
with:
136+
distribution: temurin
137+
java-version: 17
138+
cache: maven
139+
cache-dependency-path: rspace-web/pom.xml
104140

105141
- name: Download latest RSpace WAR
142+
working-directory: rspace-web
106143
run: |
107144
set -euo pipefail
108145
146+
mkdir -p target
109147
release_json=$(curl -fsSL https://api.github.com/repos/rspace-os/rspace-web/releases/latest)
110148
latest_tag=$(echo "$release_json" | jq -r '.tag_name')
111149
war_url=$(echo "$release_json" | jq -r '.assets[]? | select(.name | test("^researchspace-.*\\.war$")) | .browser_download_url' | head -n1)
@@ -120,7 +158,7 @@ jobs:
120158
fi
121159
122160
echo "Latest RSpace tag: $latest_tag"
123-
curl -fsSL "$war_url" -o /tmp/rspace-docker/rspace.war
161+
curl -fsSL "$war_url" -o target/researchspace.war
124162
125163
- name: Free up disk space
126164
run: |
@@ -129,44 +167,68 @@ jobs:
129167
docker image prune -af || true
130168
df -h
131169
132-
- name: Start RSpace
133-
working-directory: /tmp/rspace-docker
134-
run: docker compose up -d
135-
136-
- name: Wait for RSpace to be ready
137-
timeout-minutes: 10
170+
- name: Configure MariaDB
171+
run: |
172+
mysql -h127.0.0.1 -uroot -prspacedbpwd <<'SQL'
173+
SET GLOBAL character_set_server = 'utf8mb4';
174+
SET GLOBAL collation_server = 'utf8mb4_unicode_ci';
175+
SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
176+
GRANT CREATE, DROP ON *.* TO 'rspacedbuser'@'%';
177+
FLUSH PRIVILEGES;
178+
SQL
179+
180+
- name: Setup filestore
181+
run: |
182+
rm -rf "$RS_FILE_BASE"
183+
mkdir -p "$RS_FILE_BASE"
184+
185+
# Deploys the downloaded WAR directly (-Dmaven.war.skip=true skips
186+
# rebuilding it) against a "dev" + "drop-recreate-db" environment, which
187+
# drops/recreates the schema and loads RSpace's dev-test Liquibase seed
188+
# data - including a sysadmin1 user with a fixed, known API key. No
189+
# separate key-generation step (UI or REST) is needed as a result.
190+
- name: Start RSpace (prebuilt WAR) and wait for readiness
191+
working-directory: rspace-web
138192
run: |
139193
set -euo pipefail
140-
141-
echo "Waiting for RSpace on http://localhost:8080 ..."
142-
for i in {1..40}; do
143-
if timeout 2 bash -c "cat < /dev/null > /dev/tcp/localhost/8080" 2>/dev/null; then
144-
echo "RSpace is up"
145-
exit 0
194+
nohup ./mvnw jetty:run-war \
195+
-DskipTests=true -Dmaven.war.skip=true \
196+
-Dtimestamp=${{ github.run_id }} \
197+
-Djava-version=17 -Djava-vendor=temurin \
198+
-Denvironment=drop-recreate-db \
199+
-Dspring.profiles.active=run \
200+
-DreactDevMode=false \
201+
-Dchemistry.provider=indigo \
202+
-Dchemistry.service.url=http://localhost:8090 \
203+
-Djdbc.url=jdbc:mysql://localhost:3306/rspace \
204+
-Djdbc.db.maven=rspace \
205+
-DRS_FILE_BASE="$RS_FILE_BASE" \
206+
-DRS.devlogLevel=INFO \
207+
> /tmp/jetty.log 2>&1 &
208+
for i in $(seq 1 180); do
209+
if [ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/login || true)" = "200" ]; then
210+
echo "Ready after ~$((i*5))s"; exit 0
146211
fi
147-
echo " attempt $i/40..."
148-
sleep 15
212+
sleep 5
149213
done
150-
echo "RSpace failed to start"
151-
exit 1
152-
153-
- name: Install Playwright Browsers
154-
run: poetry run python -m playwright install chromium --with-deps
155-
156-
- name: Generate RSpace API Key
157-
id: generate_key
158-
run: poetry run python .github/scripts/get_rspace_api_key.py
159-
env:
160-
RSPACE_URL: http://localhost:8080
161-
RSPACE_USERNAME: ${{ secrets.RSPACE_USERNAME }}
162-
RSPACE_PASSWORD: ${{ secrets.RSPACE_PASSWORD }}
163-
164-
- name: Mask API key
165-
run: echo "::add-mask::${{ steps.generate_key.outputs.rspace_api_key }}"
214+
echo "::error::RSpace did not become ready in time"; tail -100 /tmp/jetty.log; exit 1
166215
167216
- name: Run integration tests
168217
timeout-minutes: 20
169218
env:
170219
RSPACE_URL: http://localhost:8080
171-
RSPACE_API_KEY: ${{ steps.generate_key.outputs.rspace_api_key }}
172-
run: poetry run pytest -m integration -v
220+
# Pre-seeded sysadmin1 API key from RSpace's dev-test Liquibase seed data.
221+
RSPACE_API_KEY: abcdefghijklmnop12
222+
run: poetry run pytest -m integration -v
223+
224+
- name: Dump server log on failure
225+
if: failure()
226+
run: tail -200 /tmp/jetty.log || true
227+
228+
- name: Upload Jetty log on failure
229+
if: failure()
230+
uses: actions/upload-artifact@v4
231+
with:
232+
name: jetty-log
233+
path: /tmp/jetty.log
234+
retention-days: 3

DEVELOPING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ poetry run pytest -m integration
4545
```
4646

4747
Integration tests should be run with a new RSpace account that does not belong to any groups.
48+
49+
In CI, the `integration-test` job boots RSpace the same way `rspace-web`'s `e2e.yml` does: it downloads
50+
the latest release WAR, deploys it with `mvnw jetty:run-war -Denvironment=drop-recreate-db` against a
51+
MariaDB service container, which loads RSpace's dev-test seed data. That seed data includes a `sysadmin1`
52+
user with a fixed, known API key, so no key-generation step is needed.
4853

4954
### Writing Tests
5055

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ setuptools = "<82"
3131
python-dotenv = "^1.1.1"
3232
black = "^21.6b0"
3333
pytest = "^8.0.0"
34-
playwright = "^1.58.0"
3534

3635
[build-system]
3736
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)