Add CI and README

This commit is contained in:
2024-12-02 13:33:22 +01:00
parent b5fd8a73fa
commit 618fbe0102
4 changed files with 57 additions and 4 deletions
+20
View File
@@ -0,0 +1,20 @@
name: Bun CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --include=dev
- name: Check formatting
run: bun run check
- name: Run tests
run: bun run test
+3
View File
@@ -0,0 +1,3 @@
ALL RIGHTS RESERVED.
Pascal Syma, 2024.
+33 -4
View File
@@ -1,4 +1,22 @@
# aoc
# Advent of Code
> [LANGUAGE: TypeScript]
>
> [RUNTIME: Bun]
## Structure
Every solution is grouped by its year and day and (usually) consists of five files:
| Filename | Purpose |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `<year>/<day>/index.ts` | Has the solution. Exports two functions: `solveFirst(string): number` and `solveSecond(string): number` |
| `<year>/<day>/index.test.ts` | Unit test using the example input and expected solution. |
| `<year>/<day>/run.ts` | Basic run script: Loading the actual input and passing it into the two solve functions. |
| `<year>/<day>/input.txt` | Input text from AOC. |
| `<year>/<day>/<year>-<day>.run.xml` | IntelliJ/Webstorm runfile for `run.ts` using Bun. |
## Setup
To install dependencies:
@@ -6,10 +24,21 @@ To install dependencies:
bun install
```
To run:
To test all days:
```bash
bun run src/index.ts
bun run test
```
This project was created using `bun init` in bun v1.1.36. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
To create a new day-folder:
```bash
bun run copy.ts
```
To run a single day, first copy your input file from `https://adventofcode.com/<year>/day/<day>/input` into
`<year>/<day>/input.txt`. Then run:
```bash
bun run <year>/<day>/run.ts
```
+1
View File
@@ -2,6 +2,7 @@
"name": "aoc",
"type": "module",
"author": "Pascal Syma <pascal@syma.dev> (https://syma.dev/)",
"license": "All rights reserved.",
"scripts": {
"format": "prettier --write .",
"check": "prettier --check .",