Skip to content

Commit e6eea74

Browse files
Add matrix to ci tests (#188)
* ci * Turn off unsupported tests * Specify mongo 1.0.0 * Use CI from the mongo driver repo * Specify correct version of ubuntu for tests * Use correct name for previous step in CI * Update excoveralls * Correctly name mongo URL * Use match not equality * Also test individual server topology * Fix typo * Move dialyzer and formatting to non-matrix test
1 parent e278e3d commit e6eea74

File tree

5 files changed

+76
-29
lines changed

5 files changed

+76
-29
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,71 @@ on:
33
- pull_request
44

55
jobs:
6-
test:
7-
runs-on: ubuntu-latest
6+
7+
codeQuality:
8+
name: "Tests & Code Quality"
9+
runs-on: ubuntu-20.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
otpElixir: [
14+
{otp: "24.3.4.10", elixir: "1.14.3"}
15+
]
816
steps:
9-
- uses: actions/checkout@v2
17+
- name: repo checkout
18+
uses: actions/checkout@v2
1019
- uses: erlef/setup-beam@v1
1120
with:
12-
otp-version: "24.0"
13-
elixir-version: "1.12.0"
21+
otp-version: ${{ matrix.otpElixir.otp }}
22+
elixir-version: ${{ matrix.otpElixir.elixir }}
1423
- uses: actions/cache@v2
1524
with:
1625
path: |
1726
deps
1827
_build
19-
priv/plts
20-
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
28+
key: ${{ runner.os }}-${{matrix.otpElixir.otp}}-${{matrix.otpElixir.elixir}}-mix-${{ hashFiles('**/mix.lock') }}
2129
restore-keys: |
22-
${{ runner.os }}-mix-
23-
- run: docker-compose up -d
30+
${{ runner.os }}-${{matrix.otpElixir.otp}}-${{matrix.otpElixir.elixir}}-mix-
2431
- run: mix deps.get
2532
- run: mix credo --strict
2633
continue-on-error: true
2734
- run: mix format --check-formatted
2835
continue-on-error: true
2936
- run: mix dialyzer
37+
test:
38+
runs-on: ubuntu-20.04
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
mongodb: ["4.4", "5.0"]
43+
otpElixir: [
44+
{otp: "22.3.4.26", elixir: "1.12.3"},
45+
{otp: "23.3.4.18", elixir: "1.13.4"},
46+
{otp: "24.3.4.10", elixir: "1.14.3"}
47+
]
48+
topology: [replica_set, server]
49+
steps:
50+
- name: repo checkout
51+
uses: actions/checkout@v2
52+
- id: start-mongodb
53+
name: start mongodb
54+
uses: mongodb-labs/drivers-evergreen-tools@master
55+
with:
56+
version: "${{matrix.mongodb}}"
57+
topology: "${{matrix.topology}}"
58+
- uses: erlef/setup-beam@v1
59+
with:
60+
otp-version: ${{ matrix.otpElixir.otp }}
61+
elixir-version: ${{ matrix.otpElixir.elixir }}
62+
- uses: actions/cache@v2
63+
with:
64+
path: |
65+
deps
66+
_build
67+
key: ${{ runner.os }}-${{matrix.otpElixir.otp}}-${{matrix.otpElixir.elixir}}-mix-${{ hashFiles('**/mix.lock') }}
68+
restore-keys: |
69+
${{ runner.os }}-${{matrix.otpElixir.otp}}-${{matrix.otpElixir.elixir}}-mix-
70+
- run: mix deps.get
3071
- run: mix test
72+
env:
73+
MONGODB_URI: ${{ steps.start-mongodb.outputs.cluster-uri }}

mix.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ defmodule Mongo.Ecto.Mixfile do
3131
{:dialyxir, "~> 1.1.0", only: :dev, runtime: false},
3232
{:ecto, "~> 3.6"},
3333
{:ex_doc, ">= 0.0.0", only: :docs, runtime: false},
34-
{:excoveralls, "~> 0.8", only: :test},
35-
{:mongodb, "~> 1.0.0-beta.1"},
34+
{:excoveralls, "~> 0.16", only: :test},
35+
{:mongodb, "~> 1.0.0"},
3636
{:telemetry, ">= 0.4.0"}
3737
]
3838
end
@@ -56,7 +56,7 @@ defmodule Mongo.Ecto.Mixfile do
5656
[
5757
extras: [
5858
"CHANGELOG.md": [],
59-
"LICENSE": [title: "License"],
59+
LICENSE: [title: "License"],
6060
"README.md": [title: "Overview"]
6161
],
6262
main: "readme",

mix.lock

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
%{
22
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
3-
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm", "fdc6066ceeccb3aa14049ab6edf0b9af3b64ae1b0db2a92d5c52146f373bbb1c"},
3+
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
44
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
55
"credo": {:hex, :credo, "1.5.6", "e04cc0fdc236fefbb578e0c04bd01a471081616e741d386909e527ac146016c6", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "4b52a3e558bd64e30de62a648518a5ea2b6e3e5d2b164ef5296244753fc7eb17"},
6-
"db_connection": {:hex, :db_connection, "2.4.0", "d04b1b73795dae60cead94189f1b8a51cc9e1f911c234cc23074017c43c031e5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad416c21ad9f61b3103d254a71b63696ecadb6a917b36f563921e0de00d7d7c8"},
6+
"db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
77
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
88
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
99
"earmark_parser": {:hex, :earmark_parser, "1.4.18", "e1b2be73eb08a49fb032a0208bf647380682374a725dfb5b9e510def8397f6f2", [:mix], [], "hexpm", "114a0e85ec3cf9e04b811009e73c206394ffecfcc313e0b346de0d557774ee97"},
1010
"ecto": {:hex, :ecto, "3.6.1", "7bb317e3fd0179ad725069fd0fe8a28ebe48fec6282e964ea502e4deccb0bd0f", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "cbb3294a990447b19f0725488a749f8cf806374e0d9d0dffc45d61e7aeaf6553"},
1111
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
1212
"ex_doc": {:hex, :ex_doc, "0.26.0", "1922164bac0b18b02f84d6f69cab1b93bc3e870e2ad18d5dacb50a9e06b542a3", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "2775d66e494a9a48355db7867478ffd997864c61c65a47d31c4949459281c78d"},
13-
"excoveralls": {:hex, :excoveralls, "0.8.1", "0bbf67f22c7dbf7503981d21a5eef5db8bbc3cb86e70d3798e8c802c74fa5e27", [:mix], [{:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "5292c8501901f7a3d0eaf6599cabacaa4ddbf61cc1f1e5fe7200d6e07ee1d33d"},
13+
"excoveralls": {:hex, :excoveralls, "0.16.0", "41f4cfbf7caaa3bc2cf411db6f89c1f53afedf0f1fe8debac918be1afa19c668", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "401205356482ab99fb44d9812cd14dd83b65de8e7ae454697f8b34ba02ecd916"},
1414
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm", "32e95820a97cffea67830e91514a2ad53b888850442d6d395f53a1ac60c82e07"},
1515
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
16-
"hackney": {:hex, :hackney, "1.11.0", "4951ee019df102492dabba66a09e305f61919a8a183a7860236c0fde586134b6", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "bb3cc62ecc10145f8f0965c05083a5278eae7ef1853d340cc9a7a3e27609b9bd"},
17-
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fc1a2f7340c422650504b1662f28fdf381f34cbd30664e8491744e52c9511d40"},
16+
"hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},
17+
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
1818
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
1919
"jsx": {:hex, :jsx, "2.8.3", "a05252d381885240744d955fbe3cf810504eb2567164824e19303ea59eef62cf", [:mix, :rebar3], [], "hexpm", "fc3499fed7a726995aa659143a248534adc754ebd16ccd437cd93b649a95091f"},
2020
"makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"},
2121
"makeup_elixir": {:hex, :makeup_elixir, "0.15.2", "dc72dfe17eb240552857465cc00cce390960d9a0c055c4ccd38b70629227e97c", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "fd23ae48d09b32eff49d4ced2b43c9f086d402ee4fd4fcb2d7fad97fa8823e75"},
2222
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
2323
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
24-
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm", "7a4c8e1115a2732a67d7624e28cf6c9f30c66711a9e92928e745c255887ba465"},
25-
"mongodb": {:hex, :mongodb, "1.0.0-beta.1", "91e13fc8b2039c868526b19498fef420e2d7a3d3fa7c88e11ca84d721aa8928d", [:mix], [{:db_connection, "~> 2.4.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "ce2a0948770e3441ec8d4539b92e3172423b593a20f5b5c518d4285a4bba7047"},
24+
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
25+
"mongodb": {:hex, :mongodb, "1.0.0", "535a7e5d231ec12cd9ff5469e6a7abb68b411521b94b34f00c95659d242c5fe1", [:mix], [{:db_connection, "~> 2.4.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "0976a35cdaa0aa69cd52db6a69cb43da8b21e0df0b24c65ec1b98a9d1c17b29d"},
2626
"nimble_parsec": {:hex, :nimble_parsec, "1.2.0", "b44d75e2a6542dcb6acf5d71c32c74ca88960421b6874777f79153bbbbd7dccc", [:mix], [], "hexpm", "52b2871a7515a5ac49b00f214e4165a40724cf99798d8e4a65e4fd64ebd002c1"},
27-
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm", "4f8805eb5c8a939cf2359367cb651a3180b27dfb48444846be2613d79355d65e"},
27+
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
28+
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
2829
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
29-
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm", "da1d9bef8a092cc7e1e51f1298037a5ddfb0f657fe862dfe7ba4c5807b551c29"},
30+
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
3031
}

test/mongo_ecto_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule Mongo.EctoTest do
1313
import Mongo.Ecto.Helpers
1414

1515
test "command/3" do
16-
assert %{"ok" => 1.0} == Mongo.Ecto.command(TestRepo, ping: 1)
16+
assert %{"ok" => 1.0} = Mongo.Ecto.command(TestRepo, ping: 1)
1717
end
1818

1919
test "truncate/2" do

test/test_helper.exs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,22 @@ ExUnit.start(
2424
:aggregate_filters,
2525
:coalesce,
2626
:concat,
27+
:delete_with_has_many,
28+
:distinct,
2729
:group_by,
2830
:insert_cell_wise_defaults,
2931
:insert_select,
3032
:like_match_blob,
31-
:placeholders,
32-
:preload,
3333
:on_replace_delete_if_exists,
3434
:on_replace_update,
35+
:placeholders,
36+
:preload,
37+
:preload,
3538
:sub_query,
3639
:tagged_types,
3740
:union_with_literals,
3841
:unique_constraint,
39-
:preload,
40-
:distinct,
41-
:delete_with_has_many,
42+
:without_conflict_target,
4243

4344
# For now:
4445
:json_extract_path,
@@ -60,15 +61,17 @@ Application.put_env(
6061
:ecto,
6162
TestRepo,
6263
adapter: Mongo.Ecto,
63-
url: "ecto://localhost:27017/ecto_test",
64+
mongo_url: System.get_env("MONGODB_URI") || "mongodb://localhost:27017",
65+
database: "ecto_test",
6466
pool_size: 1
6567
)
6668

6769
Application.put_env(
6870
:ecto,
6971
Ecto.Integration.PoolRepo,
7072
adapter: Mongo.Ecto,
71-
url: "ecto://localhost:27017/ecto_test",
73+
mongo_url: System.get_env("MONGODB_URI") || "mongodb://localhost:27017",
74+
database: "ecto_test",
7275
pool_size: 5
7376
)
7477

0 commit comments

Comments
 (0)