Skip to content
Open
Show file tree
Hide file tree
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
368 changes: 368 additions & 0 deletions .github/workflows/ci-cd-contributor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,368 @@
# WARNING: DO NOT EDIT THIS FILE!!!
#
# This file is autogenerated from .github/workflows/ci-cd-contributor.yml.erb
# by ./internal-scripts/generate-ci-cd-yaml.rb.
# Please edit the .erb file instead, then regenerate YAML
# by running that script.
#
# TIP: run this on your development machine to ensure generate-ci-cd-yaml.rb
# is run automatically as a Git pre-commit hook:
#
# git config core.hooksPath .githooks

name: 'CI/CD: contributor'

on:
push:
paths-ignore:
- '**.md'
- 'dev-handbook/**'
pull_request:
paths-ignore:
- '**.md'
- 'dev-handbook/**'
workflow_dispatch:

jobs:
lint:
name: Check whether workflow is up-to-date
runs-on: ubuntu-24.04
if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Check
run: ./internal-scripts/ci-cd/check-workflow-uptodate/check.sh


build_images:
name: Build Docker images
needs: lint
runs-on: ubuntu-24.04
if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition'
steps:
- uses: actions/checkout@v4

- name: 'Build Docker image [ubuntu-24.04]'
run: ./internal-scripts/ci-cd/build-docker-images/build.sh
env:
IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images'
IMAGE_TAG: 'ubuntu-24.04-v2'
SOURCE_DIR: 'environments/ubuntu-24.04'
- name: 'Dump Docker image [ubuntu-24.04]'
run: ./internal-scripts/ci-cd/build-docker-images/dump-image.sh
env:
IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images'
IMAGE_TAG: 'ubuntu-24.04-v2'
- name: 'Upload Docker image artifact [ubuntu-24.04]'
uses: actions/upload-artifact@v4
with:
name: 'docker-image-ubuntu-24.04'
path: output
- name: Clean up Docker image output
run: rm -rf output

- name: 'Build Docker image [el-9]'
run: ./internal-scripts/ci-cd/build-docker-images/build.sh
env:
IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images'
IMAGE_TAG: 'el-9-v2'
SOURCE_DIR: 'environments/el-9'
- name: 'Dump Docker image [el-9]'
run: ./internal-scripts/ci-cd/build-docker-images/dump-image.sh
env:
IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images'
IMAGE_TAG: 'el-9-v2'
- name: 'Upload Docker image artifact [el-9]'
uses: actions/upload-artifact@v4
with:
name: 'docker-image-el-9'
path: output
- name: Clean up Docker image output
run: rm -rf output

- name: 'Build Docker image [utility]'
run: ./internal-scripts/ci-cd/build-docker-images/build.sh
env:
IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images'
IMAGE_TAG: 'utility-v3'
SOURCE_DIR: 'environments/utility'
- name: 'Dump Docker image [utility]'
run: ./internal-scripts/ci-cd/build-docker-images/dump-image.sh
env:
IMAGE_NAME: 'ghcr.io/fullstaq-ruby/server-edition-ci-images'
IMAGE_TAG: 'utility-v3'
- name: 'Upload Docker image artifact [utility]'
uses: actions/upload-artifact@v4
with:
name: 'docker-image-utility'
path: output
- name: Clean up Docker image output
run: rm -rf output


build_packages:
name: Build packages
needs: build_images
runs-on: ubuntu-24.04
if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition'
timeout-minutes: 60
steps:
- uses: actions/checkout@v4

### Download and load Docker images ###

- name: 'Download Docker image artifact [ubuntu-24.04]'
uses: actions/download-artifact@v4
with:
name: 'docker-image-ubuntu-24.04'
path: docker-image-ubuntu-24.04
- name: 'Load Docker image [ubuntu-24.04]'
run: ./internal-scripts/ci-cd/load-docker-image.sh
env:
TARBALL: docker-image-ubuntu-24.04/image.tar.zst

- name: 'Download Docker image artifact [el-9]'
uses: actions/download-artifact@v4
with:
name: 'docker-image-el-9'
path: docker-image-el-9
- name: 'Load Docker image [el-9]'
run: ./internal-scripts/ci-cd/load-docker-image.sh
env:
TARBALL: docker-image-el-9/image.tar.zst

