Skip to content

Commit dc6fb49

Browse files
test: integration (#848)
1 parent 84fbc78 commit dc6fb49

File tree

6 files changed

+84
-14
lines changed

6 files changed

+84
-14
lines changed

.github/workflows/integration.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Integration Test
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out the repo
14+
uses: actions/checkout@v4
15+
16+
- name: Build services
17+
run: docker compose build
18+
19+
- name: Start services
20+
run: docker compose up -d
21+
22+
- name: Wait 60 seconds
23+
run: sleep 60
24+
25+
# 1) Show the logs for debug
26+
- name: Docker Compose Logs
27+
run: docker compose logs
28+
29+
# 2) Check if any containers have exited with an error
30+
- name: Check containers status
31+
run: |
32+
# If any container's STATUS shows "Exit" or "exited", fail
33+
# because that means the container died or crashed.
34+
if docker compose ps | grep -q 'Exit'; then
35+
echo "A container has exited with an error."
36+
exit 1
37+
fi
38+
39+
- name: Tear down
40+
run: docker compose down

.github/workflows/publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish
22
on:
33
push:
4-
branches: [ main ]
4+
branches: [main]
55
jobs:
66
publish:
77
runs-on: ubuntu-latest
@@ -14,17 +14,17 @@ jobs:
1414
uses: actions/checkout@v4
1515
with:
1616
fetch-depth: 1
17-
17+
1818
- name: Set up Docker Buildx
1919
uses: docker/setup-buildx-action@v3
20-
20+
2121
- name: Log in to GitHub Container Registry
2222
uses: docker/login-action@v3
2323
with:
2424
registry: ghcr.io
2525
username: ${{ github.actor }}
2626
password: ${{ secrets.GITHUB_TOKEN }}
27-
27+
2828
- name: Build and push hyperion-proxy
2929
uses: docker/build-push-action@v5
3030
with:
@@ -35,7 +35,7 @@ jobs:
3535
tags: |
3636
ghcr.io/${{ github.repository }}/hyperion-proxy:latest
3737
ghcr.io/${{ github.repository }}/hyperion-proxy:${{ github.sha }}
38-
38+
3939
- name: Build and push tag
4040
uses: docker/build-push-action@v5
4141
with:
@@ -51,4 +51,4 @@ jobs:
5151
env:
5252
KEY: ${{ secrets.TEST_SERVER_KEY }}
5353
run: |
54-
curl -X POST -H "Key: $KEY" https://hyperion-test.duckdns.org
54+
curl -X POST -H "Key: $KEY" https://hyperion-test.duckdns.org

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ heapless = '0.8.0'
7676
heed = "0.21.0"
7777
hex = '0.4.3'
7878
humantime = '2.1.0'
79+
hyperion-proxy = { path = "crates/hyperion-proxy" }
7980
itertools = "0.14.0"
8081
kanal = '0.1.0-pre8'
8182
libc = '0.2.155'
@@ -113,7 +114,6 @@ toml = '0.8.14'
113114
tracing-appender = '0.2.3'
114115
uuid = '1.12.0'
115116

116-
117117
[workspace.dependencies.bvh]
118118
git = 'https://github.com/andrewgazelka/bvh-data'
119119

@@ -298,6 +298,12 @@ git = 'https://github.com/andrewgazelka/valence'
298298
branch = 'feat-open'
299299
git = 'https://github.com/andrewgazelka/valence'
300300

301+
[workspace.dependencies.tag]
302+
path = "events/tag"
303+
304+
[workspace.dependencies.rust-mc-bot]
305+
path = "tools/rust-mc-bot"
306+
301307
[workspace.lints]
302308
[workspace.lints.clippy]
303309
cast_precision_loss = 'allow'

Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ RUN --mount=type=cache,target=${CARGO_HOME}/registry \
8282
cargo build --profile release-full --frozen --workspace && \
8383
mkdir -p /app/build && \
8484
cp target/release-full/hyperion-proxy /app/build/ && \
85-
cp target/release-full/tag /app/build/
85+
cp target/release-full/tag /app/build/ && \
86+
cp target/release-full/rust-mc-bot /app/build/
8687

8788
# Runtime base image
8889
FROM ubuntu:24.04 AS runtime-base
@@ -102,11 +103,20 @@ LABEL org.opencontainers.image.source="https://github.com/andrewgazelka/hyperion
102103
EXPOSE 8080
103104
ENTRYPOINT ["/hyperion-proxy"]
104105
CMD ["0.0.0.0:8080"]
105-
# NYC Release
106+
106107
FROM runtime-base AS tag
107108
COPY --from=build-release /app/build/tag /
108109
LABEL org.opencontainers.image.source="https://github.com/andrewgazelka/hyperion" \
109110
org.opencontainers.image.description="Hyperion Tag Event" \
110111
org.opencontainers.image.version="0.1.0"
111112
ENTRYPOINT ["/tag"]
112-
CMD ["--ip", "0.0.0.0", "--port", "35565"]
113+
CMD ["--ip", "0.0.0.0", "--port", "35565"]
114+
115+
FROM runtime-base AS rust-mc-bot
116+
COPY --from=build-release /app/build/rust-mc-bot /
117+
LABEL org.opencontainers.image.source="https://github.com/andrewgazelka/rust-mc-bot" \
118+
org.opencontainers.image.description="Rust Minecraft Bot" \
119+
org.opencontainers.image.version="0.1.0"
120+
ENTRYPOINT ["/rust-mc-bot"]
121+
CMD ["hyperion-proxy:25565", "500", "4"]
122+

docker-compose.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
ports:
99
- "25565:25565"
1010
command: [ "--server", "tag:35565", "0.0.0.0:25565" ]
11-
restart: unless-stopped
11+
# restart: unless-stopped
1212
environment:
1313
- RUST_LOG=info
1414
networks:
@@ -26,7 +26,21 @@ services:
2626
expose:
2727
- "35565"
2828
command: [ ]
29-
restart: unless-stopped
29+
# restart: unless-stopped
30+
environment:
31+
- RUST_LOG=info
32+
networks:
33+
- proxy-network
34+
rust-mc-bot:
35+
# image: ghcr.io/hyperion-mc/hyperion/rust-mc-bot:latest
36+
build:
37+
context: .
38+
dockerfile: Dockerfile
39+
target: rust-mc-bot
40+
command: [ "hyperion-proxy:25565", "500", "2" ]
41+
# restart: unless-stopped
42+
depends_on:
43+
- hyperion-proxy
3044
environment:
3145
- RUST_LOG=info
3246
networks:

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ watch:
8383
debug:
8484
#!/usr/bin/env -S parallel --shebang --ungroup --jobs 3
8585
RUST_BACKTRACE=full RUN_MODE=debug-{{arch}} cargo watch --postpone --no-vcs-ignores -w {{project_root}}/.trigger-debug -s './target/debug/tag'
86-
RUST_BACKTRACE=full ulimit -Sn {{fds}} && cargo run --bin hyperion-proxy --release
86+
RUST_BACKTRACE=full ulimit -Sn {{fds}} && cargo run --bin hyperion-proxy --release-full -- --server "127.0.0.1:35565" "0.0.0.0:25565"
8787
cargo watch -w '{{project_root}}/crates/hyperion' -w '{{project_root}}/events/tag' -s 'cargo check -p tag && cargo build -p tag' -s 'touch {{project_root}}/.trigger-debug'
8888

8989
# run in release mode with tracy; auto-restarts on changes
@@ -96,7 +96,7 @@ release:
9696
release-full:
9797
#!/usr/bin/env -S parallel --shebang --ungroup --jobs 2
9898
RUN_MODE=release-f-{{arch}} cargo run --profile release-full -p tag'
99-
ulimit -Sn {{fds}} && cargo run --bin hyperion-proxy --profile release-full
99+
ulimit -Sn {{fds}} && cargo run --bin hyperion-proxy --profile release-full
100100
101101
# run a given number of bots to connect to hyperion
102102
bots ip='127.0.0.1:25565' count='1000':

0 commit comments

Comments
 (0)