|
| 1 | +# WARNING: DO NOT EDIT THIS FILE!!! |
| 2 | +# |
| 3 | +# This file is autogenerated from .github/workflows/ci-cd-contributor.yml.erb |
| 4 | +# by ./internal-scripts/generate-ci-cd-yaml.rb. |
| 5 | +# Please edit the .erb file instead, then regenerate YAML |
| 6 | +# by running that script. |
| 7 | +# |
| 8 | +# TIP: run this on your development machine to ensure generate-ci-cd-yaml.rb |
| 9 | +# is run automatically as a Git pre-commit hook: |
| 10 | +# |
| 11 | +# git config core.hooksPath .githooks |
| 12 | + |
| 13 | +name: 'CI/CD: contributor' |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + paths-ignore: |
| 18 | + - '**.md' |
| 19 | + - 'dev-handbook/**' |
| 20 | + pull_request: |
| 21 | + paths-ignore: |
| 22 | + - '**.md' |
| 23 | + - 'dev-handbook/**' |
| 24 | + workflow_dispatch: |
| 25 | + |
| 26 | +jobs: |
| 27 | + lint: |
| 28 | + name: Check whether workflow is up-to-date |
| 29 | + runs-on: ubuntu-24.04 |
| 30 | + if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition' |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + - uses: ruby/setup-ruby@v1 |
| 34 | + with: |
| 35 | + ruby-version: '3.3' |
| 36 | + - name: Check |
| 37 | + run: ./internal-scripts/ci-cd/check-workflow-uptodate/check.sh |
| 38 | + |
| 39 | + |
| 40 | + build_images: |
| 41 | + name: Build Docker images |
| 42 | + needs: lint |
| 43 | + runs-on: ubuntu-24.04 |
| 44 | + if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition' |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: 'Build Docker image [ubuntu-24.04]' |
| 49 | + run: ./internal-scripts/ci-cd/build-docker-images/build.sh |
| 50 | + env: |
| 51 | + IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images' |
| 52 | + IMAGE_TAG: 'ubuntu-24.04-v2' |
| 53 | + SOURCE_DIR: 'environments/ubuntu-24.04' |
| 54 | + - name: 'Dump Docker image [ubuntu-24.04]' |
| 55 | + run: ./internal-scripts/ci-cd/build-docker-images/dump-image.sh |
| 56 | + env: |
| 57 | + IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images' |
| 58 | + IMAGE_TAG: 'ubuntu-24.04-v2' |
| 59 | + - name: 'Upload Docker image artifact [ubuntu-24.04]' |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: 'docker-image-ubuntu-24.04' |
| 63 | + path: output |
| 64 | + - name: Clean up Docker image output |
| 65 | + run: rm -rf output |
| 66 | + |
| 67 | + - name: 'Build Docker image [el-9]' |
| 68 | + run: ./internal-scripts/ci-cd/build-docker-images/build.sh |
| 69 | + env: |
| 70 | + IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images' |
| 71 | + IMAGE_TAG: 'el-9-v2' |
| 72 | + SOURCE_DIR: 'environments/el-9' |
| 73 | + - name: 'Dump Docker image [el-9]' |
| 74 | + run: ./internal-scripts/ci-cd/build-docker-images/dump-image.sh |
| 75 | + env: |
| 76 | + IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images' |
| 77 | + IMAGE_TAG: 'el-9-v2' |
| 78 | + - name: 'Upload Docker image artifact [el-9]' |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: 'docker-image-el-9' |
| 82 | + path: output |
| 83 | + - name: Clean up Docker image output |
| 84 | + run: rm -rf output |
| 85 | + |
| 86 | + - name: 'Build Docker image [utility]' |
| 87 | + run: ./internal-scripts/ci-cd/build-docker-images/build.sh |
| 88 | + env: |
| 89 | + IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images' |
| 90 | + IMAGE_TAG: 'utility-v3' |
| 91 | + SOURCE_DIR: 'environments/utility' |
| 92 | + - name: 'Dump Docker image [utility]' |
| 93 | + run: ./internal-scripts/ci-cd/build-docker-images/dump-image.sh |
| 94 | + env: |
| 95 | + IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images' |
| 96 | + IMAGE_TAG: 'utility-v3' |
| 97 | + - name: 'Upload Docker image artifact [utility]' |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: 'docker-image-utility' |
| 101 | + path: output |
| 102 | + - name: Clean up Docker image output |
| 103 | + run: rm -rf output |
| 104 | + |
| 105 | + |
| 106 | + build_packages: |
| 107 | + name: Build packages |
| 108 | + needs: build_images |
| 109 | + runs-on: ubuntu-24.04 |
| 110 | + if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition' |
| 111 | + timeout-minutes: 60 |
| 112 | + steps: |
| 113 | + - uses: actions/checkout@v4 |
| 114 | + |
| 115 | + ### Download and load Docker images ### |
| 116 | + |
| 117 | + - name: 'Download Docker image artifact [ubuntu-24.04]' |
| 118 | + uses: actions/download-artifact@v4 |
| 119 | + with: |
| 120 | + name: 'docker-image-ubuntu-24.04' |
| 121 | + path: docker-image-ubuntu-24.04 |
| 122 | + - name: 'Load Docker image [ubuntu-24.04]' |
| 123 | + run: ./internal-scripts/ci-cd/load-docker-image.sh |
| 124 | + env: |
| 125 | + TARBALL: docker-image-ubuntu-24.04/image.tar.zst |
| 126 | + |
| 127 | + - name: 'Download Docker image artifact [el-9]' |
| 128 | + uses: actions/download-artifact@v4 |
| 129 | + with: |
| 130 | + name: 'docker-image-el-9' |
| 131 | + path: docker-image-el-9 |
| 132 | + - name: 'Load Docker image [el-9]' |
| 133 | + run: ./internal-scripts/ci-cd/load-docker-image.sh |
| 134 | + env: |
| 135 | + TARBALL: docker-image-el-9/image.tar.zst |
| 136 | + |
| 137 | + - name: 'Download Docker image artifact [utility]' |
| 138 | + uses: actions/download-artifact@v4 |
| 139 | + with: |
| 140 | + name: 'docker-image-utility' |
| 141 | + path: docker-image-utility |
| 142 | + - name: 'Load Docker image [utility]' |
| 143 | + run: ./internal-scripts/ci-cd/load-docker-image.sh |
| 144 | + env: |
| 145 | + TARBALL: docker-image-utility/image.tar.zst |
| 146 | + |
| 147 | + ### Download sources ### |
| 148 | + |
| 149 | + - name: Download Ruby source |
| 150 | + run: curl -fsSL -o ruby-src.tar.gz 'https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.3.tar.gz' |
| 151 | + - name: Download Jemalloc source |
| 152 | + run: curl -fsSL -o jemalloc-src.tar.bz2 'https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2' |
| 153 | + - name: Clone Rbenv source |
| 154 | + run: | |
| 155 | + git clone 'https://github.com/fullstaq-ruby/rbenv.git' rbenv-src |
| 156 | + cd rbenv-src |
| 157 | + git checkout 'fbaa15993171bf' |
| 158 | +
|
| 159 | + ### Build Jemalloc ### |
| 160 | + |
| 161 | + - name: 'Build Jemalloc [ubuntu-24.04]' |
| 162 | + run: | |
| 163 | + ./build-jemalloc \ |
| 164 | + -n 'ubuntu-24.04' \ |
| 165 | + -s "$(pwd)/jemalloc-src.tar.bz2" \ |
| 166 | + -o "$(pwd)/jemalloc-bin-ubuntu-24.04.tar.gz" \ |
| 167 | + -j 2 |
| 168 | +
|
| 169 | + - name: 'Build Jemalloc [el-9]' |
| 170 | + run: | |
| 171 | + ./build-jemalloc \ |
| 172 | + -n 'el-9' \ |
| 173 | + -s "$(pwd)/jemalloc-src.tar.bz2" \ |
| 174 | + -o "$(pwd)/jemalloc-bin-el-9.tar.gz" \ |
| 175 | + -j 2 |
| 176 | +
|
| 177 | + ### Build Ruby binaries ### |
| 178 | + |
| 179 | + - name: 'Build Ruby binaries [ubuntu-24.04/normal]' |
| 180 | + run: | |
| 181 | + ./build-ruby \ |
| 182 | + -n 'ubuntu-24.04' \ |
| 183 | + -s "$(pwd)/ruby-src.tar.gz" \ |
| 184 | + -v '4.0' \ |
| 185 | + -o "$(pwd)/ruby-bin-ubuntu-24.04-normal.tar.gz" \ |
| 186 | + -j 2 |
| 187 | +
|
| 188 | + - name: 'Build Ruby binaries [ubuntu-24.04/jemalloc]' |
| 189 | + run: | |
| 190 | + ./build-ruby \ |
| 191 | + -n 'ubuntu-24.04' \ |
| 192 | + -s "$(pwd)/ruby-src.tar.gz" \ |
| 193 | + -v '4.0' \ |
| 194 | + -o "$(pwd)/ruby-bin-ubuntu-24.04-jemalloc.tar.gz" \ |
| 195 | + -m "$(pwd)/jemalloc-bin-ubuntu-24.04.tar.gz" \ |
| 196 | + -j 2 |
| 197 | +
|
| 198 | + - name: 'Build Ruby binaries [el-9/normal]' |
| 199 | + run: | |
| 200 | + ./build-ruby \ |
| 201 | + -n 'el-9' \ |
| 202 | + -s "$(pwd)/ruby-src.tar.gz" \ |
| 203 | + -v '4.0' \ |
| 204 | + -o "$(pwd)/ruby-bin-el-9-normal.tar.gz" \ |
| 205 | + -j 2 |
| 206 | +
|
| 207 | + - name: 'Build Ruby binaries [el-9/jemalloc]' |
| 208 | + run: | |
| 209 | + ./build-ruby \ |
| 210 | + -n 'el-9' \ |
| 211 | + -s "$(pwd)/ruby-src.tar.gz" \ |
| 212 | + -v '4.0' \ |
| 213 | + -o "$(pwd)/ruby-bin-el-9-jemalloc.tar.gz" \ |
| 214 | + -m "$(pwd)/jemalloc-bin-el-9.tar.gz" \ |
| 215 | + -j 2 |
| 216 | +
|
| 217 | + - name: Create packages directory |
| 218 | + run: mkdir -p packages |
| 219 | + |
| 220 | + ### Build Ruby packages ### |
| 221 | + |
| 222 | + - name: 'Build Ruby package [ubuntu-24.04/normal]' |
| 223 | + run: | |
| 224 | + ./build-ruby-deb \ |
| 225 | + -b "$(pwd)/ruby-bin-ubuntu-24.04-normal.tar.gz" \ |
| 226 | + -o "$(pwd)/packages/fullstaq-ruby-4.0_2-ubuntu-24.04_amd64.deb" \ |
| 227 | + -r '2' |
| 228 | +
|
| 229 | + - name: 'Build Ruby package [ubuntu-24.04/jemalloc]' |
| 230 | + run: | |
| 231 | + ./build-ruby-deb \ |
| 232 | + -b "$(pwd)/ruby-bin-ubuntu-24.04-jemalloc.tar.gz" \ |
| 233 | + -o "$(pwd)/packages/fullstaq-ruby-4.0-jemalloc_2-ubuntu-24.04_amd64.deb" \ |
| 234 | + -r '2' |
| 235 | +
|
| 236 | + - name: 'Build Ruby package [el-9/normal]' |
| 237 | + run: | |
| 238 | + ./build-ruby-rpm \ |
| 239 | + -b "$(pwd)/ruby-bin-el-9-normal.tar.gz" \ |
| 240 | + -o "$(pwd)/packages/fullstaq-ruby-4.0-rev2-el9.x86_64.rpm" \ |
| 241 | + -r '2' |
| 242 | +
|
| 243 | + - name: 'Build Ruby package [el-9/jemalloc]' |
| 244 | + run: | |
| 245 | + ./build-ruby-rpm \ |
| 246 | + -b "$(pwd)/ruby-bin-el-9-jemalloc.tar.gz" \ |
| 247 | + -o "$(pwd)/packages/fullstaq-ruby-4.0-jemalloc-rev2-el9.x86_64.rpm" \ |
| 248 | + -r '2' |
| 249 | +
|
| 250 | + ### Build Rbenv packages ### |
| 251 | + |
| 252 | + - name: Build Rbenv DEB |
| 253 | + run: | |
| 254 | + ./build-rbenv-deb \ |
| 255 | + -s "$(pwd)/rbenv-src" \ |
| 256 | + -o "$(pwd)/packages/fullstaq-rbenv_1.1.2-16-1_all.deb" \ |
| 257 | + -n '1.1.2-16' \ |
| 258 | + -r '1' |
| 259 | + - name: Build Rbenv RPM |
| 260 | + run: | |
| 261 | + ./build-rbenv-rpm \ |
| 262 | + -s "$(pwd)/rbenv-src" \ |
| 263 | + -o "$(pwd)/packages/fullstaq-rbenv-1.1.2_16-1.noarch.rpm" \ |
| 264 | + -n '1.1.2-16' \ |
| 265 | + -r '1' |
| 266 | +
|
| 267 | + ### Build common packages ### |
| 268 | + |
| 269 | + - name: Build common DEB |
| 270 | + run: | |
| 271 | + ./build-common-deb \ |
| 272 | + -o "$(pwd)/packages/fullstaq-ruby-common_1.0-1_all.deb" |
| 273 | + - name: Build common RPM |
| 274 | + run: | |
| 275 | + ./build-common-rpm \ |
| 276 | + -o "$(pwd)/packages/fullstaq-ruby-common-1.0-1.noarch.rpm" |
| 277 | +
|
| 278 | + ### Upload all packages ### |
| 279 | + |
| 280 | + - name: Upload packages |
| 281 | + uses: actions/upload-artifact@v4 |
| 282 | + with: |
| 283 | + name: contributor-packages |
| 284 | + path: packages |
| 285 | + |
| 286 | + |
| 287 | + test_packages: |
| 288 | + name: 'Test [${{ matrix.distro }}/${{ matrix.variant }}]' |
| 289 | + needs: build_packages |
| 290 | + runs-on: ubuntu-24.04 |
| 291 | + if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition' |
| 292 | + timeout-minutes: 30 |
| 293 | + strategy: |
| 294 | + fail-fast: false |
| 295 | + matrix: |
| 296 | + include: |
| 297 | + - distro: 'ubuntu-24.04' |
| 298 | + variant: 'normal' |
| 299 | + test_image: 'ubuntu:24.04' |
| 300 | + package_format: 'DEB' |
| 301 | + - distro: 'ubuntu-24.04' |
| 302 | + variant: 'jemalloc' |
| 303 | + test_image: 'ubuntu:24.04' |
| 304 | + package_format: 'DEB' |
| 305 | + - distro: 'el-9' |
| 306 | + variant: 'normal' |
| 307 | + test_image: 'rockylinux:9' |
| 308 | + package_format: 'RPM' |
| 309 | + - distro: 'el-9' |
| 310 | + variant: 'jemalloc' |
| 311 | + test_image: 'rockylinux:9' |
| 312 | + package_format: 'RPM' |
| 313 | + steps: |
| 314 | + - uses: actions/checkout@v4 |
| 315 | + |
| 316 | + - name: Download packages |
| 317 | + uses: actions/download-artifact@v4 |
| 318 | + with: |
| 319 | + name: contributor-packages |
| 320 | + path: packages |
| 321 | + |
| 322 | + - name: Download utility Docker image |
| 323 | + uses: actions/download-artifact@v4 |
| 324 | + with: |
| 325 | + name: 'docker-image-utility' |
| 326 | + path: docker-image-utility |
| 327 | + - name: Load utility Docker image |
| 328 | + run: ./internal-scripts/ci-cd/load-docker-image.sh |
| 329 | + env: |
| 330 | + TARBALL: docker-image-utility/image.tar.zst |
| 331 | + |
| 332 | + - name: Determine Ruby package filename |
| 333 | + id: ruby_pkg |
| 334 | + run: | |
| 335 | + VARIANT="${{ matrix.variant }}" |
| 336 | + DISTRO="${{ matrix.distro }}" |
| 337 | + FORMAT="${{ matrix.package_format }}" |
| 338 | + if [ "$VARIANT" = "normal" ]; then |
| 339 | + VARIANT_SUFFIX="" |
| 340 | + else |
| 341 | + VARIANT_SUFFIX="-${VARIANT}" |
| 342 | + fi |
| 343 | + if [ "$FORMAT" = "DEB" ]; then |
| 344 | + FILENAME="fullstaq-ruby-4.0${VARIANT_SUFFIX}_2-${DISTRO}_amd64.deb" |
| 345 | + else |
| 346 | + SANITIZED_DISTRO=$(echo "$DISTRO" | tr -d '-') |
| 347 | + FILENAME="fullstaq-ruby-4.0${VARIANT_SUFFIX}-rev2-${SANITIZED_DISTRO}.x86_64.rpm" |
| 348 | + fi |
| 349 | + echo "filename=${FILENAME}" >> "$GITHUB_OUTPUT" |
| 350 | +
|
| 351 | + - name: Test DEBs |
| 352 | + if: matrix.package_format == 'DEB' |
| 353 | + run: | |
| 354 | + ./test-debs \ |
| 355 | + -i '${{ matrix.test_image }}' \ |
| 356 | + -v '${{ matrix.variant }}' \ |
| 357 | + -r "$(pwd)/packages/${{ steps.ruby_pkg.outputs.filename }}" \ |
| 358 | + -b "$(pwd)/packages/fullstaq-rbenv_1.1.2-16-1_all.deb" \ |
| 359 | + -c "$(pwd)/packages/fullstaq-ruby-common_1.0-1_all.deb" |
| 360 | + - name: Test RPMs |
| 361 | + if: matrix.package_format == 'RPM' |
| 362 | + run: | |
| 363 | + ./test-rpms \ |
| 364 | + -i '${{ matrix.test_image }}' \ |
| 365 | + -v '${{ matrix.variant }}' \ |
| 366 | + -r "$(pwd)/packages/${{ steps.ruby_pkg.outputs.filename }}" \ |
| 367 | + -b "$(pwd)/packages/fullstaq-rbenv-1.1.2_16-1.noarch.rpm" \ |
| 368 | + -c "$(pwd)/packages/fullstaq-ruby-common-1.0-1.noarch.rpm" |
0 commit comments