|
18 | 18 | runs-on: ubuntu-latest |
19 | 19 | outputs: |
20 | 20 | should_build: ${{ steps.check_commit.outputs.should_build }} |
| 21 | + should_build_3_4_asan: ${{ steps.check_commit.outputs.should_build_3_4_asan }} |
21 | 22 | commit: ${{ steps.latest_commit.outputs.commit }} |
22 | 23 | commit_3_4_asan: ${{ steps.latest_commit_3_4_asan.outputs.commit }} |
23 | 24 | previous_release: ${{ steps.check_commit.outputs.previous_release }} |
@@ -50,30 +51,37 @@ jobs: |
50 | 51 | const latest34ASan = "${{ steps.latest_commit_3_4_asan.outputs.commit }}" |
51 | 52 | const { owner, repo } = context.repo |
52 | 53 | 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].trim() |
| 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] ?? "").trim() |
55 | 57 | console.log(`Latest release commit: ${latestReleaseCommit}`) |
| 58 | + console.log(`Latest 3.4-asan release commit: ${latestRelease34ASanCommit}`) |
56 | 59 | console.log(`Latest ruby commit: ${latestDevCommit}`) |
57 | 60 | console.log(`Latest 3.4-asan: ${latest34ASan}`) |
58 | 61 | core.setOutput('should_build', latestReleaseCommit !== latestDevCommit) |
| 62 | + core.setOutput('should_build_3_4_asan', latestRelease34ASanCommit !== latest34ASan) |
59 | 63 | core.setOutput('previous_release', release.tag_name) |
60 | 64 | - name: Compute build and reuse matrix |
61 | 65 | uses: actions/github-script@v7 |
62 | 66 | id: matrix |
63 | 67 | with: |
64 | 68 | script: | |
65 | 69 | const osList = ['ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04', 'ubuntu-22.04-arm', 'ubuntu-24.04-arm', 'macos-13', 'macos-14'] |
| 70 | + const asanHead = { os: 'ubuntu-24.04', name: 'asan' } |
| 71 | + const asan34 = { os: 'ubuntu-24.04', name: '3.4-asan' } |
66 | 72 | const skipSlow = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }}" |
| 73 | + const skip34ASan = "${{ steps.check_commit.outputs.should_build_3_4_asan == 'false' }}" |
67 | 74 | const buildMatrix = JSON.stringify( |
68 | 75 | skipSlow === 'false' ? |
69 | | - { os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] } : |
| 76 | + { os: osList, name: ['head', 'debug'], include: (skip34ASan === 'true' ? [asanHead] : [asanHead, asan34]) } : |
70 | 77 | { os: osList, name: ['head'] } |
71 | 78 | ) |
72 | 79 | core.setOutput('build_matrix', buildMatrix) |
| 80 | + // Note: GitHub doesn't like having an empty matrix, so make sure at least noop is left |
73 | 81 | const reuseMatrix = JSON.stringify( |
74 | 82 | skipSlow === 'false' ? |
75 | | - { os: ['ubuntu-latest'], name: ['noop'] } : // GitHub doesn't like having an empty matrix, skips jobs that depend on reuse-slow |
76 | | - { os: osList, name: ['debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] } |
| 83 | + (skip34ASan === 'true' ? { include: [asan34] } : { os: ['ubuntu-latest'], name: ['noop'] }) : |
| 84 | + { os: osList, name: ['debug'], include: [asanHead, asan34] } |
77 | 85 | ) |
78 | 86 | core.setOutput('reuse_matrix', reuseMatrix) |
79 | 87 | console.log(`build_matrix: ${buildMatrix}, reuse_matrix: ${reuseMatrix}`) |
@@ -101,8 +109,13 @@ jobs: |
101 | 109 | fi |
102 | 110 | echo "tag=$tag" >> $GITHUB_OUTPUT |
103 | 111 | - 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 |
| 112 | + run: echo "master ➜ ruby/ruby@${{ needs.prepare.outputs.commit }}" >> release-description.md |
| 113 | + - name: Set release description to 3.4-asan built hash |
| 114 | + run: echo "3.4-asan ➜ ruby/ruby@${{ needs.prepare.outputs.commit_3_4_asan }}" >> release-description.md |
| 115 | + - name: Append note if 3.4-asan build was reused |
| 116 | + if: ${{ needs.prepare.outputs.should_build_3_4_asan == 'false' }} |
| 117 | + run: echo "Skipped building and reused build from ${{ needs.prepare.outputs.previous_release }} for 3.4-asan ruby" >> release-description.md |
| 118 | + - name: Append note if builds were reused |
106 | 119 | if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }} |
107 | 120 | run: echo "Skipped building and reused builds from ${{ needs.prepare.outputs.previous_release }} for debug and asan rubies" >> release-description.md |
108 | 121 | - name: Create Release |
|
0 commit comments