Peter Zhu e15b4e1c56 Bump default compiler to clang-20 in CI
clang-18 has a bug that causes the latest Ractor btest to crash.
2025-11-20 15:10:19 -08:00

134 lines
3.9 KiB
YAML

name: Compiles ruby in a container
description: >-
Makes ruby using a dedicated container
inputs:
tag:
required: false
default: clang-20
description: >-
container image tag to use in this run.
with_gcc:
required: false
description: >-
override compiler path & flags.
CFLAGS:
required: false
description: >-
C compiler flags to override.
CXXFLAGS:
required: false
description: >-
C++ compiler flags to override.
optflags:
required: false
# -O1 is faster than -O3 in our tests... Majority of time are consumed trying
# to optimize binaries. Also GitHub Actions run on relatively modern CPUs
# compared to, say, GCC 4 or Clang 3. We don't specify `-march=native`
# because compilers tend not understand what the CPU is.
default: '-O1'
description: >-
Compiler flags for optimisations.
cppflags:
required: false
description: >-
Additional preprocessor flags.
append_configure:
required: false
default: >-
--without-valgrind
--without-jemalloc
--without-gmp
description: >-
flags to append to configure.
enable_shared:
required: false
default: true
description: >-
Whether to build libruby.so.
check:
required: false
default: ''
description: >-
Whether to run `make check`
test_all:
required: false
default: ''
description: >-
Whether to run `make test-all` with options for test-all.
test_spec:
required: false
default: ''
description: >-
Whether to run `make test-spec` with options for mspec.
static_exts:
required: false
description: >-
whitespace separated list of extensions that need be linked statically.
runs:
using: composite
steps:
- shell: bash
run: docker pull --quiet 'ghcr.io/ruby/ruby-ci-image:${{ inputs.tag }}'
- name: Enable Launchable conditionally
id: enable-launchable
run: echo "enable-launchable=true" >> $GITHUB_OUTPUT
shell: bash
if: >-
${{
github.repository == 'ruby/ruby' ||
(github.repository != 'ruby/ruby' && env.LAUNCHABLE_TOKEN)
}}
- name: compile
shell: bash
run: >-
docker run
--rm
--user=root
--volume '${{ github.workspace }}:/github/workspace:ro'
--workdir=/github/workspace
--entrypoint=/github/workspace/.github/actions/compilers/entrypoint.sh
--env CI
--env GITHUB_ACTION
--env INPUT_WITH_GCC='${{ inputs.with_gcc || inputs.tag }}'
--env INPUT_CFLAGS='${{ inputs.CFLAGS }}'
--env INPUT_CXXFLAGS='${{ inputs.CXXFLAGS }}'
--env INPUT_OPTFLAGS='${{ inputs.OPTFLAGS }}'
--env INPUT_CPPFLAGS='${{ inputs.cppflags }}'
--env INPUT_APPEND_CONFIGURE='${{ inputs.append_configure }}'
--env INPUT_CHECK='${{ inputs.check }}'
--env INPUT_TEST_ALL='${{ inputs.test_all }}'
--env INPUT_TEST_SPEC='${{ inputs.test_spec }}'
--env INPUT_ENABLE_SHARED='${{ inputs.enable_shared }}'
--env INPUT_STATIC_EXTS='${{ inputs.static_exts }}'
--env LAUNCHABLE_ORGANIZATION='${{ github.repository_owner }}'
--env LAUNCHABLE_WORKSPACE='${{ github.event.repository.name }}'
--env LAUNCHABLE_ENABLED='${{ steps.enable-launchable.outputs.enable-launchable || false }}'
--env GITHUB_PR_HEAD_SHA='${{ github.event.pull_request.head.sha || github.sha }}'
--env GITHUB_PULL_REQUEST_URL='${{ github.event.pull_request.html_url }}'
--env GITHUB_REF='${{ github.ref }}'
--env GITHUB_ACTIONS
--env GITHUB_RUN_ID
--env GITHUB_REPOSITORY
--env GITHUB_WORKFLOW
--env GITHUB_RUN_NUMBER
--env GITHUB_EVENT_NAME
--env GITHUB_SHA
--env GITHUB_HEAD_REF
--env GITHUB_SERVER_URL
'ghcr.io/ruby/ruby-ci-image:${{ inputs.tag }}'