Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into dev/gc-mmtk
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Sep 30, 2024
2 parents dda1488 + d592ddd commit 6d15b94
Show file tree
Hide file tree
Showing 123 changed files with 2,243 additions and 1,324 deletions.
5 changes: 3 additions & 2 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set startup-with-shell off

define hook-run
set $color_type = 0
set $color_highlite = 0
Expand Down Expand Up @@ -1345,3 +1343,6 @@ define print_flags
end

source -s misc/gdb.py

# Moved from beginning, since it fails on older gdbs
set startup-with-shell off
94 changes: 94 additions & 0 deletions .github/actions/compilers/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Compiles ruby in a container
description: >-
Makes ruby using a dedicated container
inputs:
tag:
required: false
default: clang-18
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`
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: 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_ENABLE_SHARED='${{ inputs.enable_shared }}'
--env INPUT_STATIC_EXTS='${{ inputs.static_exts }}'
'ghcr.io/ruby/ruby-ci-image:${{ inputs.tag }}'
96 changes: 96 additions & 0 deletions .github/actions/compilers/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#! /bin/bash

# Copyright (c) 2024 Ruby developers. All rights reserved.
#
# This file is a part of the programming language Ruby. Permission is hereby
# granted, to either redistribute and/or modify this file, provided that the
# conditions mentioned in the file COPYING are met. Consult the file for
# details.

grouped()
{
echo "::group::${@}"
"${@}"
echo "::endgroup::"
}

set -e
set -u
set -o pipefail

srcdir="/github/workspace/src"
builddir="$(mktemp -dt)"

export GITHUB_WORKFLOW='Compilations'
export CONFIGURE_TTY='never'
export RUBY_DEBUG='ci rgengc'
export RUBY_TESTOPTS='-q --color=always --tty=no'
export RUBY_DEBUG_COUNTER_DISABLE='1'
export GNUMAKEFLAGS="-j$((1 + $(nproc --all)))"

case "x${INPUT_ENABLE_SHARED}" in
x | xno | xfalse )
enable_shared='--disable-shared'
;;
*)
enable_shared='--enable-shared'
;;
esac

pushd ${builddir}

grouped ${srcdir}/configure \
-C \
--with-gcc="${INPUT_WITH_GCC}" \
--enable-debug-env \
--disable-install-doc \
--with-ext=-test-/cxxanyargs,+ \
${enable_shared} \
${INPUT_APPEND_CONFIGURE} \
CFLAGS="${INPUT_CFLAGS}" \
CXXFLAGS="${INPUT_CXXFLAGS}" \
optflags="${INPUT_OPTFLAGS}" \
cppflags="${INPUT_CPPFLAGS}" \
debugflags='-ggdb3' # -g0 disables backtraces when SEGV. Do not set that.

popd

if [[ -n "${INPUT_STATIC_EXTS}" ]]; then
echo "::group::ext/Setup"
set -x
mkdir ${builddir}/ext
(
for ext in ${INPUT_STATIC_EXTS}; do
echo "${ext}"
done
) >> ${builddir}/ext/Setup
set +x
echo "::endgroup::"
fi

pushd ${builddir}

case "${INPUT_APPEND_CONFIGURE}" in
*--with-shared-gc*)
export RUBY_GC_LIBRARY='librubygc.default.so'
mkdir -p /home/runner/shared-gc
grouped make shared-gc SHARED_GC=default
;;
esac

grouped make showflags
grouped make all
grouped make test

[[ -z "${INPUT_CHECK}" ]] && exit 0

if [ "$INPUT_CHECK" = "true" ]; then
tests="ruby -ext-"
else
tests="$INPUT_CHECK"
fi

grouped make install
grouped make test-tool
grouped make test-all TESTS="-- $tests"
grouped env CHECK_LEAKS=true make test-spec
8 changes: 5 additions & 3 deletions .github/actions/setup/directories/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ runs:
git config --global init.defaultBranch garbage
- if: inputs.checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
path: ${{ inputs.srcdir }}
fetch-depth: ${{ inputs.fetch-depth }}
Expand All @@ -101,7 +101,7 @@ runs:
- if: steps.which.outputs.autoreconf
shell: bash
working-directory: ${{ inputs.srcdir }}
run: ./autogen.sh
run: ./autogen.sh --install

# This is for MinGW.
- if: runner.os == 'Windows'
Expand Down Expand Up @@ -138,7 +138,9 @@ runs:
run: |
sudo chmod -R go-w /usr/share
chmod -v go-w $HOME $HOME/.config || :
sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || :
SAVE_IFS="$IFS" IFS=:; set $PATH; dirs=() IFS="$SAVE_IFS"
for d do [ ! -d "$d" ] || dirs+=("$d"); done
sudo chmod -v go-w "${dirs[@]}" || :
- if: inputs.dummy-files == 'true'
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/annocheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- run: id
working-directory:

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
sparse-checkout-cone-mode: false
sparse-checkout: /.github
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/baseruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler: none

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- uses: ./.github/actions/setup/ubuntu

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bundled_gems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
)}}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- uses: ./.github/actions/setup/ubuntu
if: ${{ contains(matrix.os, 'ubuntu') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Install libraries
if: ${{ contains(matrix.os, 'macos') }}
Expand Down
Loading

0 comments on commit 6d15b94

Please sign in to comment.