summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateus Cruz <mateuscolvr@gmail.com>2024-02-06 03:08:10 -0300
committerMateus Cruz <mateuscolvr@gmail.com>2024-02-06 03:15:27 -0300
commit606f39cb00766e5be46b38e3c3034e702c3795e6 (patch)
tree83a85fbb43b8da3980ed44bd7848c491af3e70fc
parentdb882cae080d3820f1723a711398c21db27f826a (diff)
chore: rename app
-rw-r--r--.github/workflows/build.yml27
-rw-r--r--bin/dune4
-rw-r--r--bin/main.ml4
-rw-r--r--combattant.opam (renamed from rinha.opam)0
-rw-r--r--docker-compose.yml4
-rw-r--r--dune-project4
-rw-r--r--flake.nix14
-rw-r--r--lib/dune2
-rw-r--r--test/dune2
-rw-r--r--test/test_combattant.ml (renamed from test/test_rinha.ml)0
10 files changed, 44 insertions, 17 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..b983ab9
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,27 @@
+name: 'Build'
+on:
+ pull_request:
+ branches:
+ - main
+ push:
+ branches:
+ - main
+
+jobs:
+ build:
+ permissions: write-all
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - uses: cachix/install-nix-action@v20
+ - uses: DeterminateSystems/magic-nix-cache-action@v2
+ - run: nix build -L .#docker
+ - run: nix develop -L -c dune runtest
+ - name: Log in to the Container registry
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - run: docker load < result
+ - run: docker push ghcr.io/molvrr/combattant:latest
diff --git a/bin/dune b/bin/dune
index 9c34236..3978ff9 100644
--- a/bin/dune
+++ b/bin/dune
@@ -1,10 +1,10 @@
(executable
- (public_name rinha)
+ (public_name combattant)
(name main)
(flags
(:standard -cclib -static -cclib -no-pie))
(libraries
- rinha
+ combattant
piaf
routes
eio_main
diff --git a/bin/main.ml b/bin/main.ml
index 03cc5ca..3839f6f 100644
--- a/bin/main.ml
+++ b/bin/main.ml
@@ -9,7 +9,7 @@ let setup_log ?style_renderer level =
;;
let request_handler ~db_pool Server.{ request; _ } =
- match Rinha.Router.match_route request.meth request.target with
+ match Combattant.Router.match_route request.meth request.target with
| Some handler -> Result.get_ok @@ handler db_pool request
| None ->
Logs.info (fun d -> d "Não encontrei %S\n" request.target);
@@ -29,7 +29,7 @@ let () =
in
let config = Server.Config.create config in
let db_uri =
- Uri.make ~scheme:"postgres" ~userinfo:"admin:123" ~host:"db" ~path:"rinha" ()
+ Uri.make ~scheme:"postgres" ~userinfo:"admin:123" ~host:"db" ~path:"combattant" ()
in
let db_pool =
Result.get_ok
diff --git a/rinha.opam b/combattant.opam
index 3b957d2..3b957d2 100644
--- a/rinha.opam
+++ b/combattant.opam
diff --git a/docker-compose.yml b/docker-compose.yml
index 3304f71..bcbd47f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,7 +2,7 @@ version: '3.5'
services:
api01: &api
- image: rinha:latest
+ image: ghcr.io/molvrr/combattant:latest
environment:
- DB_HOST=db
depends_on:
@@ -39,7 +39,7 @@ services:
environment:
- POSTGRES_PASSWORD=123
- POSTGRES_USER=admin
- - POSTGRES_DB=rinha
+ - POSTGRES_DB=combattant
ports:
- "5432:5432"
volumes:
diff --git a/dune-project b/dune-project
index 1170cb9..c6da9f6 100644
--- a/dune-project
+++ b/dune-project
@@ -1,6 +1,6 @@
(lang dune 3.13)
-(name rinha)
+(name combattant)
(generate_opam_files true)
@@ -16,7 +16,7 @@
(documentation https://url/to/documentation)
(package
- (name rinha)
+ (name combattant)
(synopsis "A short synopsis")
(description "A longer description")
(depends ocaml dune)
diff --git a/flake.nix b/flake.nix
index 1c549c0..d0080d5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,8 +21,8 @@
pkgs' = pkgs.pkgsCross.musl64;
- rinha = pkgs'.ocamlPackages.buildDunePackage {
- pname = "rinha";
+ combattant = pkgs'.ocamlPackages.buildDunePackage {
+ pname = "combattant";
version = "0.0.1";
src = ./.;
buildInputs = with pkgs'.ocamlPackages; [
@@ -50,21 +50,21 @@
pkgs.openjdk17
];
- buildInputs = rinha.buildInputs
+ buildInputs = combattant.buildInputs
++ (with pkgs'.ocamlPackages; [ utop ]);
};
- packages.default = rinha;
+ packages.default = combattant;
packages.docker = pkgs.dockerTools.buildImage {
- name = "rinha";
+ name = "ghcr.io/molvrr/combattant";
tag = "latest";
copyToRoot = pkgs.buildEnv {
name = "image-root";
- paths = [ pkgs.bashInteractive pkgs.coreutils pkgs.curl rinha ];
+ paths = [ pkgs.bashInteractive pkgs.coreutils pkgs.curl combattant ];
pathsToLink = [ "/bin" ];
};
- config = { Cmd = [ "rinha" ]; };
+ config = { Cmd = [ "combattant" ]; };
};
formatter = pkgs.nixfmt;
diff --git a/lib/dune b/lib/dune
index 6c8a064..b5507d7 100644
--- a/lib/dune
+++ b/lib/dune
@@ -1,5 +1,5 @@
(library
- (name rinha)
+ (name combattant)
(libraries piaf routes yojson caqti caqti-driver-postgresql caqti-eio ppx_rapper_eio)
(preprocess
(pps ppx_rapper)))
diff --git a/test/dune b/test/dune
index df3754d..6caed9b 100644
--- a/test/dune
+++ b/test/dune
@@ -1,2 +1,2 @@
(test
- (name test_rinha))
+ (name test_combattant))
diff --git a/test/test_rinha.ml b/test/test_combattant.ml
index e69de29..e69de29 100644
--- a/test/test_rinha.ml
+++ b/test/test_combattant.ml