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
18 changes: 4 additions & 14 deletions .github/workflows/check-formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,25 @@ jobs:
id: cache-tools
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
env:
cache-name: format-checkers
cache-name: tools
with:
path: |
~/go
~/erlfmt
key: ci-${{runner.os}}-${{env.cache-name}}-${{env.ACTIONLINT_VERSION}}-otp_${{steps.otp.outputs.otp-version}}-rebar3_${{steps.otp.outputs.rebar3-version}}-erlfmt_${{env.ERLFMT_VERSION}}
key: ci-${{runner.os}}-${{env.cache-name}}-${{env.ACTIONLINT_VERSION}}

- name: "Install Actionlint"
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
cd "${HOME}"
go install "github.com/rhysd/actionlint/cmd/actionlint@${{env.ACTIONLINT_VERSION}}"

- name: "Install erlfmt"
if: steps.cache-tools.outputs.cache-hit != 'true'
run: |
cd "${HOME}"
git clone --depth 1 -b "${ERLFMT_VERSION}" https://github.com/WhatsApp/erlfmt.git
cd erlfmt
rebar3 as release escriptize

- name: "Add tools to PATH"
- name: "Add actionlint to PATH"
run: |
echo "${HOME}/go/bin" >> "$GITHUB_PATH"
echo "${HOME}/erlfmt/_build/release/bin" >> "$GITHUB_PATH"

- name: "Check formatting"
run: |
rebar3 fmt --check
rebar3 as check fmt --check

- name: "Check workflows"
run: actionlint
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/code_quality_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ jobs:

# shellcheck
- name: "Check generate_fun_data.sh with shellcheck"
run: shellcheck -o require-variable-braces,quote-safe-variables,check-set-e-suppressed,add-default-case,avoid-nullary-conditions generate_fun_data.sh
run: |
shellcheck -o require-variable-braces,quote-safe-variables,check-set-e-suppressed,add-default-case,avoid-nullary-conditions generate_fun_data.sh
shellcheck -o require-variable-braces,quote-safe-variables,check-set-e-suppressed,add-default-case,avoid-nullary-conditions release/{spectrometer,*install}.in
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ This dataset can also be filtered to only list the most frequently used MFA
that AtomVM does not currently support. AtomVM-supported MFA can be listed or
queried by module:function or full module:function/arity.

