From cf39fec070cb539f975b6a1641ad2233861cd125 Mon Sep 17 00:00:00 2001 From: dalan <863286+dalanmiller@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:34:54 +1100 Subject: [PATCH] Init 2024 Gleam --- .github/workflows/gleam2024.yaml | 25 +++++++++++++++++++++++++ 2024/.github/workflows/test.yml | 23 +++++++++++++++++++++++ 2024/.gitignore | 4 ++++ 2024/README.md | 24 ++++++++++++++++++++++++ 2024/gleam.toml | 22 ++++++++++++++++++++++ 2024/manifest.toml | 11 +++++++++++ 2024/src/aoc_2024.gleam | 5 +++++ 2024/test/aoc_2024_test.gleam | 12 ++++++++++++ 8 files changed, 126 insertions(+) create mode 100644 .github/workflows/gleam2024.yaml create mode 100644 2024/.github/workflows/test.yml create mode 100644 2024/.gitignore create mode 100644 2024/README.md create mode 100644 2024/gleam.toml create mode 100644 2024/manifest.toml create mode 100644 2024/src/aoc_2024.gleam create mode 100644 2024/test/aoc_2024_test.gleam diff --git a/.github/workflows/gleam2024.yaml b/.github/workflows/gleam2024.yaml new file mode 100644 index 0000000..fbba60c --- /dev/null +++ b/.github/workflows/gleam2024.yaml @@ -0,0 +1,25 @@ +name: 2024 Gleam Tests + +on: + push: + paths: + - "2024/**/*" + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Gleam + run: | + curl -fSsL https://gleam.run/install.sh | sh + export PATH=$HOME/.gleam/bin:$PATH + + - name: Verify Gleam Installation + run: gleam --version + + - name: Run Gleam tests + working-directory: ./2024 + run: gleam test diff --git a/2024/.github/workflows/test.yml b/2024/.github/workflows/test.yml new file mode 100644 index 0000000..c3d0e65 --- /dev/null +++ b/2024/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: test + +on: + push: + branches: + - master + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + otp-version: "27.1.2" + gleam-version: "1.6.2" + rebar3-version: "3" + # elixir-version: "1.15.4" + - run: gleam deps download + - run: gleam test + - run: gleam format --check src test diff --git a/2024/.gitignore b/2024/.gitignore new file mode 100644 index 0000000..599be4e --- /dev/null +++ b/2024/.gitignore @@ -0,0 +1,4 @@ +*.beam +*.ez +/build +erl_crash.dump diff --git a/2024/README.md b/2024/README.md new file mode 100644 index 0000000..08d154a --- /dev/null +++ b/2024/README.md @@ -0,0 +1,24 @@ +# aoc_2024 + +[![Package Version](https://img.shields.io/hexpm/v/aoc_2024)](https://hex.pm/packages/aoc_2024) +[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/aoc_2024/) + +```sh +gleam add aoc_2024@1 +``` +```gleam +import aoc_2024 + +pub fn main() { + // TODO: An example of the project in use +} +``` + +Further documentation can be found at . + +## Development + +```sh +gleam run # Run the project +gleam test # Run the tests +``` diff --git a/2024/gleam.toml b/2024/gleam.toml new file mode 100644 index 0000000..5db54c5 --- /dev/null +++ b/2024/gleam.toml @@ -0,0 +1,22 @@ +name = "aoc_2024" +version = "1.0.0" + +# Fill out these fields if you intend to generate HTML documentation or publish +# your project to the Hex package manager. +# +# description = "" +# licences = ["Apache-2.0"] +# repository = { type = "github", user = "", repo = "" } +# links = [{ title = "Website", href = "" }] +# +# For a full reference of all the available options, you can have a look at +# https://gleam.run/writing-gleam/gleam-toml/. + +[dependencies] +gleam_stdlib = ">= 0.34.0 and < 2.0.0" + +[dev-dependencies] +gleeunit = ">= 1.0.0 and < 2.0.0" + +[javascript] +runtime="bun" diff --git a/2024/manifest.toml b/2024/manifest.toml new file mode 100644 index 0000000..55e0da1 --- /dev/null +++ b/2024/manifest.toml @@ -0,0 +1,11 @@ +# This file was generated by Gleam +# You typically do not need to edit this file + +packages = [ + { name = "gleam_stdlib", version = "0.45.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "206FCE1A76974AECFC55AEBCD0217D59EDE4E408C016E2CFCCC8FF51278F186E" }, + { name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" }, +] + +[requirements] +gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" } +gleeunit = { version = ">= 1.0.0 and < 2.0.0" } diff --git a/2024/src/aoc_2024.gleam b/2024/src/aoc_2024.gleam new file mode 100644 index 0000000..83d91a5 --- /dev/null +++ b/2024/src/aoc_2024.gleam @@ -0,0 +1,5 @@ +import gleam/io + +pub fn main() { + io.println("Hello from aoc_2024!") +} diff --git a/2024/test/aoc_2024_test.gleam b/2024/test/aoc_2024_test.gleam new file mode 100644 index 0000000..3831e7a --- /dev/null +++ b/2024/test/aoc_2024_test.gleam @@ -0,0 +1,12 @@ +import gleeunit +import gleeunit/should + +pub fn main() { + gleeunit.main() +} + +// gleeunit test functions end in `_test` +pub fn hello_world_test() { + 1 + |> should.equal(1) +}