From 3f0c4a952fbda1b7da784d004a7fe4153e002761 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 20 Jun 2024 10:32:00 +0200 Subject: [PATCH] Fix CI and bugs for Erlang 27 and Elixir 1.17 (#1926) * Fix Erlang testcases to work with final Erlang 27 release If there are no doc attributes the doc chunk will not be emitted, so we need to add it to tests that don't have any. * Update CI to test/release with Erlang 27 and Elixir 1.17 * Ignore ... when autolinking spec closes #1925 --- .github/workflows/ci.yml | 7 +++++-- .github/workflows/release.yml | 13 +++++++++---- .github/workflows/release_pre_built/action.yml | 4 +++- lib/ex_doc/language/erlang.ex | 2 +- test/ex_doc/retriever/erlang_test.exs | 3 +++ 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0af782773..0f9f4e4d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,12 +16,15 @@ jobs: fail-fast: false matrix: include: - - pair: + - pair: # Test very old elixir and Erlang elixir: "1.13" otp: "22" - - pair: + - pair: # Test Erlang without -doc attribute support elixir: "1.16" otp: "26" + - pair: # Test Erlang with -doc attribute support + elixir: "1.17" + otp: "27" lint: lint steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44bc33b68..cd0359dd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,12 +29,16 @@ jobs: fail-fast: true matrix: include: - - otp: 24 - otp_version: "24.0" - otp: 25 - otp_version: "25.0.4" + otp_version: "25.3.2.12" + elixir_version: "1.16.2" - otp: 26 - otp_version: "26.0.2" + otp_version: "26.2.5" + elixir_version: "1.16.2" + - otp: 27 + otp_version: "27.0" + elixir_version: "1.17.0" + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -44,6 +48,7 @@ jobs: with: otp_version: ${{ matrix.otp_version }} otp: ${{ matrix.otp }} + elixir_version: ${{ matrix.elixir_version }} - name: Upload Pre-built env: diff --git a/.github/workflows/release_pre_built/action.yml b/.github/workflows/release_pre_built/action.yml index f8cc5bd3c..0c976eb91 100644 --- a/.github/workflows/release_pre_built/action.yml +++ b/.github/workflows/release_pre_built/action.yml @@ -5,13 +5,15 @@ inputs: description: "The major OTP version" otp_version: description: "The exact OTP version (major.minor[.patch])" + elixir_version: + description: "The exact Elixir version (major.minor[.patch])" runs: using: "composite" steps: - uses: erlef/setup-beam@v1.16.0 with: otp-version: ${{ inputs.otp_version }} - elixir-version: "1.16.0" + elixir-version: ${{ inputs.elixir_version }} - name: Build ex_doc shell: bash run: | diff --git a/lib/ex_doc/language/erlang.ex b/lib/ex_doc/language/erlang.ex index 4e4342b61..b45cdd1dc 100644 --- a/lib/ex_doc/language/erlang.ex +++ b/lib/ex_doc/language/erlang.ex @@ -561,7 +561,7 @@ defmodule ExDoc.Language.Erlang do name == :record and acc != [] -> {ast, acc} - name in [:"::", :when, :%{}, :{}, :|, :->] -> + name in [:"::", :when, :%{}, :{}, :|, :->, :...] -> {ast, acc} # %{required(...) => ..., optional(...) => ...} diff --git a/test/ex_doc/retriever/erlang_test.exs b/test/ex_doc/retriever/erlang_test.exs index 25d171732..bcba5f3c6 100644 --- a/test/ex_doc/retriever/erlang_test.exs +++ b/test/ex_doc/retriever/erlang_test.exs @@ -11,6 +11,7 @@ defmodule ExDoc.Retriever.ErlangTest do test "module with no docs is generated", c do erlc(c, :mod, ~S""" -module(mod). + -moduledoc(""). """) assert {[_], []} = Retriever.docs_from_modules([:mod], %ExDoc.Config{}) @@ -217,6 +218,7 @@ defmodule ExDoc.Retriever.ErlangTest do erlc(c, :mod, ~S""" -module(mod). -export([f/0]). + -moduledoc(""). f() -> ok. """) @@ -319,6 +321,7 @@ defmodule ExDoc.Retriever.ErlangTest do erlc(c, :mod, ~s""" -module(mod). -export([function/0]). + -moduledoc(""). -record(a, { a = 1 :: pos_integer(), b :: non_neg_integer(),