From a2eb6c915afd356256dc4bc06eeea5a4334803ea Mon Sep 17 00:00:00 2001 From: merrywhether Date: Wed, 4 Dec 2024 13:57:43 -0800 Subject: [PATCH] add simple CI --- .github/workflows/tests.yml | 19 +++++++++++++++++++ README.md | 10 ++++++++-- deno.json | 3 ++- 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..938d70e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,19 @@ +name: Run Tests + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Deno + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: Run tests + run: deno run test diff --git a/README.md b/README.md index 810822f..daa1424 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,24 @@ Duplicate the `src/00` directory and rename it to the two-digit, one-indexed number of the day's challenge. Paste the sample and input data into their respective files. -Use the `dev` commmand to run the tests in watch mode against the sample data: +Use the `dev` task to run the tests in watch mode against the sample data: ```sh DAY=XX deno run dev ``` -Use the `solve` command to output a solution based on the input data: +Use the `solve` task to output a solution based on the input data: ```sh DAY=XX deno run solve ``` +Use the `test` task to run all tests against the sample data (mostly for CI): + +```sh +deno run test +``` + ## Useful references - https://github.com/denoland/advent-of-code-2024 diff --git a/deno.json b/deno.json index 4fe376d..e2db94a 100644 --- a/deno.json +++ b/deno.json @@ -1,7 +1,8 @@ { "tasks": { "dev": "deno test --watch -R src/$DAY/test.ts", - "solve": "deno run -R src/$DAY/main.ts" + "solve": "deno run -R src/$DAY/main.ts", + "test": "deno test -R src" }, "imports": { "@std/assert": "jsr:@std/assert@^1.0.8"