-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
263 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
workflow_dispatch: | ||
|
||
env: | ||
DOCKER_FILE: bittorrent-benchmarks.Dockerfile | ||
DOCKER_FILE: ./docker/bittorrent-benchmarks.Dockerfile | ||
DOCKER_REPO: codexstorage/bittorrent-benchmarks | ||
|
||
jobs: | ||
|
@@ -18,6 +18,9 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Docker in rootless mode. | ||
uses: ScribeMD/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,49 @@ | ||
# Runs the whole test suite, with the test runner inside a container. This is ideal for CI. | ||
services: | ||
test-runner: | ||
image: bittorrent-benchmarks:test | ||
container_name: test-runner | ||
volumes: | ||
- ./volume:/opt/bittorrent-benchmarks/volume | ||
entrypoint: [ "pytest", "--exitfirst" ] | ||
environment: | ||
- DELUGE_NODE_1=deluge-1 | ||
- DELUGE_NODE_2=deluge-2 | ||
- DELUGE_NODE_3=deluge-3 | ||
- TRACKER_ANNOUNCE_URL=http://tracker:8000/announce | ||
- shared-volume:/opt/bittorrent-benchmarks/volume | ||
entrypoint: [ "bash", "-c", "/opt/bittorrent-benchmarks/docker/bin/run-tests.sh" ] | ||
healthcheck: | ||
test: stat /opt/bittorrent-benchmarks/volume/.initialized | ||
interval: 1s | ||
timeout: 5s | ||
retries: 150 | ||
|
||
deluge-1: | ||
volumes: !override | ||
- type: volume | ||
source: shared-volume | ||
target: /var/lib/deluge | ||
volume: | ||
subpath: deluge-1 | ||
depends_on: | ||
test-runner: | ||
condition: service_healthy | ||
|
||
deluge-2: | ||
volumes: !override | ||
- type: volume | ||
source: shared-volume | ||
target: /var/lib/deluge | ||
volume: | ||
subpath: deluge-2 | ||
depends_on: | ||
test-runner: | ||
condition: service_healthy | ||
|
||
deluge-3: | ||
volumes: !override | ||
- type: volume | ||
source: shared-volume | ||
target: /var/lib/deluge | ||
volume: | ||
subpath: deluge-3 | ||
depends_on: | ||
test-runner: | ||
condition: service_healthy | ||
|
||
volumes: | ||
shared-volume: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
export DELUGE_NODE_1=deluge-1 | ||
export DELUGE_NODE_2=deluge-2 | ||
export DELUGE_NODE_3=deluge-3 | ||
export TRACKER_ANNOUNCE_URL=http://tracker:8000/announce | ||
|
||
# Initializes the shared volume. | ||
echo "Initializing shared volume." | ||
mkdir -p /opt/bittorrent-benchmarks/volume/deluge-{1,2,3} | ||
touch /opt/bittorrent-benchmarks/volume/.initialized | ||
|
||
echo "Launching tests." | ||
cd /opt/bittorrent-benchmarks | ||
poetry run pytest --exitfirst | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM python:3.12-slim | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
ARG BUILD_TYPE="test" | ||
|
||
RUN groupadd -g ${GID} runner \ | ||
&& useradd -u ${UID} -g ${GID} -s /bin/bash -m runner | ||
RUN mkdir /opt/bittorrent-benchmarks && chown -R runner:runner /opt/bittorrent-benchmarks | ||
RUN pip install poetry | ||
|
||
USER runner | ||
WORKDIR /opt/bittorrent-benchmarks | ||
|
||
COPY --chown=runner:runner pyproject.toml poetry.lock ./ | ||
RUN if [ "$BUILD_TYPE" = "production" ]; then \ | ||
echo "Image is a production build"; \ | ||
poetry install --only main --no-root; \ | ||
else \ | ||
echo "Image is a test build"; \ | ||
poetry install --no-root; \ | ||
fi | ||
|
||
COPY --chown=runner:runner . . | ||
RUN poetry install --only main | ||
|
||
ENTRYPOINT ["poetry", "run", "bittorrent-benchmarks", "/opt/bittorrent-benchmarks/experiments.yaml"] |
Oops, something went wrong.