The ecosystem scanning and filtering is based on Paul Guyot's GitHub Gist
[pguyot/beam_stats.escript](https://gist.github.com/pguyot/da327972f1ecdb7041c97addd4e76bb5).

## Dependencies

This tool uses `git` for gathering ecosystem data and scanning repositories for
Expand All @@ -36,6 +39,55 @@ This bundles all modules into a single escript at
`_build/default/bin/spectrometer`, which can be run directly or
installed system-wide.

## Install

Prepare the application for installation:

rebar3 as prod release
rebar3 as prod tar

Thanks to the magic of rebar3 post-hooks this will create an executable
self-extracting install script that can take an optional install prefix
directory, or use the default `/usr/local` (this will likely require root
privileges).

Example for a user install on Linux:

_build/prod/rel/atomvm_spectrometer/install.sh ${HOME}/.local

Or for a system-wide install to the default directory

sudo _build/prod/rel/atomvm_spectrometer/install.sh

This will install the runtime and application into
`<prefix>/lib/atomvm_spectrometer/` and an executable launcher as
`<prefix>/bin/spectrometer`, for convenience make sure `<prefix>/bin` is in
the user PATH. If not already present, it can be added permanently by adding
`export PATH="${PATH}:<prefix>/bin"` to $HOME/.bashrc or the config file for
your shell of choice.

### Uninstall

The installation includes an uninstall script that will remove all the
application files, and optionally clean up the user cache directory too.

To uninstall atomvm_spectrometer run:

sh ${INSTALL_PREFIX}/lib/atomvm_spectrometer/uninstall.sh

If the application is installed to `/usr/local` and required sudo for
installation then sudo will be required to uninstall.

To uninstall and delete any user cache files run:

sh ${INSTALL_PREFIX}/lib/atomvm_spectrometer/uninstall.sh --full

You may also use the short option `-f` for a full uninstall of the
application and user cache files. If sudo was required for installation then
it will be needed to uninstall, and will miss cleanup of any user cache files
from users other than root. If this is a concern use an install prefix in the
users home directory, such as `~/.local`.

## Commands

| Command | Description |
Expand Down
87 changes: 0 additions & 87 deletions rebar.config

This file was deleted.

151 changes: 151 additions & 0 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
%% Copyright (c) 2026 Winford (UncleGrumpy) <winford@object.stream>
%% All rights reserved.
%%
%% This is part of atomvm_spectrometer
%%
%% SPDX-FileCopyrightText: 2026 Winford (UncleGrumpy) <winford@object.stream>
%% SPDX-License-Identifier: Apache-2.0
%%

Version =
case
string:trim(
os:cmd(
"git describe --tags --dirty 2>/dev/null || echo ''"
)
)
of
"" ->
"0.1.0-pre";
V ->
%% Sanitize version: only allow safe characters [A-Za-z0-9._-]
%% Prevents shell injection via malicious git tags
case re:run(V, "^[A-Za-z0-9._-]+$") of
{match, _} -> V;
nomatch -> "0.0-unknown"
end
end.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

[
{minimum_otp_vsn, "27"},
{erl_opts, [debug_info, {i, "include"}]},
{deps, []},
{escript_incl_apps, [spectrometer]},
{escript_main_app, spectrometer},
{escript_name, spectrometer},
{escript_emu_args, "%%! +sbtu +A1\n"},
{escript_incl_extra, []},
{erlfmt, [
write,
{print_width, 80},
{files, [
"rebar.config{,.script}",
"src/**/*.{hrl,erl,app.src}",
"priv/supported_functions.data",
"test/**/*.{hrl,erl}"
]}
]},
{dialyzer, [
{plt_extra_apps, [
kernel,
stdlib,
compiler,
syntax_tools,
inets,
ssl,
crypto,
public_key
]},
{warnings, [error_handling, unmatched_returns]}
]},
{xref_ignores, [
{spectrometer, main, 1},
{spectrometer_reporter, generate_report, 1},
{spectrometer_reporter, print_summary, 1},
{spectrometer_reporter, write_csv, 3}
]},
{profiles, [
{test, [
{erl_opts, [
{i, "include"},
debug_info,
{d, 'TEST', true},
export_all,
nowarn_export_all,
warnings_as_errors
]},
{cover_enabled, true},
{cover_opts, [verbose]},
{cover_excl_mods, [spectrometer]},
{eunit_opts, [{cover, true}, {scale_timeouts, 20}, {dir, test}]}
]},
{doc, [
{erl_opts, [debug_info]},
{plugins, [rebar3_ex_doc]},
{hex, [{doc, #{provider => ex_doc}}]},
{ex_doc, [
{source_url,
<<"https://github.com/UncleGrumpy/atomvm_spectrometer">>},
{homepage_url,
<<"https://UncleGrumpy.github.io/atomvm_spectrometer">>},
{extras, [
<<"README.md">>,
%% TODO: create these files
%% <<"CHANGELOG.md">>,
%% <<"CONTRIBUTING.md">>,
%% <<"CODE_OF_CONDUCT.md">>,
<<"LICENSE">>,
<<"TODO.md">>
]},
{main, <<"README.md">>},
{output, "doc"},
{api_reference, true}
]}
]},
{check, [{erl_opts, [debug_info, {i, "include"}]}, {plugins, [erlfmt]}]},
{prod, [
{erl_opts, [debug_info, {i, "include"}, nowarn_sasl, {sasl, false}]}
]}
]},

{relx, [
{release, {atomvm_spectrometer, Version}, [
compiler,
crypto,
inets,
kernel,
public_key,
sasl,
spectrometer,
ssl,
stdlib,
syntax_tools
]},
{mode, prod},
{debug_info, keep},
{include_erts, true},
{include_src, false},
{src_tests, true},
{generate_start_script, false},
{extended_start_script, false},
{overlay, [
{template, "release/spectrometer.in", "bin/spectrometer.sh"},
{template, "release/spectrometer.app.src.in",
"src/spectrometer.app.src"},
{template, "release/install.in", "install.sh"},
{template, "release/uninstall.in", "uninstall.sh"}
]}
]},
{provider_hooks, [
{pre, [{release, escriptize}]}
]},
{post_hooks, [
{release,
"cp ${REBAR_BUILD_DIR}/bin/spectrometer ${REBAR_BUILD_DIR}/rel/atomvm_spectrometer/bin/spectrometer"},
{tar,
"cat ${REBAR_BUILD_DIR}/rel/atomvm_spectrometer/atomvm_spectrometer-" ++
Version ++
".tar.gz >> ${REBAR_BUILD_DIR}/rel/atomvm_spectrometer/install.sh"},
{tar, "chmod 755 ${REBAR_BUILD_DIR}/rel/atomvm_spectrometer/install.sh"}
]}
].
Loading
Loading