Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Sep 8, 2024
1 parent 89f8fa3 commit 02ff1c6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,4 @@ jobs:
# so we need to cache per OTP
key: mix-otp-${{ matrix.pair.otp }}-deps-${{ hashFiles('**/mix.lock') }}

- run: mix deps.get --check-locked

- run: mix format --check-formatted
if: ${{ matrix.lint }}

- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}

- run: mix deps.compile

- run: mix compile --no-optional-deps --warnings-as-errors
if: ${{ matrix.lint }}

- run: mix test --slowest 5
if: ${{ ! matrix.lint }}

- run: mix test --slowest 5 --warnings-as-errors
if: ${{ matrix.lint }}
- run: mix ci
2 changes: 1 addition & 1 deletion lib/req/request.ex
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ defmodule Req.Request do
deprecated = [:method, :url, :headers, :body, :adapter]

options =
case deprecated -- deprecated -- Keyword.keys(options) do
case deprecated -- (deprecated -- Keyword.keys(options)) do
[] ->
options

Expand Down
32 changes: 31 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ defmodule Req.MixProject do
package: package(),
docs: docs(),
aliases: [
"test.all": ["test --include integration"]
"test.all": ["test --include integration"],
ci: ci()
],
preferred_cli_env: [
"test.all": :test,
ci: :test,
docs: :docs,
"hex.publish": :docs
],
Expand Down Expand Up @@ -124,4 +126,32 @@ defmodule Req.MixProject do
def legacy_headers_as_lists? do
Application.get_env(:req, :legacy_headers_as_lists, false)
end

defp ci do
github? = is_binary(System.get_env("GITHUB_REPOSITORY"))

commands =
[
"deps.get --check-locked",
"deps.unlock --check-unused",
"format --check-formatted",
"deps.compile",
"compile --no-optional-deps --force --warnings-as-errors",
"compile --force --warnings-as-errors",
"test --slowest 5 --warnings-as-errors"
]

for command <- commands do
[task | args] = OptionParser.split(command)

if github? do
IO.puts "::group::#{command}"
Mix.Task.rerun(task, args)
IO.puts "::endgroup::"
else
IO.puts("=> running mix #{command}")
Mix.Task.rerun(task, args)
end
end
end
end

0 comments on commit 02ff1c6

Please sign in to comment.