Skip to content

Commit e991064

Browse files
authored
Merge pull request #1404 from kenkoooo/feat/dev-env
update: dev env
2 parents 7d3890f + f62ada1 commit e991064

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.PHONY: help
2+
help:
3+
@awk -F ':|##' '/^[^\t].+?:.*?##/ { printf "\033[36m%-22s\033[0m %s\n", $$1, $$NF }' $(MAKEFILE_LIST)
4+
5+
.PHONY: up
6+
up:
7+
docker compose up
8+
9+
.PHONY: down
10+
down:
11+
docker compose down
12+
13+
.PHONY: test/backend
14+
test/backend:
15+
docker compose exec backend-development cargo test --workspace --no-fail-fast -- --test-threads=1

atcoder-problems-backend/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
FROM rust:1.63.0 AS development
2-
RUN rustup component add rustfmt
3-
RUN rustup component add clippy
4-
51
# Using the official cargo-chef image
62
FROM lukemathwalker/cargo-chef:latest-rust-1.63.0 AS chef
73
WORKDIR /app
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM rust:1.63.0 AS development
2+
RUN rustup component add rustfmt
3+
RUN rustup component add clippy
4+
5+
# Install cargo-watch
6+
RUN wget "https://github.com/watchexec/cargo-watch/releases/download/v8.4.0/cargo-watch-v8.4.0-$(uname -m)-unknown-linux-gnu.tar.xz" \
7+
&& tar -xf "cargo-watch-v8.4.0-$(uname -m)-unknown-linux-gnu.tar.xz" \
8+
&& cp "cargo-watch-v8.4.0-$(uname -m)-unknown-linux-gnu/cargo-watch" /usr/local/bin/ \
9+
&& rm -rf "cargo-watch-v8.4.0-$(uname -m)-unknown-linux-gnu"

atcoder-problems-backend/atcoder-client/src/atcoder/client.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,4 @@ mod tests {
115115
let problems = client.fetch_problem_list("abc107").await.unwrap();
116116
assert_eq!(problems.len(), 4);
117117
}
118-
119-
#[tokio::test]
120-
async fn test_fetch_submission_list() {
121-
let client = AtCoderClient::default();
122-
let response = client
123-
.fetch_atcoder_submission_list("xmascon17", None)
124-
.await
125-
.unwrap();
126-
assert_eq!(response.submissions.len(), 20);
127-
128-
let response = client
129-
.fetch_atcoder_submission_list("xmascon17", Some(response.max_page))
130-
.await
131-
.unwrap();
132-
assert!(!response.submissions.is_empty());
133-
134-
let response = client
135-
.fetch_atcoder_submission_list("xmascon17", Some(response.max_page + 1))
136-
.await;
137-
assert!(response.is_err());
138-
}
139118
}

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ services:
1414
- "15432:5432"
1515

1616
backend-development:
17-
image: rust:1.63.0
17+
build:
18+
context: ./atcoder-problems-backend
19+
dockerfile: Dockerfile.dev
1820
environment:
1921
SQL_URL: postgres://db_user:db_pass@postgresql:5432/test_db
2022
DATABASE_URL: postgres://db_user:db_pass@postgresql:5432/test_db
@@ -28,7 +30,7 @@ services:
2830
- cargo-cache:/usr/local/cargo/registry
2931
- target-cache:/app/atcoder-problems-backend/target
3032
working_dir: /app/atcoder-problems-backend
31-
command: /bin/sh -c "while sleep 1000; do :; done"
33+
command: /bin/sh -c "cargo watch -s 'cargo run --bin run_server'"
3234

3335
frontend-development:
3436
image: node:16

0 commit comments

Comments
 (0)