Skip to content

Commit

Permalink
Added initial project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Mar 11, 2024
1 parent 007eb5e commit 54b23da
Show file tree
Hide file tree
Showing 10 changed files with 380 additions and 13 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ci/cd

on:
workflow_dispatch:
push:
branches: [ main, 'release/*' ]
pull_request:
branches: [ main, 'release/*' ]
# Build once a month, just to be sure things are still working
schedule:
- cron: "19 3 26 * *"

jobs:

core-builds:
name: Erlang $ build
runs-on: ubuntu-latest

strategy:
matrix:
otp_version: ['24.3', '25.3', '26.1']

steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: $
rebar3-version: '3.22'
- name: Compile
run: rebar3 compile
- name: Xref Checks
run: rebar3 xref
- name: Dialyzer
run: rebar3 dialyzer
- name: Proper Tests
run: rebar3 as test do compile, proper --regressions
- name: Run Unit Tests
run: rebar3 as test lfe ltest -tall

older-builds:
name: Old Erlang $ build
runs-on: ubuntu-20.04

strategy:
matrix:
otp_version: ['21.3', '22.3', '23.3']

steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: $
rebar3-version: '3.15'
- name: Compile
run: rebar3 compile
- name: Xref Checks
run: rebar3 xref
- name: Dialyzer
run: rebar3 dialyzer
- name: Compile Tests
run: rebar3 as test compile
- name: Proper Tests
run: rebar3 as test proper --regressions
- name: Run Unit Tests
run: rebar3 as test lfe ltest -tall
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.DS_Store
*.beam
*.beam
*.elc
*.iml
*.o
*.plt
*.sublime-project
*.sublime-workspace
*.swo
*.swp
*~
.\#*
.erlang.cookie
.eunit
.idea
.rebar/*
.rebar3
/.emacs.desktop
/.emacs.desktop.lock
\#*\#
_*
_build/*
auto-save-list
bin
deps
ebin
erl_crash.dump
log
logs
rebar/*
rebar3.crashdump
tramp
priv/images/drafts
13 changes: 1 addition & 12 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,7 @@

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024, Duncan McGreggor <[email protected]>.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
67 changes: 66 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,67 @@
# xrepl
An experimnental headless LFE REPL

[![Build Status][gh-actions-badge]][gh-actions]
[![LFE Versions][lfe-badge]][lfe]
[![Erlang Versions][erlang-badge]][version]
[![Tags][github-tags-badge]][github-tags]

[![Project Logo][logo]][logo-large]

*An experimental, general purpose LFE REPL*

##### Table of Contents

* [About](#about-)
* [Build](#build-)
* [Start the Project REPL](#start-the-repl-)
* [Tests](#tests-)
* [Usage](#usage-)
* [License](#license-)

## About [&#x219F;](#table-of-contents)

TBD

## Build [&#x219F;](#table-of-contents)

```shell
$ rebar3 lfe compile
```

# Start the Project REPL [&#x219F;](#table-of-contents)

```shell
$ rebar3 lfe repl
```

# Tests [&#x219F;](#table-of-contents)

```shell
$ rebar3 as test lfe ltest
```

## Usage [&#x219F;](#table-of-contents)

TBD

## License [&#x219F;](#table-of-contents)

Apache License, Version 2.0

Copyright © 2024, The LFE Community <http://lfe.io>.

[//]: ---Named-Links---

[logo]: resources/images/project-art-large.jpg
[logo-large]: resources/images/project-art-large.jpg
[github]: https://github.com/lfe/xrepl
[gitlab]: https://gitlab.com/lfe/xrepl
[gh-actions-badge]: https://github.com/lfe/xrepl/actions/workflows/cicd.yml/badge.svg
[gh-actions]: https://github.com/ORG/xrepl/actions/workflows/cicd.yml
[lfe]: https://github.com/lfe/lfe
[lfe-badge]: https://img.shields.io/badge/lfe-2.1-blue.svg
[erlang-badge]: https://img.shields.io/badge/erlang-21%20to%2026-blue.svg
[version]: https://github.com/ORG/xrepl/blob/main/.github/workflows/cicd.yml
[github-tags]: https://github.com/ORG/xrepl/tags
[github-tags-badge]: https://img.shields.io/github/tag/lfe/xrepl.svg
[github-downloads]: https://img.shields.io/github/downloads/lfe/xrepl/total.svg
Binary file added priv/images/project-art-large.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{erl_opts, [debug_info]}.

{deps, [
{lfe, "2.1.3"},
{ltest, "0.13.6"}
]}.

{plugins, [
{rebar3_lfe, "0.4.9"}
]}.

{provider_hooks, [
{pre, [{compile, {lfe, compile}}]}
]}.

{xref_checks,[
undefined_function_calls,undefined_functions,locals_not_used,
deprecated_function_calls,deprecated_functions
]}.

{profiles, [
{test, [
{deps, [
{proper, "1.4.0"}
]},
{plugins, [
{rebar3_proper, "0.12.1"}
]},
{eunit_opts, [verbose]},
{erl_opts, [{src_dirs, ["src", "test"]}]}
]}
]}.

{alias, [
{coverage, [
{proper, "-c"},
{cover, "-v --min_coverage=0"}
]},
{check, [
compile,
%%xref,
%%dialyzer,
eunit,
coverage
]}
]}.
19 changes: 19 additions & 0 deletions src/xrepl-app.lfe
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(defmodule xrepl-app
(behaviour application)
;; app implementation
(export
(start 2)
(stop 1)))

;;; --------------------------
;;; application implementation
;;; --------------------------

(defun start (_type _args)
(logger:set_application_level 'xrepl 'all)
(logger:info "Starting xrepl application ...")
(xrepl-sup:start_link))

(defun stop (_state)
(xrepl-sup:stop)
'ok)
51 changes: 51 additions & 0 deletions src/xrepl-sup.lfe
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
(defmodule xrepl-sup
(behaviour supervisor)
;; supervisor implementation
(export
(start_link 0)
(stop 0))
;; callback implementation
(export
(init 1)))

;;; ----------------
;;; config functions
;;; ----------------

(defun SERVER () (MODULE))
(defun supervisor-opts () '())
(defun sup-flags ()
`#M(strategy one_for_one
intensity 3
period 60))

;;; -------------------------
;;; supervisor implementation
;;; -------------------------

(defun start_link ()
(supervisor:start_link `#(local ,(SERVER))
(MODULE)
(supervisor-opts)))

(defun stop ()
(gen_server:call (SERVER) 'stop))

;;; -----------------------
;;; callback implementation
;;; -----------------------

(defun init (_args)
`#(ok #(,(sup-flags) (,(child 'xrepl 'start_link '())))))

;;; -----------------
;;; private functions
;;; -----------------

(defun child (mod fun args)
`#M(id ,mod
start #(,mod ,fun ,args)
restart permanent
shutdown 2000
type worker
modules (,mod)))
15 changes: 15 additions & 0 deletions src/xrepl.app.src
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{application, 'xrepl', [
{description, "An experimental, general purpose LFE REPL"},
{vsn, git},
{registered, []},
{mod, {'xrepl-app', []}},
{applications, [
kernel,
stdlib
]},
{env,[]},
{modules, []},

{licenses, ["Apache 2.0"]},
{links, []}
]}.
Loading

0 comments on commit 54b23da

Please sign in to comment.