Skip to content

Commit

Permalink
Add MMTk builds to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
eightbitraptor committed Dec 2, 2024
1 parent f9941a1 commit c3e2244
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 0 deletions.
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
96 changes: 96 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
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
- 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
- name: Install Bundler dependencies
run: bundle install

- name: build Ruby & MMTk shared GC
run: rake compile

- name: Verify MMTk bindgen
run: |
cd gc/mmtk
cargo install --force cbindgen
cbindgen --config cbindgen.toml --output ../mmtk.h
if read -n1 -d '' < <(git diff ../mmtk.h); then
git diff ../mmtk.h
exit 1
fi
- name: make check
run: >-
RUST_LOG= make -s check
${TESTS:+TESTS="$TESTS"}
timeout-minutes: ${{ matrix.gc.timeout || 40 }}
working-directory: ./res/ruby
env:
RUBY_TESTOPTS: '-q --tty=no'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: 'typeprof'
PRECHECK_BUNDLED_GEMS: 'no'
RUBY_GC_LIBRARY: mmtk



0 comments on commit c3e2244

Please sign in to comment.