Skip to content

Commit

Permalink
feat: burrito (aka binary executable) (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhanberg committed Aug 9, 2023
1 parent 5397c23 commit 094fd74
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import_deps: [:gen_lsp],
plugins: [Styler],
inputs: [
"{mix,.formatter}.exs",
".formatter.exs",
"{config,lib,}/**/*.{ex,exs}",
"test/next_ls_test.exs",
"test/test_helper.exs",
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ jobs:

strategy:
matrix:
otp: [24.x, 25.x, 26.x]
elixir: [1.13.x, 1.14.x, 1.15.x]
exclude:
- otp: 26.x
elixir: 1.13.x
otp: [26.0.2]
elixir: [1.15.4]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -51,15 +48,15 @@ jobs:

formatter:
runs-on: ubuntu-latest
name: Formatter (1.15.x/26.x)
name: Formatter

steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: 26.x
elixir-version: 1.15.x
otp-version: 26.0.2
elixir-version: 1.15.4
- uses: actions/cache@v3
with:
path: |
Expand All @@ -83,8 +80,8 @@ jobs:
id: beam
uses: erlef/setup-beam@v1
with:
otp-version: 26.x
elixir-version: 1.15.x
otp-version: 26.0.2
elixir-version: 1.15.4

# Don't cache PLTs based on mix.lock hash, as Dialyzer can incrementally update even old ones
# Cache key based on Elixir & Erlang version (also useful when running in matrix)
Expand Down
76 changes: 40 additions & 36 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,55 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
otp: [25.3]
elixir: [1.14.x]
otp: [26.0.2]
elixir: [1.15.4]
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: elixir
package-name: next_ls
extra-files: |
bin/nextls

- uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}
# - uses: actions/checkout@v3
# if: ${{ steps.release.outputs.release_created }}

- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
if: ${{ steps.release.outputs.release_created }}
# - uses: erlef/setup-beam@v1
# with:
# otp-version: ${{matrix.otp}}
# elixir-version: ${{matrix.elixir}}
# if: ${{ steps.release.outputs.release_created }}

- uses: actions/cache@v3
id: cache
if: ${{ steps.release.outputs.release_created }}
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-
# - uses: actions/cache@v3
# id: cache
# if: ${{ steps.release.outputs.release_created }}
# with:
# path: |
# deps
# _build
# key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
# restore-keys: |
# ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-

# - name: Install Dependencies
# if: steps.release.outputs.release_created && steps.cache.outputs.cache-hit != 'true'
# run: mix deps.get

# we can't publish to hex anymore because burrito is a git dependency

- name: Install Dependencies
if: steps.release.outputs.release_created && steps.cache.outputs.cache-hit != 'true'
run: mix deps.get
# - name: publish to hex
# if: ${{ steps.release.outputs.release_created }}
# env:
# HEX_API_KEY: ${{secrets.HEX_API_KEY}}
# run: |
# mix hex.publish --yes

- name: publish to hex
if: ${{ steps.release.outputs.release_created }}
env:
HEX_API_KEY: ${{secrets.HEX_API_KEY}}
run: |
mix hex.publish --yes
# figure out how to get an apple silicon runner
# to be able to build the burritos on CI
# I will manually build them and upload for now

- name: Upload Release Artifact
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
gh release upload ${{ steps.release.outputs.tag_name }} ./bin/nextls
# - name: Upload Release Artifact
# if: ${{ steps.release.outputs.release_created }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run:
# gh release upload ${{ steps.release.outputs.tag_name }} ./bin/nextls
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ next_ls-*.tar

# Temporary files, for example, from tests.
/tmp/
burrito_out
3 changes: 2 additions & 1 deletion .rtx.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[tools]
elixir = "1.15.2"
elixir = "1.15.4"
erlang = "26.0.2"
zig = "0.10.0"
3 changes: 3 additions & 0 deletions bin/7z
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

7zz "$@"
6 changes: 5 additions & 1 deletion bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

# used for local development

set -e

cd "$(dirname "$0")"/.. || exit 1

iex --sname "next-ls-$RANDOM" -S mix run --no-halt -e "Application.ensure_all_started(:next_ls)" -- "$@"
MIX_ENV=dev mix release --overwrite

./burrito_out/next_ls_macos "$@"
2 changes: 2 additions & 0 deletions lib/next_ls/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ defmodule NextLS.Application do

@impl true
def start(_type, _args) do
Node.start(:"next-ls-#{System.system_time()}", :shortnames)

children = [NextLS.LSPSupervisor]

# See https://hexdocs.pm/elixir/Supervisor.html
Expand Down
2 changes: 1 addition & 1 deletion lib/next_ls/lsp_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule NextLS.LSPSupervisor do
:ignore
else
{opts, _, invalid} =
OptionParser.parse(System.argv(),
OptionParser.parse(Burrito.Util.Args.get_arguments(),
strict: [stdio: :boolean, port: :integer]
)

Expand Down
Loading

0 comments on commit 094fd74

Please sign in to comment.