Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 84e1a08

Browse files
committed
First attempt at reusing 3.4-asan builds automatically
1 parent 8ebb7fa commit 84e1a08

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
outputs:
2020
should_build: ${{ steps.check_commit.outputs.should_build }}
21+
should_build_3_4_asan: ${{ steps.check_commit.outputs.should_build_3_4_asan }}
2122
commit: ${{ steps.latest_commit.outputs.commit }}
2223
commit_3_4_asan: ${{ steps.latest_commit_3_4_asan.outputs.commit }}
2324
previous_release: ${{ steps.check_commit.outputs.previous_release }}
@@ -50,12 +51,14 @@ jobs:
5051
const latest34ASan = "${{ steps.latest_commit_3_4_asan.outputs.commit }}"
5152
const { owner, repo } = context.repo
5253
let { data: release } = await github.rest.repos.getLatestRelease({ owner, repo })
53-
const firstLine = release.body.split('\n')[0]
54-
const latestReleaseCommit = firstLine.split('@')[1]
54+
const latestReleaseCommit = release.body.split('\n')[0].split('@')[1]
55+
// Entry in body may not exist, but if it doesn't the should_build_3_4_asan is still correct
56+
const latestRelease34ASanCommit = (release.body.split('\n')[1] ?? "").split('@')[1]
5557
console.log(`Latest release commit: ${latestReleaseCommit}`)
5658
console.log(`Latest ruby commit: ${latestDevCommit}`)
5759
console.log(`Latest 3.4-asan: ${latest34ASan}`)
5860
core.setOutput('should_build', latestReleaseCommit !== latestDevCommit)
61+
core.setOutput('should_build_3_4_asan', latestRelease34ASanCommit !== latest34ASan)
5962
core.setOutput('previous_release', release.tag_name)
6063
- name: Compute build and reuse matrix
6164
uses: actions/github-script@v7
@@ -64,6 +67,7 @@ jobs:
6467
script: |
6568
const osList = ['ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04', 'ubuntu-22.04-arm', 'ubuntu-24.04-arm', 'macos-13', 'macos-14']
6669
const skipSlow = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }}"
70+
const skip34ASan = "${{ steps.check_commit.outputs.should_build_3_4_asan == 'false' }}"
6771
const buildMatrix = JSON.stringify(
6872
skipSlow === 'false' ?
6973
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] } :
@@ -72,7 +76,10 @@ jobs:
7276
core.setOutput('build_matrix', buildMatrix)
7377
const reuseMatrix = JSON.stringify(
7478
skipSlow === 'false' ?
75-
{ os: ['ubuntu-latest'], name: ['noop'] } : // GitHub doesn't like having an empty matrix, skips jobs that depend on reuse-slow
79+
(skip34ASan === 'false' ?
80+
{ os: ['ubuntu-latest'], name: ['noop'] } : // GitHub doesn't like having an empty matrix, skips jobs that depend on reuse-slow
81+
{ os: ['ubuntu-24.04'], name: ['3.4-asan'] }
82+
) :
7683
{ os: osList, name: ['debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] }
7784
)
7885
core.setOutput('reuse_matrix', reuseMatrix)
@@ -101,8 +108,13 @@ jobs:
101108
fi
102109
echo "tag=$tag" >> $GITHUB_OUTPUT
103110
- name: Set release description to built hash
104-
run: echo "ruby/ruby@${{ needs.prepare.outputs.commit }}" >> release-description.md
105-
- name: Append note if buils were reused
111+
run: echo "master: ruby/ruby@${{ needs.prepare.outputs.commit }}" >> release-description.md
112+
- name: Set release description to 3.4-asan built hash
113+
run: echo "3.4-asan: ruby/ruby@${{ needs.prepare.outputs.commit_3_4_asan }}" >> release-description.md
114+
- name: Append note if 3.4-asan build was reused
115+
if: ${{ needs.prepare.outputs.should_build_3_4_asan == 'false' }}
116+
run: echo "Skipped building and reused build from ${{ needs.prepare.outputs.previous_release }} for 3.4-asan ruby" >> release-description.md
117+
- name: Append note if builds were reused
106118
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }}
107119
run: echo "Skipped building and reused builds from ${{ needs.prepare.outputs.previous_release }} for debug and asan rubies" >> release-description.md
108120
- name: Create Release

0 commit comments

Comments
 (0)