Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ on:
jobs:
mix_test:
name: mix test (${{format(matrix.blend != '' && 'Blend {0} | Elixir {1} | Erlang/OTP {1}' || 'Elixir {1} | Erlang/OTP {2}', matrix.blend, matrix.elixir, matrix.otp)}})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- elixir: '1.13.4'
otp: '24.0'
otp: '24.2'
os: 'ubuntu-22.04'
blend: 'lowest'
- elixir: '1.13.4'
otp: '25.0'
- elixir: '1.14.0'
- elixir: '1.14.1'
otp: '25.0'
- elixir: '1.15.2'
otp: '26.0'
- elixir: '1.16.0'
otp: '26.0'
- elixir: '1.17.0'
otp: '27.0.1'
- elixir: '1.18.0'
otp: '27.3.3'
check_formatted: true
warnings_as_errors: true
- elixir: '1.17.0'
otp: '27.0.1'
- elixir: '1.18.0'
otp: '27.3.3'
blend: 'github'
warnings_as_errors: true
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
env:
MIX_ENV: test
BLEND: ${{ matrix.blend }}
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ assets/js/_hooks/
assets/css/_components.css

# Ignore blend compiled artifacts and deps
/blend/_build
/blend/deps
/blend/*/_build
/blend/*/deps
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 27.0.1
elixir 1.17.2-otp-27
erlang 27.3.3
elixir 1.18.3-otp-27
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.6.4 (yyyy-mm-dd)

* Fix warning on calling component_type
* Support makeup_elixir `~> 1.0`

## v0.6.3 (2024-09-24)

