Skip to content

Commit

Permalink
feat: release please
Browse files Browse the repository at this point in the history
  • Loading branch information
Net-Mist committed Jan 11, 2024
1 parent 53f4157 commit 1a6a78e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
release-type: rust
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY front /app/front/
COPY .sqlx /app/.sqlx
RUN cargo build --release

FROM ubuntu:24.04
FROM debian:bookworm-slim
WORKDIR /app
COPY --from=builder /app/target/release/millennium_falcon .
ENTRYPOINT [ "./millennium_falcon" ]
33 changes: 19 additions & 14 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# Tell me the odds

<!--toc:start-->

- [Tell me the odds](#tell-me-the-odds)
- [Architecture](#architecture)
- [Domain model](#domain-model)
- [Domain services](#domain-services)
- [Application services](#application-services)
- [Infrastructure service](#infrastructure-service)
- [Technology stack](#technology-stack)
- [CI](#ci)
- [Test](#test)
- [TODO](#todo)
<!--toc:end-->

Solution of the [developer-test](https://github.com/lioncowlionant/developer-test).

With a recent version of rust (tested with 1.75.0), you can build the project with `cargo build --release`. Then you can run the cli with `./target/release/give-me-the-odds examples/millennium-falcon.json examples/example2/empire.json` and the webserver with `./target/release/millennium_falcon examples/millennium-falcon.json`.

Note that when starting, the webserver will create a folder `logs` containing a file `millennium.log.{date}` with the log of the server. stdio will be pretty silent if everything goes well. The server will be listening on `127.0.0.1:8000`.
Note that when starting, the webserver will create a folder `logs` containing a file `millennium.log.{date}` with the log of the server. stdio will be pretty silent if everything goes well. The server will be listening on `0.0.0.0:8000`.

It is also possible to start the server with docker by running `docker build -t millennium-falcon .` then `docker run -it --rm -v ./logs:/app/logs -v ./examples:/app/examples -p 0.0.0.0:8000:8000 millennium-falcon examples/millennium-falcon.json`

Expand All @@ -14,12 +28,12 @@ and the cli by running `docker build -t give-me-the-odds -f cli.Dockerfile .` th

The code follows the onion architecture. More specifically, the code is divided into 4 sections:

- Domain model
- Domain models
- Domain services
- Application services
- Infrastructure services

### Domain model
### Domain models

Contains the definitions of `PlanetId`, `GalaxyRoutes`, `PlanetCatalog` and `BountyHunterPlanning`.

Expand All @@ -31,7 +45,7 @@ Contains the public definition of `compute_probability_of_success`, and some pri

Contains the definition of `MillenniumFalconData` and `EmpireData` matching the json formats specified in the requirements of the app, and `Route` matching the database data format (but without db-related types or field) and some code to bridge the data.

### Infrastructure service
### Infrastructure services

Contains code to connect and read from the DB, process the CLI input and defining the webserver endpoints.

Expand All @@ -45,7 +59,7 @@ This code was written in Rust 1.75.0. Notables dependencies are :
- Tokio for the async engine
- Tracing for the tracing (logging with span)

### CI
## CI

2 GitHub workflows are defined.

Expand All @@ -65,14 +79,5 @@ Unit-tests are defined directly inside the code. Look for the `mod test`. Integr

## TODO

- bulding the docker image
- pushing to dockerhub with a dev tag
- release-please
- release protocol
- front
- Instrumented
- observability
- test:
- full black-box tests for the endpoints
- some scenario tests for the example provided in the documentation
- unit-test inside the code
2 changes: 1 addition & 1 deletion cli.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY front /app/front/
COPY .sqlx /app/.sqlx
RUN cargo build --release

FROM ubuntu:24.04
FROM debian:bookworm-slim
WORKDIR /app
COPY --from=builder /app/target/release/give-me-the-odds .
ENTRYPOINT [ "./give-me-the-odds" ]

0 comments on commit 1a6a78e

Please sign in to comment.