Skip to content

Commit 0a15a75

Browse files
authored
Workflows macos (#1552)
Add workflows to build and release on macos.
1 parent 5afd375 commit 0a15a75

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

.github/workflows/build.yml

+21
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,24 @@ jobs:
110110
run: rebar3 do dialyzer, xref
111111
- name: Produce Documentation
112112
run: rebar3 edoc
113+
macos:
114+
# Smaller job for MacOS to avoid excessive billing
115+
strategy:
116+
matrix:
117+
platform: [macos-latest]
118+
otp-version: [27]
119+
runs-on: ${{ matrix.platform }}
120+
steps:
121+
- uses: actions/checkout@v2
122+
- name: Install Erlang
123+
run: brew install erlang@${{ matrix.otp-version }}
124+
- name: Install Rebar3
125+
run: brew install rebar3
126+
- name: Compile
127+
run: rebar3 compile
128+
- name: Generate Dialyzer PLT for usage in CT Tests
129+
run: dialyzer --build_plt --apps erts kernel stdlib compiler crypto parsetools
130+
- name: Start epmd as daemon
131+
run: epmd -daemon
132+
- name: Run CT Tests
133+
run: rebar3 ct

.github/workflows/release.yml

+32
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,35 @@ jobs:
157157
asset_name: erlang_ls-win32.tar.gz
158158
asset_path: erlang_ls-win32.tar.gz
159159
upload_url: "${{ steps.get_release_url.outputs.upload_url }}"
160+
macos:
161+
# Smaller job for MacOS to avoid excessive billing
162+
strategy:
163+
matrix:
164+
platform: [macos-latest]
165+
otp-version: [24, 25, 26, 27]
166+
runs-on: ${{ matrix.platform }}
167+
steps:
168+
- uses: actions/checkout@v2
169+
- name: Install Erlang
170+
run: brew install erlang@${{ matrix.otp-version }}
171+
- name: Install Rebar3
172+
run: brew install rebar3
173+
- name: Compile
174+
run: rebar3 compile
175+
# Make release artifacts : erlang_ls
176+
- name: Make erlang_ls-${{ matrix.otp-version }}-macos.tar.gz
177+
run: 'tar -zcvf erlang_ls-${{ matrix.otp-version }}-macos.tar.gz -C _build/default/bin/ erlang_ls'
178+
- env:
179+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
180+
id: get_release_url
181+
name: Get release url
182+
uses: "bruceadams/[email protected]"
183+
- env:
184+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
185+
name: Upload release erlang_ls-${{ matrix.otp-version }}-macos.tar.gz
186+
uses: "actions/[email protected]"
187+
with:
188+
asset_content_type: application/octet-stream
189+
asset_name: erlang_ls-${{ matrix.otp-version }}-macos.tar.gz
190+
asset_path: erlang_ls-${{ matrix.otp-version }}-macos.tar.gz
191+
upload_url: "${{ steps.get_release_url.outputs.upload_url }}"

apps/els_lsp/test/els_diagnostics_SUITE.erl

+11-2
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ use_long_names_no_domain(_Config) ->
668668
NodeName =
669669
"my_node@" ++ HostName,
670670
Node = list_to_atom(NodeName),
671-
?assertMatch(Node, els_config_runtime:get_node_name()),
671+
?assertMatch(Node, strip_local(els_config_runtime:get_node_name())),
672672
ok.
673673

674674
-spec use_long_names_custom_hostname(config()) -> ok.
@@ -677,7 +677,7 @@ use_long_names_custom_hostname(_Config) ->
677677
NodeName = "[email protected]",
678678
Node = list_to_atom(NodeName),
679679
?assertMatch(HostName, "127.0.0.1"),
680-
?assertMatch(Node, els_config_runtime:get_node_name()),
680+
?assertMatch(Node, strip_local(els_config_runtime:get_node_name())),
681681
ok.
682682

683683
-spec epp_with_nonexistent_macro(config()) -> ok.
@@ -1066,6 +1066,15 @@ unused_macros_refactorerl(_Config) ->
10661066
%%==============================================================================
10671067
%% Internal Functions
10681068
%%==============================================================================
1069+
strip_local(Node) ->
1070+
list_to_atom(strip_local(atom_to_list(Node), [])).
1071+
1072+
strip_local([], Acc) ->
1073+
lists:reverse(Acc);
1074+
strip_local(".local", Acc) ->
1075+
lists:reverse(Acc);
1076+
strip_local([H | T], Acc) ->
1077+
strip_local(T, [H | Acc]).
10691078

10701079
mock_compiler_telemetry_enabled() ->
10711080
meck:new(els_config, [passthrough, no_link]),

0 commit comments

Comments
 (0)