Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Github Actions for CI #3

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/actions/setup/macos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Setup macOS environment
description: >-
Installs necessary packages via Homebrew.

inputs: {} # nothing?

outputs: {} # nothing?

runs:
using: composite

steps:
- name: brew
shell: bash
run: |
brew install --quiet gmp libffi openssl@3 zlib autoconf automake libtool

- name: Set ENV
shell: bash
run: |
dir_config() {
local args=() lib var="$1"; shift
for lib in "$@"; do
args+="--with-${lib%@*}-dir=$(brew --prefix $lib)"
done
echo "$var=${args[*]}" >> $GITHUB_ENV
}
dir_config ruby_configure_args gmp
dir_config CONFIGURE_ARGS openssl@3

- name: make sure that kern.coredump=1
shell: bash
run: |
sysctl -n kern.coredump
sudo sysctl -w kern.coredump=1
sudo chmod -R +rwx /cores/

58 changes: 58 additions & 0 deletions .github/actions/setup/ubuntu/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Setup ubuntu environment
description: >-
At the beginning there was no way but to copy & paste `apt-get`
everywhere. But now that we have composite actions, it seems better
merge them into one.

inputs:
arch:
required: false
default: ''
description: >-
Architecture. Because we run this on a GitHub-hosted runner
acceptable value for this input is very limited.

outputs:
arch:
value: ${{ steps.uname.outputs.uname }}
description: >-
Actual architecture. This could be different from the one
passed to the `inputs.arch`. For instance giving `i386` to this
action yields `i686`.

runs:
using: composite

steps:
- name: set SETARCH
shell: bash
run: echo "SETARCH=${setarch}" >> "$GITHUB_ENV"
env:
setarch: ${{ inputs.arch && format('setarch {0} --', inputs.arch) }}

- id: uname
name: uname
shell: bash
run: |
echo uname=`${SETARCH} uname -m` >> "$GITHUB_OUTPUT"
echo dpkg=`${SETARCH} uname -m | sed s/686/386/` >> "$GITHUB_OUTPUT"

- name: apt-get
shell: bash
env:
arch: ${{ inputs.arch && format(':{0}', steps.uname.outputs.dpkg) || '' }}
run: |
set -x
${arch:+sudo dpkg --add-architecture ${arch#:}}
sudo apt-get update -qq || :
sudo apt-get install --no-install-recommends -qq -y -o=Dpkg::Use-Pty=0 \
${arch:+cross}build-essential${arch/:/-} \
libssl-dev${arch} libyaml-dev${arch} libreadline6-dev${arch} \
zlib1g-dev${arch} libncurses5-dev${arch} libffi-dev${arch} \
autoconf ruby
sudo apt-get install -qq -y pkg-config${arch} || :

- uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
with:
ruby-version: '3.3'
bundler: none
107 changes: 107 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: MMTk
on:
push:
paths-ignore:
- '**.md'
pull_request:
# Do not use paths-ignore for required status checks
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
merge_group:

permissions:
contents: read

jobs:
check:
strategy:
fail-fast: false
matrix:
gc:
- mmtk_plan: MarkSweep
mmtk_build: release
timeout: 120
# TODO: debug builds are sufferring from intermittent thread related failures
# - mmtk_plan: MarkSweep
# mmtk_build: debug
# timeout: 120
os: [macos-latest, ubuntu-latest]

env:
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
RUBY_DEBUG: ci

runs-on: ${{ matrix.os }}

if: >-
${{!(false
|| contains(github.event.head_commit.message, '[DOC]')
|| contains(github.event.head_commit.message, 'Document')
|| contains(github.event.pull_request.title, '[DOC]')
|| contains(github.event.pull_request.title, 'Document')
|| contains(github.event.pull_request.labels.*.name, 'Documentation')
|| (github.event_name == 'push' && github.event.pull_request.user.login == 'dependabot[bot]')
)}}

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Install libraries (macOS)
uses: ./.github/actions/setup/macos
if: ${{ contains(matrix.os, 'macos') }}

- name: Install libraries (Ubuntu)
uses: ./.github/actions/setup/ubuntu
if: ${{ contains(matrix.os, 'ubuntu') }}

- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Set MMTk environment variables
run: |
if [[ ${{ matrix.gc.mmtk_build }} == debug ]]; then
echo 'RUST_LOG=' >> $GITHUB_ENV
fi
echo 'RUBY_TEST_TIMEOUT_SCALE=20' >> $GITHUB_ENV
echo 'SYNTAX_SUGGEST_TIMEOUT=60' >> $GITHUB_ENV
echo 'EXCLUDES=./test/.excludes-mmtk' >> $GITHUB_ENV
echo 'MSPECOPT=-B./spec/mmtk.mspec' >> $GITHUB_ENV
echo 'MMTK_PLAN=${{ matrix.gc.mmtk_plan }}' >> $GITHUB_ENV
echo 'GITHUB_WORKFLOW=MMTk' >> $GITHUB_ENV

- name: Install Bundler dependencies
run: bundle install

- uses: actions/checkout@v4
with:
repository: ruby/ruby
path: ruby

- name: configure ruby
working-directory: ruby
run: |
bash autogen.sh
./configure \
--prefix=/opt/homebrew \
--disable-install-doc \
--with-modular-gc=${{ github.workspace }}/tmp/binaries
make -j
make install
echo '/opt/homebrew/bin' >> $GITHUB_PATH

- name: build Ruby & MMTk shared GC
run: |
bundle install
bundle exec rake compile

- name: make test-all
run: >-
RUST_LOG= make -s test-all
${TESTS:+TESTS="$TESTS"}
timeout-minutes: ${{ matrix.gc.timeout || 40 }}
working-directory: ruby
env:
RUBY_TESTOPTS: '-q --tty=no'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: 'typeprof'
PRECHECK_BUNDLED_GEMS: 'no'
RUBY_GC_LIBRARY: mmtk



1 change: 1 addition & 0 deletions gc/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ uint32_t rb_gc_rebuild_shape(VALUE obj, size_t heap_id);
size_t rb_obj_memsize_of(VALUE obj);
void rb_gc_prepare_heap_process_object(VALUE obj);
bool ruby_free_at_exit_p(void);
bool rb_memerror_reentered(void);

#if USE_MODULAR_GC
bool rb_gc_event_hook_required_p(rb_event_flag_t event);
Expand Down
1 change: 1 addition & 0 deletions test/.excludes-mmtk/TestEnv.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
exclude(:test_select_bang_in_ractor, "MMTk does not fully support Ractors")
exclude(:test_each_pair_in_ractor, "MMTk does not fully support Ractors")
Loading