From 38fe5b921935ffc7c0d159b46b6de6c989fd7690 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Sun, 30 Nov 2025 13:22:07 -0500 Subject: [PATCH 1/5] CI: Create docs composite action and rely on it --- .github/workflows/build_docs/action.yml | 94 +++++++++++++++++++ .github/workflows/ci.yml | 14 +-- .github/workflows/documentation.yml | 40 ++++++++ .../workflows/release_pre_built/action.yml | 38 ++------ 4 files changed, 147 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/build_docs/action.yml create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/build_docs/action.yml b/.github/workflows/build_docs/action.yml new file mode 100644 index 00000000000..d44c26f088b --- /dev/null +++ b/.github/workflows/build_docs/action.yml @@ -0,0 +1,94 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2021 The Elixir Team + +name: Build Elixir Documentation +description: Builds ExDoc and generates Elixir documentation + +permissions: + contents: read + +inputs: + otp_version: + description: The exact OTP version (major.minor[.patch]) + required: true + + ex_doc_version: + description: ExDoc version (main or latest_stable) + required: true + + warnings_as_errors: + description: Fails if ExDoc generates warnings + default: "false" + + zip: + description: Whether to zip the docs + default: "false" + +runs: + using: "composite" + steps: + - uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4 + with: + otp-version: ${{ inputs.otp_version }} + version-type: strict + + - name: Compile Elixir + shell: bash + run: | + make compile + echo "$PWD/bin" >> $GITHUB_PATH + + - name: Build info + shell: bash + run: bin/elixir --version + + - name: Get ExDoc reference + shell: bash + run: | + if [ "${{ inputs.ex_doc_version }}" = "main" ]; then + ref=main + else + ref=v$(curl -s https://hex.pm/api/packages/ex_doc | jq --raw-output '.latest_stable_version') + fi + + echo "EX_DOC_REF=$ref" >> $GITHUB_ENV + + - name: Checkout ExDoc + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + with: + repository: elixir-lang/ex_doc + ref: ${{ env.EX_DOC_REF }} + path: ex_doc + + - name: Compile ExDoc + shell: bash + env: + LANG: C.UTF-8 + run: | + mv ex_doc ../ex_doc + cd ../ex_doc + ../elixir/bin/mix do local.rebar --force + local.hex --force + deps.get + compile && \ + echo "ExDoc successfully built." + + - name: Set DOCS_OPTIONS + shell: bash + run: | + if [[ "${{ inputs.warnings_as_errors }}" == "true" ]]; then + echo "DOCS_OPTIONS=--warnings-as-errors" >> $GITHUB_ENV + else + echo "DOCS_OPTIONS=" >> $GITHUB_ENV + fi + + - name: Build docs + shell: bash + env: + LANG: C.UTF-8 + run: | + cd ../elixir + git fetch --tags + make ${{ inputs.zip == 'true' && 'Docs.zip' || 'docs' }} && \ + if [[ "${{ inputs.warnings_as_errors }}" == "true" ]]; then + echo "Docs successfully generated without warnings." + else + echo "Docs successfully generated." + fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 816ba87aaf0..a29fa8360a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,8 @@ jobs: fail-fast: false matrix: include: + # NOTE: When updating latest Erlang/OTP version, also update it in + # .github/workflows/documentation.yml - otp_version: "28.1" deterministic: true - otp_version: "28.1" @@ -78,19 +80,11 @@ jobs: continue-on-error: ${{ matrix.development }} env: COVER: "${{ matrix.coverage }}" + - name: "Calculate Coverage" run: make cover | tee "$GITHUB_STEP_SUMMARY" if: "${{ matrix.coverage }}" - - name: Build docs (ExDoc main) - if: ${{ matrix.otp_latest }} - run: | - cd .. - git clone https://github.com/elixir-lang/ex_doc.git --depth 1 - cd ex_doc - ../elixir/bin/mix do local.rebar --force + local.hex --force + deps.get + compile - cd ../elixir/ - git fetch --tags - DOCS_OPTIONS="--warnings-as-errors" make docs + - name: Check reproducible builds if: ${{ matrix.deterministic }} run: | diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000000..e1855e2ef04 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2021 The Elixir Team + +name: Elixir Documentation + +on: + push: + paths: &paths-filter + - .github/workflows/documentation.yml + - .github/workflows/build_docs/**/* + - CHANGELOG.md + - Makefile + - VERSION + - lib/**/* + + # Ignore + - "!lib/*/test/**/*" + + pull_request: + paths: *paths-filter + + workflow_dispatch: + +permissions: + contents: read + +jobs: + build_docs: + name: Build docs + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + + - name: Build docs + uses: ./.github/workflows/build_docs + with: + otp_version: "28.1" + ex_doc_version: "main" + warnings_as_errors: true diff --git a/.github/workflows/release_pre_built/action.yml b/.github/workflows/release_pre_built/action.yml index a055fe0bf0f..ba960a9c7f4 100644 --- a/.github/workflows/release_pre_built/action.yml +++ b/.github/workflows/release_pre_built/action.yml @@ -13,6 +13,8 @@ inputs: runs: using: "composite" steps: + - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + - uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # v1.18.2 with: otp-version: ${{ inputs.otp_version }} @@ -35,33 +37,11 @@ runs: export ELIXIR_ZIP=$PWD/elixir-otp-${{ inputs.otp }}.zip (cd lib/elixir/scripts/windows_installer && ./build.sh) mv lib/elixir/scripts/windows_installer/tmp/elixir-otp-${{ inputs.otp }}.exe . - - name: Get ExDoc ref - if: ${{ inputs.build_docs }} - shell: bash - run: | - if [ "${{ github.ref_name }}" = "main" ]; then - ref=main - else - ref=v$(curl -s https://hex.pm/api/packages/ex_doc | jq --raw-output '.latest_stable_version') - fi - echo "EX_DOC_REF=$ref" >> $GITHUB_ENV - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - if: ${{ inputs.build_docs }} - with: - repository: elixir-lang/ex_doc - ref: ${{ env.EX_DOC_REF }} - path: ex_doc - - name: Build ex_doc - if: ${{ inputs.build_docs }} - shell: bash - run: | - mv ex_doc ../ex_doc - cd ../ex_doc - ../elixir/bin/mix do local.rebar --force + local.hex --force + deps.get + compile - cd ../elixir + - name: Build Docs - if: ${{ inputs.build_docs }} - shell: bash - run: | - git fetch --tags - make Docs.zip + if: inputs.build_docs + uses: ./.github/workflows/build_docs + with: + otp_version: ${{ inputs.otp_version }} + ex_doc_version: ${{ github.ref_name == 'main' && 'main' || 'latest_stable' }} + zip: true From 50ba8e830566eb929ea6e0a7a100e8b2e4a1737c Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Mon, 1 Dec 2025 08:51:11 -0500 Subject: [PATCH 2/5] CI: Minor improvements to ci.yml --- .github/workflows/ci.yml | 47 ++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a29fa8360a6..a0e3b6242e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ # SPDX-FileCopyrightText: 2021 The Elixir Team # SPDX-FileCopyrightText: 2012 Plataformatec -name: CI +name: Elixir Building and Testing on: push: @@ -53,47 +53,55 @@ jobs: # when using warnings_as_errors. So we only set ERLC_OPTS # from Erlang/OTP 27+. env: - ERLC_OPTS: ${{ matrix.erlc_opts || '' }} + ERLC_OPTS: ${{ matrix.erlc_opts }} + steps: - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 50 - uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4 with: otp-version: ${{ matrix.otp_version }} + - name: Set ERL_COMPILER_OPTIONS if: ${{ matrix.deterministic }} run: echo "ERL_COMPILER_OPTIONS=deterministic" >> $GITHUB_ENV + - name: Compile Elixir run: | make compile echo "$PWD/bin" >> $GITHUB_PATH + - name: Build info run: bin/elixir --version + - name: Check format - run: make test_formatted && echo "All Elixir source code files are properly formatted." + run: | + make test_formatted && \ + echo "All Elixir source code files are properly formatted." + - name: Erlang test suite run: make test_erlang continue-on-error: ${{ matrix.development }} + - name: Elixir test suite run: make test_elixir continue-on-error: ${{ matrix.development }} env: - COVER: "${{ matrix.coverage }}" - - - name: "Calculate Coverage" - run: make cover | tee "$GITHUB_STEP_SUMMARY" - if: "${{ matrix.coverage }}" + COVER: ${{ matrix.coverage }} - name: Check reproducible builds if: ${{ matrix.deterministic }} run: | rm -rf .git + # Recompile System without .git cd lib/elixir && ../../bin/elixirc -o ebin lib/system.ex && cd - taskset 1 make check_reproducible - - name: "Upload Coverage Artifact" - if: "${{ matrix.coverage }}" + + - name: Calculate Coverage + if: ${{ matrix.coverage }} + run: make cover | tee "$GITHUB_STEP_SUMMARY" + + - name: Upload Coverage Artifact + if: ${{ matrix.coverage }} uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: name: TestCoverage @@ -113,22 +121,29 @@ jobs: steps: - name: Configure Git run: git config --global core.autocrlf input + - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 - with: - fetch-depth: 50 + - uses: erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4 with: otp-version: ${{ matrix.otp_version }} + - name: Compile Elixir run: | Remove-Item -Recurse -Force '.git' make compile + - name: Build info run: bin/elixir --version + - name: Check format - run: make test_formatted && echo "All Elixir source code files are properly formatted." + run: | + make test_formatted && \ + echo "All Elixir source code files are properly formatted." + - name: Erlang test suite run: make test_erlang + - name: Elixir test suite run: | Remove-Item 'c:/Windows/System32/drivers/etc/hosts' From 6304fc276d2f8f832ed03e1b94700c519f61e985 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Sun, 30 Nov 2025 13:28:44 -0500 Subject: [PATCH 3/5] CI: Improve paths in ci.yml Avoids unnecessary changes by being selective on when to launch the action. --- .github/workflows/ci.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a0e3b6242e9..19f881acd8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,11 +6,21 @@ name: Elixir Building and Testing on: push: - paths-ignore: - - "lib/**/*.md" + paths: &paths-filter + - .github/workflows/ci.yml + - lib/*/test/fixtures/**/**.md + + # Ignore + - "!*.{md,yml,jsonc}" + - "!.git*" + - "!.github/workflows/**/*" + - "!.ort/**/*" + - "!lib/*/pages/**/*.md" + - "!LICENSES/*" + - "!man/*" + pull_request: - paths-ignore: - - "lib/**/*.md" + paths: *paths-filter env: ELIXIR_ASSERT_TIMEOUT: 2000 From e278bc21aeafb9a96a4fb4c5b57a8e9b16c65972 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Sat, 29 Nov 2025 23:01:51 -0500 Subject: [PATCH 4/5] CI: Optimize tests in ci.yml Avoid unnecessary checks for certain jobs. --- .github/workflows/ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19f881acd8c..d226c0670a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,8 @@ on: pull_request: paths: *paths-filter + workflow_dispatch: + env: ELIXIR_ASSERT_TIMEOUT: 2000 ELIXIRC_OPTS: "--warnings-as-errors" @@ -37,25 +39,35 @@ jobs: strategy: fail-fast: false + matrix: include: # NOTE: When updating latest Erlang/OTP version, also update it in # .github/workflows/documentation.yml - otp_version: "28.1" + erlc_opts: "warnings_as_errors" deterministic: true + skip_tests: true + - otp_version: "28.1" erlc_opts: "warnings_as_errors" coverage: true + skip_tests: true + - otp_version: "28.1" - otp_latest: true erlc_opts: "warnings_as_errors" + - otp_version: "27.3" erlc_opts: "warnings_as_errors" + - otp_version: "27.0" erlc_opts: "warnings_as_errors" + - otp_version: "26.0" + - otp_version: master development: true + - otp_version: maint development: true @@ -83,15 +95,18 @@ jobs: run: bin/elixir --version - name: Check format + if: ${{ !matrix.skip_tests }} run: | make test_formatted && \ echo "All Elixir source code files are properly formatted." - name: Erlang test suite + if: ${{ !matrix.skip_tests }} run: make test_erlang continue-on-error: ${{ matrix.development }} - name: Elixir test suite + if: ${{ matrix.coverage || !matrix.skip_tests }} run: make test_elixir continue-on-error: ${{ matrix.development }} env: From 258e25c40ddd80e0d6712c4fb573c350070874e1 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Mon, 1 Dec 2025 21:23:10 -0500 Subject: [PATCH 5/5] CI: Fix continue-on-error If a test fails, `continue-on-error` will not be evaluated, if it's not set. https://github.com/eksperimental-forks/elixir/actions/runs/19824449905/job/56794214695#step:9:46 2196 doctests, 4913 tests, 1 failure (18 excluded) make: *** [Makefile:289: test_stdlib] Error 2 Error: Process completed with exit code 2. Error: The step failed and an error occurred when attempting to determine whether to continue on error. Error: The template is not valid. .github/workflows/ci.yml (Line: 78, Col: 28): Unexpected value '' --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d226c0670a0..f3acc4c4d2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,12 +103,12 @@ jobs: - name: Erlang test suite if: ${{ !matrix.skip_tests }} run: make test_erlang - continue-on-error: ${{ matrix.development }} + continue-on-error: ${{ matrix.development == true }} - name: Elixir test suite if: ${{ matrix.coverage || !matrix.skip_tests }} run: make test_elixir - continue-on-error: ${{ matrix.development }} + continue-on-error: ${{ matrix.development == true }} env: COVER: ${{ matrix.coverage }}