- name: 'Download Docker image artifact [utility]'
uses: actions/download-artifact@v4
with:
name: 'docker-image-utility'
path: docker-image-utility
- name: 'Load Docker image [utility]'
run: ./internal-scripts/ci-cd/load-docker-image.sh
env:
TARBALL: docker-image-utility/image.tar.zst

### Download sources ###

- name: Download Ruby source
run: curl -fsSL -o ruby-src.tar.gz 'https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.3.tar.gz'
- name: Download Jemalloc source
run: curl -fsSL -o jemalloc-src.tar.bz2 'https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2'
- name: Clone Rbenv source
run: |
git clone 'https://github.com/fullstaq-ruby/rbenv.git' rbenv-src
cd rbenv-src
git checkout 'fbaa15993171bf'

### Build Jemalloc ###

- name: 'Build Jemalloc [ubuntu-24.04]'
run: |
./build-jemalloc \
-n 'ubuntu-24.04' \
-s "$(pwd)/jemalloc-src.tar.bz2" \
-o "$(pwd)/jemalloc-bin-ubuntu-24.04.tar.gz" \
-j 2

- name: 'Build Jemalloc [el-9]'
run: |
./build-jemalloc \
-n 'el-9' \
-s "$(pwd)/jemalloc-src.tar.bz2" \
-o "$(pwd)/jemalloc-bin-el-9.tar.gz" \
-j 2

### Build Ruby binaries ###

- name: 'Build Ruby binaries [ubuntu-24.04/normal]'
run: |
./build-ruby \
-n 'ubuntu-24.04' \
-s "$(pwd)/ruby-src.tar.gz" \
-v '4.0' \
-o "$(pwd)/ruby-bin-ubuntu-24.04-normal.tar.gz" \
-j 2

- name: 'Build Ruby binaries [ubuntu-24.04/jemalloc]'
run: |
./build-ruby \
-n 'ubuntu-24.04' \
-s "$(pwd)/ruby-src.tar.gz" \
-v '4.0' \
-o "$(pwd)/ruby-bin-ubuntu-24.04-jemalloc.tar.gz" \
-m "$(pwd)/jemalloc-bin-ubuntu-24.04.tar.gz" \
-j 2

- name: 'Build Ruby binaries [el-9/normal]'
run: |
./build-ruby \
-n 'el-9' \
-s "$(pwd)/ruby-src.tar.gz" \
-v '4.0' \
-o "$(pwd)/ruby-bin-el-9-normal.tar.gz" \
-j 2

- name: 'Build Ruby binaries [el-9/jemalloc]'
run: |
./build-ruby \
-n 'el-9' \
-s "$(pwd)/ruby-src.tar.gz" \
-v '4.0' \
-o "$(pwd)/ruby-bin-el-9-jemalloc.tar.gz" \
-m "$(pwd)/jemalloc-bin-el-9.tar.gz" \
-j 2

- name: Create packages directory
run: mkdir -p packages

### Build Ruby packages ###

- name: 'Build Ruby package [ubuntu-24.04/normal]'
run: |
./build-ruby-deb \
-b "$(pwd)/ruby-bin-ubuntu-24.04-normal.tar.gz" \
-o "$(pwd)/packages/fullstaq-ruby-4.0_2-ubuntu-24.04_amd64.deb" \
-r '2'

- name: 'Build Ruby package [ubuntu-24.04/jemalloc]'
run: |
./build-ruby-deb \
-b "$(pwd)/ruby-bin-ubuntu-24.04-jemalloc.tar.gz" \
-o "$(pwd)/packages/fullstaq-ruby-4.0-jemalloc_2-ubuntu-24.04_amd64.deb" \
-r '2'

- name: 'Build Ruby package [el-9/normal]'
run: |
./build-ruby-rpm \
-b "$(pwd)/ruby-bin-el-9-normal.tar.gz" \
-o "$(pwd)/packages/fullstaq-ruby-4.0-rev2-el9.x86_64.rpm" \
-r '2'

- name: 'Build Ruby package [el-9/jemalloc]'
run: |
./build-ruby-rpm \
-b "$(pwd)/ruby-bin-el-9-jemalloc.tar.gz" \
-o "$(pwd)/packages/fullstaq-ruby-4.0-jemalloc-rev2-el9.x86_64.rpm" \
-r '2'

