-
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
0 parents
commit ee624d7
Showing
21 changed files
with
971 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
pages: write | ||
|
||
concurrency: | ||
group: 'pages' | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
if: github.repository == 'demiazz/advent-of-ocaml' | ||
|
||
name: Advent of OCaml | ||
|
||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install OCaml | ||
uses: ocaml/setup-ocaml@v3 | ||
with: | ||
ocaml-compiler: 5.2.0 | ||
dune-cache: true | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
run_install: false | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: pnpm | ||
node-version-file: .tool-versions | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: make init-ci | ||
|
||
- name: Build docs | ||
run: make build | ||
|
||
- name: Upload docs artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: dist | ||
|
||
- name: Deploy docs to Github Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,20 @@ | ||
# Node.js | ||
|
||
dist | ||
node_modules | ||
|
||
# Opam | ||
|
||
_opam/ | ||
|
||
# Dune | ||
|
||
_build/ | ||
|
||
# macOS | ||
|
||
.DS_Store | ||
|
||
# Tests | ||
|
||
input.txt |
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,2 @@ | ||
profile = default | ||
version = 0.26.2 |
Empty file.
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,15 @@ | ||
ISC License | ||
|
||
Copyright (c) 2024, Alexey Plutalov | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
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,33 @@ | ||
YEAR=2015 | ||
DAY=1 | ||
PART=1 | ||
|
||
.PHONY: init build-native build-web build dev-web | ||
|
||
init: | ||
opam switch create . 5.2.0 -y --deps-only | ||
pnpm install | ||
opam install -y . --deps-only --with-dev | ||
opam exec opam-check-npm-deps | ||
|
||
init-ci: | ||
pnpm install | ||
opam install -y . --deps-only | ||
opam exec opam-check-npm-deps | ||
|
||
build-native: | ||
opam exec -- dune build | ||
|
||
build-web: build-native | ||
pnpm vite build | ||
|
||
build: build-native build-web | ||
|
||
dev-web: build-native | ||
pnpm vite dev | ||
|
||
dev-native: | ||
opam exec -- dune build --watch | ||
|
||
run: build-native | ||
_build/default/native/main.exe -y $(YEAR) -d $(DAY) -p $(PART) -i input.txt |
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,23 @@ | ||
opam-version: "2.0" | ||
synopsis: "Solutions of Advent of Code on OCaml" | ||
description: "Solutions of Advent of Code on OCaml" | ||
maintainer: ["Alexey Plutalov <demiazz.py@gmail.com>"] | ||
authors: ["Alexey Plutalov <demiazz.py@gmail.com>"] | ||
license: "ISC" | ||
homepage: "https://github.com/demiazz/advent-of-ocaml" | ||
bug-reports: "https://github.com/demiazz/advent-of-ocaml/issues" | ||
depends: [ | ||
"ocaml" {>= "5.2.0"} | ||
"reason" {>= "3.13.0"} | ||
"dune" {>= "3.16.1"} | ||
"melange" {>= "4.0.1-52"} | ||
"reason-react" {>= "0.15.0"} | ||
"reason-react-ppx" {>= "0.15.0"} | ||
"opam-check-npm-deps" {with-dev-setup} | ||
"ocaml-lsp-server" {with-dev-setup} | ||
"ocamlformat" {with-dev-dev-setup} | ||
"dot-merlin-reader" {with-dev-setup} | ||
"utop" {with-dev-setup} | ||
"odoc" {with-doc} | ||
] | ||
dev-repo: "git+https://github.com/demiazz/advent-of-ocaml" |
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,4 @@ | ||
let solve () = | ||
Utils.print_message "Solved!"; | ||
|
||
() |
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,5 @@ | ||
(library | ||
(name advent_of_code) | ||
(modules advent_of_code) | ||
(libraries utils) | ||
(modes melange native)) |
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,5 @@ | ||
(lang dune 3.16) | ||
|
||
(using melange 0.1) | ||
|
||
(name advent-of-ocaml) |
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,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-us"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
||
<title>Advent of OCaml</title> | ||
|
||
<link | ||
ref="stylesheet" | ||
href="./node_modules/@fontsource/source-code-pro/300.css" | ||
/> | ||
|
||
<link rel="shortcut icon" href="./web/assets/favicon.png" /> | ||
|
||
<script | ||
src="./_build/default/web/output/web/main.js" | ||
type="module" | ||
></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
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,4 @@ | ||
(executable | ||
(public_name advent-of-ocaml) | ||
(name main) | ||
(libraries advent_of_code)) |
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,15 @@ | ||
let usage = "advent-of-ocaml -y <year> -d <day> -p <part> -i <file>" | ||
let year : int ref = ref 0 | ||
let day : int ref = ref 0 | ||
let part : int ref = ref 0 | ||
let input_file = ref "" | ||
|
||
let speclist : (string * Arg.spec * string) list = | ||
[ | ||
("-y", Arg.Set_int year, "Set year"); | ||
("-d", Arg.Set_int day, "Set day"); | ||
("-p", Arg.Set_int part, "Set part"); | ||
("-i", Arg.Set_string input_file, "Set input file name"); | ||
] | ||
|
||
let () = Arg.parse speclist (fun _ -> ()) usage |
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,24 @@ | ||
{ | ||
"name": "advent-of-ocaml", | ||
"private": true, | ||
"version": "0.0.0", | ||
"description": "Solutions of Advent of Code on OCaml", | ||
"main": "index.js", | ||
"keywords": [ | ||
"advent of code", | ||
"zig", | ||
"wasm" | ||
], | ||
"author": "Alexey Plutalov", | ||
"license": "ISC", | ||
"packageManager": "pnpm@9.12.1", | ||
"dependencies": { | ||
"@fontsource/source-code-pro": "^5.1.0", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.3.0", | ||
"vite": "^5.4.11" | ||
} | ||
} |
Oops, something went wrong.