Skip to content

Commit 66212f6

Browse files
authored
Add GitHub Actions for CI (#148)
1 parent 0ee844d commit 66212f6

File tree

4 files changed

+50
-5
lines changed

4 files changed

+50
-5
lines changed

.github/workflows/main.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Test (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}})
8+
runs-on: ubuntu-16.04
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- otp: 23.0
14+
elixir: 1.11.2
15+
lint: true
16+
- otp: 23.0
17+
elixir: 1.10.3
18+
- otp: 22.3
19+
elixir: 1.10.3
20+
- otp: 22.1
21+
elixir: 1.9.4
22+
- otp: 21.3
23+
elixir: 1.8.2
24+
env:
25+
MIX_ENV: test
26+
steps:
27+
- uses: actions/checkout@v2
28+
29+
- name: Install OTP and Elixir
30+
uses: erlef/setup-elixir@v1
31+
with:
32+
otp-version: ${{matrix.otp}}
33+
elixir-version: ${{matrix.elixir}}
34+
35+
- name: Install dependencies
36+
run: mix deps.get --only test
37+
38+
- name: Check no unused dependencies
39+
run: mix deps.get && mix deps.unlock --check-unused
40+
if: ${{matrix.lint}}
41+
42+
- name: Compile dependencies
43+
run: mix deps.compile
44+
45+
- name: Run tests
46+
run: mix test --trace

priv/templates/enum.ex.eex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule <%= name %> do
22
@moduledoc false
33
use Protobuf<%= options %>
4-
4+
55
<%= type %>
66

77
<%= if not is_nil(desc) do %>
@@ -13,7 +13,6 @@ defmodule <%= name %> do
1313
end
1414
<% end %>
1515

16-
<%= Enum.map fields, fn(field) -> %>
17-
field <%= field %>
16+
<%= Enum.map fields, fn(field) -> %> field <%= field %>
1817
<% end %>
1918
end

test/protobuf/protoc/generator/enum_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ defmodule Protobuf.Protoc.Generator.EnumTest do
2121
assert msg =~ "use Protobuf, enum: true\n"
2222
assert msg =~ "@type t :: integer | :A | :B\n"
2323
refute msg =~ "defstruct "
24-
assert msg =~ "field :A, 0\n\n field :B, 1\n"
24+
assert msg =~ "field :A, 0\n field :B, 1\n"
2525
end
2626
end

test/protobuf/protoc/generator/message_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ defmodule Protobuf.Protoc.Generator.MessageTest do
391391
{[[msg]], _} = Generator.generate(ctx, desc)
392392
assert msg =~ "defmodule Foo.Nested.EnumFoo do\n"
393393
assert msg =~ "use Protobuf, enum: true\n"
394-
assert msg =~ "field :a, 0\n\n field :b, 1\n"
394+
assert msg =~ "field :a, 0\n field :b, 1\n"
395395
end
396396

397397
test "generate/2 supports oneof" do

0 commit comments

Comments
 (0)