### Build Rbenv packages ###

- name: Build Rbenv DEB
run: |
./build-rbenv-deb \
-s "$(pwd)/rbenv-src" \
-o "$(pwd)/packages/fullstaq-rbenv_1.1.2-16-1_all.deb" \
-n '1.1.2-16' \
-r '1'
- name: Build Rbenv RPM
run: |
./build-rbenv-rpm \
-s "$(pwd)/rbenv-src" \
-o "$(pwd)/packages/fullstaq-rbenv-1.1.2_16-1.noarch.rpm" \
-n '1.1.2-16' \
-r '1'

### Build common packages ###

- name: Build common DEB
run: |
./build-common-deb \
-o "$(pwd)/packages/fullstaq-ruby-common_1.0-1_all.deb"
- name: Build common RPM
run: |
./build-common-rpm \
-o "$(pwd)/packages/fullstaq-ruby-common-1.0-1.noarch.rpm"

### Upload all packages ###

- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: contributor-packages
path: packages


test_packages:
name: 'Test [${{ matrix.distro }}/${{ matrix.variant }}]'
needs: build_packages
runs-on: ubuntu-24.04
if: github.event_name == 'pull_request' || github.repository != 'fullstaq-ruby/server-edition'
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- distro: 'ubuntu-24.04'
variant: 'normal'
test_image: 'ubuntu:24.04'
package_format: 'DEB'
- distro: 'ubuntu-24.04'
variant: 'jemalloc'
test_image: 'ubuntu:24.04'
package_format: 'DEB'
- distro: 'el-9'
variant: 'normal'
test_image: 'rockylinux:9'
package_format: 'RPM'
- distro: 'el-9'
variant: 'jemalloc'
test_image: 'rockylinux:9'
package_format: 'RPM'
steps:
- uses: actions/checkout@v4

- name: Download packages
uses: actions/download-artifact@v4
with:
name: contributor-packages
path: packages

- name: Download utility Docker image
uses: actions/download-artifact@v4
with:
name: 'docker-image-utility'
path: docker-image-utility
- name: Load utility Docker image
run: ./internal-scripts/ci-cd/load-docker-image.sh
env:
TARBALL: docker-image-utility/image.tar.zst

- name: Determine Ruby package filename
id: ruby_pkg
run: |
VARIANT="${{ matrix.variant }}"
DISTRO="${{ matrix.distro }}"
FORMAT="${{ matrix.package_format }}"
if [ "$VARIANT" = "normal" ]; then
VARIANT_SUFFIX=""
else
VARIANT_SUFFIX="-${VARIANT}"
fi
if [ "$FORMAT" = "DEB" ]; then
FILENAME="fullstaq-ruby-4.0${VARIANT_SUFFIX}_2-${DISTRO}_amd64.deb"
else
SANITIZED_DISTRO=$(echo "$DISTRO" | tr -d '-')
FILENAME="fullstaq-ruby-4.0${VARIANT_SUFFIX}-rev2-${SANITIZED_DISTRO}.x86_64.rpm"
fi
echo "filename=${FILENAME}" >> "$GITHUB_OUTPUT"

- name: Test DEBs
if: matrix.package_format == 'DEB'
run: |
./test-debs \
-i '${{ matrix.test_image }}' \
-v '${{ matrix.variant }}' \
-r "$(pwd)/packages/${{ steps.ruby_pkg.outputs.filename }}" \
-b "$(pwd)/packages/fullstaq-rbenv_1.1.2-16-1_all.deb" \
-c "$(pwd)/packages/fullstaq-ruby-common_1.0-1_all.deb"
- name: Test RPMs
if: matrix.package_format == 'RPM'
run: |
./test-rpms \
-i '${{ matrix.test_image }}' \
-v '${{ matrix.variant }}' \
-r "$(pwd)/packages/${{ steps.ruby_pkg.outputs.filename }}" \
-b "$(pwd)/packages/fullstaq-rbenv-1.1.2_16-1.noarch.rpm" \
-c "$(pwd)/packages/fullstaq-ruby-common-1.0-1.noarch.rpm"
Loading