-
Notifications
You must be signed in to change notification settings - Fork 191
103 lines (99 loc) · 3.71 KB
/
Copy pathbuild-gems.yml
File metadata and controls
103 lines (99 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build gems
on:
workflow_call:
inputs:
release:
description: "Pass --release to .github/scripts/gem-build (skip timestamp version)"
type: boolean
default: false
artifact_prefix:
description: "Prefix for artifact names (e.g., 'release-v1.10.0-')"
type: string
default: ""
ref:
description: "Git ref to check out (e.g., a version tag). Defaults to the caller's ref."
type: string
default: ""
permissions:
contents: read
jobs:
build_source_gem:
name: "source gem"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.ref || github.ref }}
persist-credentials: false
- uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
ruby-version: "3.4"
bundler-cache: true
- name: Build source gem
run: |
# shellcheck disable=SC2086 # RELEASE_FLAG intentionally word-splits (empty or "--release")
./.github/scripts/gem-build ${RELEASE_FLAG} gems ruby
env:
RELEASE_FLAG: ${{ inputs.release && '--release' || '' }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: "${{ inputs.artifact_prefix }}source-gem"
path: gems
retention-days: 1
build_native_setup:
name: "setup"
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{ steps.rcd_image_version.outputs.rcd_image_version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.ref || github.ref }}
persist-credentials: false
- uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
ruby-version: "3.4"
bundler-cache: true
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> "$GITHUB_OUTPUT"
build_native_gem:
needs: build_native_setup
name: "native gem ${{ matrix.platform }}"
strategy:
# CI runs want to surface every platform's failure (fail-fast: false);
# release runs should stop on first failure to avoid pushing a partial
# set of gems.
fail-fast: ${{ inputs.release }}
matrix:
platform:
- aarch64-linux-gnu
- aarch64-linux-musl
- aarch64-mingw-ucrt
- arm-linux-gnu
- arm-linux-musl
- arm64-darwin
- x64-mingw-ucrt
- x86_64-darwin
- x86_64-linux-gnu
- x86_64-linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.ref || github.ref }}
persist-credentials: false
- name: Build native gem
run: |
# shellcheck disable=SC2086 # RELEASE_FLAG intentionally word-splits (empty or "--release")
docker run --rm -v "$PWD:/work" -w /work \
"ghcr.io/rake-compiler/rake-compiler-dock-image:${RCD_IMAGE_VERSION}-mri-${PLATFORM}" \
./.github/scripts/gem-build ${RELEASE_FLAG} gems "${PLATFORM}"
env:
RCD_IMAGE_VERSION: ${{ needs.build_native_setup.outputs.rcd_image_version }}
RELEASE_FLAG: ${{ inputs.release && '--release' || '' }}
PLATFORM: ${{ matrix.platform }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: "${{ inputs.artifact_prefix }}cruby-${{ matrix.platform }}-gem"
path: gems
retention-days: 1