Skip to content
Merged
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
46 changes: 20 additions & 26 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,40 +47,38 @@ jobs:
uses: actions/cache@v3
with:
path: |
deps
_build
apps/**/deps
apps/**/_build

key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('**/mix.lock') }}
key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('apps/**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-

# Step: Download project dependencies. If unchanged, uses
# the cached version.
- name: Install and compile dependencies
run: |
mix deps.get
mix deps.compile --skip-umbrella-children
make deps.poncho
make deps.compile.poncho

- name: Compile and don't let warnings through
run: mix compile --warnings-as-errors
run: make compile.poncho

# Step: Check that the checked in code has already been formatted.
# This step fails if something was found unformatted.
# Customize this step as desired.
- name: Check Formatting
run: mix format --check-formatted
run: MIX_ENV=dev mix format --check-formatted

# Step: Run credo static code analysis
- name: Credo static analysis
run: mix credo
run: make credo.check.poncho

dialyzer:
runs-on: ubuntu-latest
name: Run Dialyzer
env:
project_mix_lock: ${{ format('{0}{1}', github.workspace, '/mix.lock') }}
projects_ex_blob: ${{ format('{0}{1}', github.workspace, '/projects/**/*.ex') }}
projects_locks_blob: ${{ format('{0}{1}', github.workspace, '/projects/*/mix.lock') }}
apps_mix_lock: ${{ format('{0}{1}', github.workspace, 'apps/**/mix.lock') }}
MIX_ENV: dev
steps:
# Step: Setup Elixir + Erlang image as the base.
Expand All @@ -95,13 +93,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set Variables
id: set_mix_lock_hash
run: |
mix_lock_hash="${{ hashFiles(env.project_mix_lock) }}"
projects_hash="${{ hashFiles(env.projects_ex_blob, env.projects_locks_blob) }}"
echo "mix_lock_hash=$mix_lock_hash::$projects_hash" >> "$GITHUB_OUTPUT"

# Step: Define how to cache deps. Restores existing cache if present.
- name: Cache deps
id: cache-deps
Expand All @@ -110,10 +101,10 @@ jobs:
cache-name: cache-elixir-deps-1
with:
path: |
deps
_build
apps/**/deps
apps/**/_build

key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('**/mix.lock') }}
key: ${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-${{ hashFiles('apps/**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.DEFAULT_ELIXIR }}-${{ env.DEFAULT_OTP }}-

Expand All @@ -123,7 +114,10 @@ jobs:
uses: actions/cache@v3
with:
path: "priv/plts"
key: lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-${{ steps.set_mix_lock_hash.outputs.mix_lock_hash }}
key: lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-${{ hashFiles('apps/**/mix.lock' ) }}-${{ github.run_id }}
restore-keys: |
lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-${{ hashFiles('apps/**/mix.lock') }}-
lexical-plts-2-${{ env.DEFAULT_OTP }}-${{ env.DEFAULT_ELIXIR }}-

# Step: Download project dependencies. If unchanged, uses
# the cached version.
Expand Down Expand Up @@ -194,17 +188,17 @@ jobs:
uses: actions/cache@v3
with:
path: |
deps
_build
apps/**/deps
apps/**/_build

key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('apps/**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-

# Step: Download project dependencies. If unchanged, uses
# the cached version.
- name: Install and compile the app
run: make compile.all
run: make compile.poncho

# Step: Execute the tests.
- name: Run tests
Expand Down
45 changes: 31 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
dialyzer_dirs = lexical_shared lexical_plugin
poncho_dirs = common lexical_credo proto protocol remote_control server

compile.all: compile.umbrella
dialyzer_dirs= lexical_shared lexical_plugin

dialyzer.all: compile.all dialyzer.umbrella
compile.all: compile.poncho

test.all: test.umbrella
dialyzer.all: compile.poncho dialyzer.poncho

dialyzer.plt.all: dialyzer.plt.umbrella
test.all: test.poncho

dialyzer.umbrella:
mix dialyzer
dialyzer.plt.all: dialyzer.plt.poncho

dialyzer.plt.umbrella:
mix dialyzer --plt
env.test:
export MIX_ENV=test

test.umbrella:
mix test
deps.poncho:
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.get && cd ../..;)

compile.umbrella:
mix deps.get
mix compile --skip-umbrella-children --warnings-as-errors
deps.compile.poncho: deps.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.compile && cd ../..;)

compile.poncho: deps.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.get && mix compile --warnings-as-errors && cd ../..;)

compile.protocols.poncho: deps.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix deps.get && mix compile.protocols --warnings-as-errors && cd ../..;)

test.poncho: deps.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && MIX_ENV=test mix test && cd ../..;)

format.check.poncho: env.test deps.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix format --check-formatted && cd ../..;)

credo.check.poncho: deps.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix credo && cd ../..;)

dialyzer.plt.poncho:
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix dialyzer --plt && cd ../..;)

dialyzer.poncho: compile.poncho compile.protocols.poncho
$(foreach dir, $(poncho_dirs), cd apps/$(dir) && mix dialyzer && cd ../..;)
3 changes: 3 additions & 0 deletions apps/common/.credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Code.require_file("../../mix_credo.exs")

