Skip to content

Commit

Permalink
Check code format in GitHub Action
Browse files Browse the repository at this point in the history
We also tally the minimum supported Erlang/OTP and Elixir versions in
the deps and GitHub Actions as well as bump GitHub Actions deps.
  • Loading branch information
kianmeng committed May 19, 2024
1 parent 5fc4a60 commit 086a9bd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,32 @@ on: [pull_request]
jobs:
test:
name: "Test"
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
# See https://hexdocs.pm/elixir/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
strategy:
matrix:
include:
- pair:
otp: "23.3.4.20"
elixir: "1.14.5"
- pair:
otp: "26.2.5"
elixir: "1.16.2"
lint: lint
env:
MIX_ENV: test
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup BEAM
uses: erlef/setup-beam@v1
with:
otp-version: "25.2"
elixir-version: "1.14.2"
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}

- name: Fetch Hex Cache
uses: actions/cache@v3
uses: actions/cache@v4
id: hex-cache
with:
path: |
Expand All @@ -29,6 +40,10 @@ jobs:
restore-keys: |
${{ runner.os }}-mix-
- name: Check Code Format
run: mix format --check-formatted
if: ${{matrix.lint}}

- name: Run Tests
run: |
mix deps.get
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.16.2-otp-26
erlang 26.2.2
erlang 26.2.5
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule OpenAPI.MixProject do
[
app: :oapi_generator,
version: @version,
elixir: "~> 1.13",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
name: "OpenAPI Generator",
Expand Down
8 changes: 6 additions & 2 deletions test/open_api/processor/ignore_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ defmodule OpenAPI.Processor.IgnoreTest do
base_file_path = ["components", "schemas", "ignored_schema"]
schema = %OpenAPI.Spec.Schema{schema | "$oag_base_file_path": base_file_path}

Application.put_env(:oapi_generator, @profile, ignore: ["components/schemas/ignored_schema"])
Application.put_env(:oapi_generator, @profile,
ignore: ["components/schemas/ignored_schema"]
)

assert Ignore.ignore_schema?(state, schema)
end
Expand All @@ -68,7 +70,9 @@ defmodule OpenAPI.Processor.IgnoreTest do
ref_path = ["components", "schemas", "ignored_schema"]
schema = %OpenAPI.Spec.Schema{schema | "$oag_last_ref_path": ref_path}

Application.put_env(:oapi_generator, @profile, ignore: ["components/schemas/ignored_schema"])
Application.put_env(:oapi_generator, @profile,
ignore: ["components/schemas/ignored_schema"]
)

assert Ignore.ignore_schema?(state, schema)
end
Expand Down

0 comments on commit 086a9bd

Please sign in to comment.