* Remove dependency on Surface Forms (#56)
Expand Down
2 changes: 2 additions & 0 deletions blend.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# To run a mix task in all blends configure the following alias and run `blend <mix_task>`
# `alias blend='mix blend.list | xargs -t -I % env BLEND=% mix'
%{
local: [
{:surface, path: "../surface"}
Expand Down
1 change: 0 additions & 1 deletion blend/github.mix.lock → blend/github/mix.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
%{
"blend": {:hex, :blend, "0.4.0", "0a7e09eee28a9a92bd495aa559c0e99ea9bd7b42fd7fd4a9dc61e6f1bda294c9", [:mix], [], "hexpm", "e284dbdd4fe8db278347ff12dee3e5410b94f38e22825ce1b281d6e5b1920b31"},
"castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"},
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
Expand Down
1 change: 0 additions & 1 deletion blend/local.mix.lock → blend/local/mix.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
%{
"blend": {:hex, :blend, "0.4.0", "0a7e09eee28a9a92bd495aa559c0e99ea9bd7b42fd7fd4a9dc61e6f1bda294c9", [:mix], [], "hexpm", "e284dbdd4fe8db278347ff12dee3e5410b94f38e22825ce1b281d6e5b1920b31"},
"castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"},
"cowboy": {:hex, :cowboy, "2.12.0", "f276d521a1ff88b2b9b4c54d0e753da6c66dd7be6c9fca3d9418b561828a3731", [:make, :rebar3], [{:cowlib, "2.13.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "8a7abe6d183372ceb21caa2709bec928ab2b72e18a3911aa1771639bef82651e"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
Expand Down
1 change: 0 additions & 1 deletion blend/lowest.mix.lock → blend/lowest/mix.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
%{
"blend": {:hex, :blend, "0.4.0", "0a7e09eee28a9a92bd495aa559c0e99ea9bd7b42fd7fd4a9dc61e6f1bda294c9", [:mix], [], "hexpm", "e284dbdd4fe8db278347ff12dee3e5410b94f38e22825ce1b281d6e5b1920b31"},
"castore": {:hex, :castore, "1.0.5", "9eeebb394cc9a0f3ae56b813459f990abb0a3dedee1be6b27fdb50301930502f", [:mix], [], "hexpm", "8d7c597c3e4a64c395980882d4bca3cebb8d74197c590dc272cfd3b6a6310578"},
"cowboy": {:hex, :cowboy, "2.11.0", "356bf784599cf6f2cdc6ad12fdcfb8413c2d35dab58404cf000e1feaed3f5645", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "0fa395437f1b0e104e0e00999f39d2ac5f4082ac5049b67a5b6d56ecc31b1403"},
"cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"},
Expand Down
22 changes: 16 additions & 6 deletions blend/premix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ blend = System.get_env("BLEND")

if blend && String.length(blend) > 0 && existing_blend.(blend) do
blend_path = Path.expand("blend")
maybe_put_env.("MIX_LOCKFILE", Path.join([blend_path, "#{blend}.mix.lock"]))
maybe_put_env.("MIX_DEPS_PATH", Path.join([blend_path, "deps", "#{blend}"]))
maybe_put_env.("MIX_BUILD_ROOT", Path.join([blend_path, "_build", "#{blend}"]))
maybe_put_env.("MIX_LOCKFILE", Path.join([blend_path, blend, "mix.lock"]))
maybe_put_env.("MIX_DEPS_PATH", Path.join([blend_path, blend, "deps"]))
maybe_put_env.("MIX_BUILD_ROOT", Path.join([blend_path, blend, "_build"]))
end

defmodule Blend.Premix do
def patch_project(project) do
Keyword.merge(project, maybe_lockfile_option())
project
|> Keyword.merge(maybe_lockfile_option())
|> Keyword.update!(:deps, &patch_deps/1)
end

def patch_deps(mix_deps) do
Expand All @@ -36,12 +38,20 @@ defmodule Blend.Premix do

defp patch_deps(blend, mix_deps) do
blend_deps(blend)
|> Enum.reduce(mix_deps, fn blend_dep, acc ->
|> Enum.reduce(remove_dep(mix_deps, :blend), fn blend_dep, acc ->
verify_requirements!(blend, blend_dep, mix_deps)
List.keystore(acc, elem(blend_dep, 0), 0, blend_dep)
replace_dep(acc, blend_dep)
end)
end

defp remove_dep(deps, dep_name) do
List.keydelete(deps, dep_name, 0)
end

defp replace_dep(deps, dep) do
List.keystore(deps, elem(dep, 0), 0, dep)
end

defp blend_deps(name) do
{blends, []} = Code.eval_file("blend.exs")
Map.fetch!(blends, String.to_atom(name))
Expand Down
21 changes: 16 additions & 5 deletions lib/surface/catalogue/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,27 @@ defmodule Surface.Catalogue.Server do
Application.put_env(:surface_catalogue, __MODULE__.Endpoint, merge_opts(default_opts, opts))
Application.put_env(:phoenix, :serve_endpoints, true)

Task.start(fn ->
Task.start_link(fn ->
require Logger
Process.flag(:trap_exit, true)

children = [
{Phoenix.PubSub, [name: __MODULE__.PubSub, adapter: Phoenix.PubSub.PG2]},
{__MODULE__.Endpoint, [log_access_url: false]}
]

{:ok, _} = Supervisor.start_link(children, strategy: :one_for_one)
require Logger
Logger.info("Access Surface Catalogue at #{__MODULE__.Endpoint.url()}/catalogue")
Process.sleep(:infinity)
case Supervisor.start_link(children, strategy: :one_for_one) do
{:ok, _} ->
Logger.info("Access Surface Catalogue at #{__MODULE__.Endpoint.url()}/catalogue")
Process.sleep(:infinity)

{:error, payload} ->
payload
|> Exception.format_exit()
|> Logger.error()

System.stop(1)
end
end)
end

Expand Down
6 changes: 2 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ if File.exists?("blend/premix.exs") do
else
defmodule Blend.Premix do
def patch_project(project), do: project
def patch_deps(deps), do: deps
end
end

Expand Down Expand Up @@ -88,17 +87,16 @@ defmodule Surface.Catalogue.MixProject do
[
{:surface, "~> 0.10"},
{:earmark, "~> 1.4.21"},
{:makeup_elixir, "~> 0.16.0"},
{:makeup_elixir, "~> 0.16.0 or ~> 1.0"},
{:html_entities, "~> 0.4"},
{:jason, "~> 1.0", only: :dev},
{:plug_cowboy, "~> 2.3", only: :dev},
{:esbuild, "~> 0.2", only: :dev},
{:blend, "~> 0.4.0", only: :dev},
{:blend, "~> 0.5.0", only: :dev},
{:floki, ">= 0.35.3", only: :test},
{:phoenix_live_reload, "~> 1.2", optional: true, only: [:prod, :dev]},
{:ex_doc, ">= 0.31.1", only: :docs}
]
|> Blend.Premix.patch_deps()
end

defp docs do
Expand Down
Loading