Mix.Credo.config(excluded: ["lib/future/**/*.ex"])
2 changes: 0 additions & 2 deletions config/config.exs → apps/common/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ config :snowflake,
machine_id: 1,
# First second of 2024
epoch: 1_704_070_800_000

import_config("#{Mix.env()}.exs")
11 changes: 6 additions & 5 deletions apps/common/mix.exs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
defmodule Common.MixProject do
use Mix.Project
Code.require_file("../../mix_includes.exs")

def project do
[
app: :common,
version: "0.7.2",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
compilers: [:yecc] ++ Mix.compilers()
compilers: [:yecc] ++ Mix.compilers(),
dialyzer: Mix.Dialyzer.config()
]
end

Expand All @@ -33,6 +31,9 @@ defmodule Common.MixProject do

defp deps do
[
{:benchee, "~> 1.3", only: :test},
Mix.Credo.dependency(),
Mix.Dialyzer.dependency(),
{:snowflake, "~> 1.0"},
{:sourceror, "~> 1.7"},
{:stream_data, "~> 1.1", only: [:test], runtime: false},
Expand Down
15 changes: 15 additions & 0 deletions apps/common/mix.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%{
"benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"patch": {:hex, :patch, "0.15.0", "947dd6a8b24a2d2d1137721f20bb96a8feb4f83248e7b4ad88b4871d52807af5", [:mix], [], "hexpm", "e8dadf9b57b30e92f6b2b1ce2f7f57700d14c66d4ed56ee27777eb73fb77e58d"},
"snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"},
"sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"},
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
"stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"},
}
3 changes: 3 additions & 0 deletions apps/lexical_credo/.credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Code.require_file("../../mix_credo.exs")

Mix.Credo.config()
12 changes: 5 additions & 7 deletions apps/lexical_credo/mix.exs
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
defmodule LexicalCredo.MixProject do
use Mix.Project

Code.require_file("../../mix_dialyzer.exs")
@repo_url "https://github.com/lexical-lsp/lexical/"
@version "0.5.0"

def project do
[
app: :lexical_credo,
version: @version,
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs()
docs: docs(),
dialyzer: Mix.Dialyzer.config(add_apps: [:jason])
]
end

Expand All @@ -30,8 +27,9 @@ defmodule LexicalCredo.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:common, in_umbrella: true},
{:common, path: "../common", env: Mix.env()},
{:credo, "> 0.0.0", only: [:dev, :test]},
Mix.Dialyzer.dependency(),
{:jason, "> 0.0.0", optional: true},
{:ex_doc, "~> 0.34", optional: true, only: [:dev, :hex]}
]
Expand Down
20 changes: 20 additions & 0 deletions apps/lexical_credo/mix.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%{
"benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
"dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"},
"earmark_parser": {:hex, :earmark_parser, "1.4.43", "34b2f401fe473080e39ff2b90feb8ddfeef7639f8ee0bbf71bb41911831d77c5", [:mix], [], "hexpm", "970a3cd19503f5e8e527a190662be2cee5d98eed1ff72ed9b3d1a3d466692de8"},
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
"ex_doc": {:hex, :ex_doc, "0.37.2", "2a3aa7014094f0e4e286a82aa5194a34dd17057160988b8509b15aa6c292720c", [:mix], [{:earmark_parser, "~> 1.4.42", [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", "4dfa56075ce4887e4e8b1dcc121cd5fcb0f02b00391fd367ff5336d98fa49049"},
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [: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", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
"snowflake": {:hex, :snowflake, "1.0.4", "8433b4e04fbed19272c55e1b7de0f7a1ee1230b3ae31a813b616fd6ef279e87a", [:mix], [], "hexpm", "badb07ebb089a5cff737738297513db3962760b10fe2b158ae3bebf0b4d5be13"},
"sourceror": {:hex, :sourceror, "1.7.1", "599d78f4cc2be7d55c9c4fd0a8d772fd0478e3a50e726697c20d13d02aa056d4", [:mix], [], "hexpm", "cd6f268fe29fa00afbc535e215158680a0662b357dc784646d7dff28ac65a0fc"},
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
"stream_data": {:hex, :stream_data, "1.1.3", "15fdb14c64e84437901258bb56fc7d80aaf6ceaf85b9324f359e219241353bfb", [:mix], [], "hexpm", "859eb2be72d74be26c1c4f272905667672a52e44f743839c57c7ee73a1a66420"},
}
3 changes: 3 additions & 0 deletions apps/proto/.credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Code.require_file("../../mix_credo.exs")

Mix.Credo.config()
14 changes: 7 additions & 7 deletions apps/proto/mix.exs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
defmodule Proto.MixProject do
use Mix.Project
Code.require_file("../../mix_includes.exs")

def project do
[
app: :proto,
version: "0.7.2",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
deps: deps()
deps: deps(),
dialyzer: Mix.Dialyzer.config(add_apps: [:jason])
]
end

Expand All @@ -25,8 +23,10 @@ defmodule Proto.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:jason, "~> 1.4", optional: true},
{:common, in_umbrella: true}
{:common, path: "../common", env: Mix.env()},
Mix.Credo.dependency(),
Mix.Dialyzer.dependency(),
{:jason, "~> 1.4", optional: true}
]
end
end
Loading
Loading