Skip to content

Add 3.4-asan builds, try 2 #15

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

Merged
merged 5 commits into from
Feb 18, 2025
Merged
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
20 changes: 15 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
outputs:
should_build: ${{ steps.check_commit.outputs.should_build }}
commit: ${{ steps.latest_commit.outputs.commit }}
commit_3_4_asan: ${{ steps.latest_commit_3_4_asan.outputs.commit }}
previous_release: ${{ steps.check_commit.outputs.previous_release }}
build_matrix: ${{ steps.matrix.outputs.build_matrix }}
reuse_matrix: ${{ steps.matrix.outputs.reuse_matrix }}
Expand All @@ -32,19 +33,28 @@ jobs:
id: latest_commit
working-directory: ruby
run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

- name: Set latest commit (3.4-asan)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it should be named 3.4-asan or asan-3.4.
On one hand for https://github.com/ruby/setup-ruby?tab=readme-ov-file#supported-version-syntax if we consider asan an "engine" it should be asan-3.4.
OTOH it's a special case anyway and I think we should hardcode it like other special head builds (e.g. no version matching).
IOW its engine would be asan-3.4 or 3.4-asan, no "version" from setup-ruby POV.

It's also "3.4 + ASAN" so 3.4-asan is kinda intuitive.
Let's stick with that for now.

id: latest_commit_3_4_asan
working-directory: ruby
run: |
git fetch origin --depth=1 --no-tags '+refs/tags/v3_4_*:refs/tags/v3_4_*'
LATEST_TAG=$(git tag --list | grep -E "v3_4_[0-9]+$" | sort -V | tail -n1)
git checkout "$LATEST_TAG"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Check if latest commit already built
uses: actions/github-script@v7
id: check_commit
with:
script: |
const latestDevCommit = "${{ steps.latest_commit.outputs.commit }}"
const latest34ASan = "${{ steps.latest_commit_3_4_asan.outputs.commit }}"
const { owner, repo } = context.repo
let { data: release } = await github.rest.repos.getLatestRelease({ owner, repo })
const firstLine = release.body.split('\n')[0]
const latestReleaseCommit = firstLine.split('@')[1]
console.log(`Latest release commit: ${latestReleaseCommit}`)
console.log(`Latest ruby commit: ${latestDevCommit}`)
console.log(`Latest 3.4-asan: ${latest34ASan}`)
core.setOutput('should_build', latestReleaseCommit !== latestDevCommit)
core.setOutput('previous_release', release.tag_name)
- name: Compute build and reuse matrix
Expand All @@ -56,14 +66,14 @@ jobs:
const skipSlow = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }}"
const buildMatrix = JSON.stringify(
skipSlow === 'false' ?
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }] } :
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] } :
{ os: osList, name: ['head'] }
)
core.setOutput('build_matrix', buildMatrix)
const reuseMatrix = JSON.stringify(
skipSlow === 'false' ?
{ os: ['ubuntu-latest'], name: ['noop'] } : // GitHub doesn't like having an empty matrix, skips jobs that depend on reuse-slow
{ os: osList, name: ['debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }] }
{ os: osList, name: ['debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] }
)
core.setOutput('reuse_matrix', reuseMatrix)
console.log(`build_matrix: ${buildMatrix}, reuse_matrix: ${reuseMatrix}`)
Expand Down Expand Up @@ -115,7 +125,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: ruby/ruby
ref: ${{ needs.prepare.outputs.commit }}
ref: ${{ matrix.name != '3.4-asan' && needs.prepare.outputs.commit || needs.prepare.outputs.commit_3_4_asan }}
- name: Clone ruby-dev-builder
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -191,7 +201,7 @@ jobs:
# Make the test timeouts more generous too (ASAN is slower)
echo "RUBY_TEST_TIMEOUT_SCALE=5" >> $GITHUB_ENV
echo "SYNTAX_SUGGEST_TIMEOUT=600" >> $GITHUB_ENV
if: matrix.name == 'asan'
if: matrix.name == 'asan' || matrix.name == '3.4-asan'

# Build
- run: mkdir -p ~/.rubies
Expand Down