Packages

Spawn and manage Google Compute Engine instances over the REST API, with pluggable auth, telemetry, and an ergonomic instance builder.

Current section

Files

Jump to
Raw

mix.exs

defmodule GcpCompute.MixProject do
use Mix.Project
@version "0.3.0"
@source_url "https://github.com/nyo16/gcp_compute"
def project do
[
app: :gcp_compute,
version: @version,
# 1.15 is the real floor. The newest constructs in lib/ are
# `Keyword.split/2`, `:persistent_term`, `System.monotonic_time/1` and
# `Logger.warning/1` (all <= 1.11); the test suite's `~c"..."` sigil is the
# only 1.15-specific thing in the repo. It is also exactly the tree floor:
# finch (via req) itself requires ~> 1.15, so nothing below 1.15 is
# installable regardless. The CI matrix proves the claim rather than
# asserting it.
elixir: "~> 1.15",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
description: description(),
package: package(),
docs: docs(),
dialyzer: dialyzer(),
name: "GcpCompute",
source_url: @source_url
]
end
def application do
[
extra_applications: [:logger]
]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
[
{:req, "~> 0.7"},
{:nimble_options, "~> 1.1"},
{:telemetry, "~> 1.2"},
# Optional: the default token provider integrates with Goth, but the
# library never hard-depends on it — bring your own TokenProvider.
{:goth, "~> 1.4", optional: true},
# `lib/` never calls Jason — Req owns all JSON encode/decode, and as of
# req 0.7.4 it still hardcodes `Jason.encode_to_iodata!/1` and
# `Jason.decode/2`. Elixir's native `JSON` is therefore not reachable from
# here, and the dep cannot even be scoped `only: :test`: req and goth both
# require it non-optionally, so Mix rejects a narrower :only. Declared
# explicitly because the test suite decodes a stubbed request body.
{:jason, "~> 1.4"},
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
]
end
defp dialyzer do
[
plt_local_path: "priv/plts",
plt_core_path: "priv/plts",
# CI runs dialyzer with MIX_ENV=test, which compiles `test/support`. The
# ReqStub there calls `ExUnit.Assertions.assert/2` and `flunk/1` to enforce
# its own invariants, and :ex_unit ships with Elixir rather than arriving as
# a dep — so dialyxir's default app list omits it and every call resolves as
# `unknown_function`. A MIX_ENV=dev run does not compile test/support and
# therefore cannot catch this.
plt_add_apps: [:ex_unit]
]
end
defp description do
"Spawn and manage Google Compute Engine instances over the REST API, " <>
"with pluggable auth, telemetry, and an ergonomic instance builder."
end
defp package do
[
licenses: ["MIT"],
links: %{"GitHub" => @source_url, "Changelog" => "#{@source_url}/blob/master/CHANGELOG.md"},
maintainers: ["niko"],
# `guides/*.md` are ExDoc extras, so omitting them made `mix docs` fail
# with File.Error for anyone who vendored the tarball — and hid the guides
# from the source people inspect before adopting a 0.x library.
files: ~w(lib guides mix.exs README.md CHANGELOG.md LICENSE .formatter.exs)
]
end
defp docs do
[
main: "readme",
source_ref: "v#{@version}",
extras: [
"README.md",
"guides/getting-started.md",
"guides/configuring-machines.md",
"guides/testing.md",
"CHANGELOG.md"
],
groups_for_extras: [
Guides: ~r"guides/.*"
],
groups_for_modules: [
"Core API": [GcpCompute, GcpCompute.Instances, GcpCompute.Operations],
Configuration: [GcpCompute.Config],
Auth: [
GcpCompute.TokenProvider,
GcpCompute.TokenProvider.Goth,
GcpCompute.TokenProvider.Static
],
Data: [
GcpCompute.Instance,
GcpCompute.NetworkInterface,
GcpCompute.Disk,
GcpCompute.Scheduling,
GcpCompute.Operation,
GcpCompute.Error
],
Telemetry: [GcpCompute.Telemetry]
]
]
end
end