diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e299591 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +on: + - push + - pull_request + +jobs: + unit_tests: + name: Unit Tests + runs-on: ubuntu-24.04 + env: + MIX_ENV: test + steps: + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: "26.2.5.2" + elixir-version: "1.16.3" + - name: Checkout repository + uses: actions/checkout@v3 + - name: Get dependencies + run: mix deps.get --only test + - name: Compile + run: mix compile + - name: Run unit tests + run: mix test + + type_check: + name: Type Check + runs-on: ubuntu-24.04 + steps: + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: "26.2.5.2" + elixir-version: "1.16.3" + - name: Checkout repository + uses: actions/checkout@v3 + - name: Get dependencies + run: mix deps.get --only dev + - name: Restore PLTs + uses: actions/cache@v1 + with: + path: _build/dev/plt + key: plt-${{ github.ref }}-${{ github.sha }} + restore-keys: | + plt-${{ github.ref }}-${{ github.sha }} + plt-${{ github.ref }}- + plt-refs/heads/master- + - name: Compile + run: mix compile + - name: Run dialyzer + run: mix dialyzer diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23c3525 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where third-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Ignore package tarball (built via "mix hex.build"). +redwire_labs_buildroot_packages-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..26e765d --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +elixir 1.16.3-otp-26 +erlang 26.2.5.2 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..e6fcba7 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright 2024 Redwire Labs LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c90d533 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Redwire Labs Buildroot Packages + +Buildroot packages for Redwire Labs Nerves systems. + +## Installation + +Add this dependency to your Nerves system: + +```elixir +def deps do + [ + {:redwire_labs_buildroot_packages, "~> 0.1.0", runtime: false} + ] +end +``` diff --git a/lib/redwire_labs_buildroot_packages.ex b/lib/redwire_labs_buildroot_packages.ex new file mode 100644 index 0000000..f12ec30 --- /dev/null +++ b/lib/redwire_labs_buildroot_packages.ex @@ -0,0 +1,5 @@ +defmodule RedwireLabsBuildrootPackages do + @moduledoc """ + Buildroot packages for Redwire Labs Nerves systems + """ +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..ad1f210 --- /dev/null +++ b/mix.exs @@ -0,0 +1,74 @@ +defmodule RedwireLabsBuildrootPackages.MixProject do + use Mix.Project + + def project do + [ + app: :redwire_labs_buildroot_packages, + version: "0.1.0", + elixir: "~> 1.16", + start_permanent: Mix.env() == :prod, + aliases: aliases(), + deps: deps(), + description: description(), + package: package(), + docs: docs() + ] + end + + def application do + [ + extra_applications: [:logger] + ] + end + + defp aliases do + [ + "docs.show": ["docs", &open("doc/index.html", &1)] + ] + end + + defp deps do + [ + {:ex_doc, "~> 0.34", only: :dev, runtime: false} + ] + end + + defp description do + """ + Buildroot packages for Redwire Labs Nerves systems + """ + end + + defp docs do + [ + main: "readme", + extras: ["README.md", "LICENSE.txt"] + ] + end + + defp package do + [ + licenses: ["MIT"], + links: %{"GitHub" => "https://github.com/redwirelabs/redwire_labs_buildroot_packages"}, + maintainers: ["Alex McLain"], + files: [ + "lib", + "mix.exs", + "LICENSE.txt", + "README.md" + ] + ] + end + + # Open a file with the default application for its type. + defp open(file, _args) do + # Linux + # Mac + open_command = + System.find_executable("xdg-open") || + System.find_executable("open") || + raise "Could not find executable 'open' or 'xdg-open'" + + System.cmd(open_command, [file]) + end +end diff --git a/mix.lock b/mix.lock new file mode 100644 index 0000000..9e1c874 --- /dev/null +++ b/mix.lock @@ -0,0 +1,8 @@ +%{ + "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, + "ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"}, + "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, +}