Skip to content

Build-Test-Push

Build-Test-Push #57

Workflow file for this run

name: Build-Test-Push
on:
schedule:
- cron: "5 4 * * 3"
pull_request:
paths-ignore:
- "README.md"
- "LICENSE.md"
push:
paths-ignore:
- "README.md"
- "LICENSE.md"
jobs:
gather-versions:
runs-on: ubuntu-20.04
outputs:
versions: ${{ steps.ruby-versions.outputs.versions }}
metadata: ${{ steps.ruby-versions.outputs.metadata }}
steps:
- uses: moritzheiber/ruby-versions-action@v1
name: Fetch latest Ruby versions
id: ruby-versions
build-test-push:
runs-on: ubuntu-20.04
needs: ["gather-versions"]
strategy:
matrix:
version: ${{ fromJSON(needs.gather-versions.outputs.versions) }}
image: ["slim", "ubuntu-20.04", "ubuntu-22.04"]
include: ${{ fromJSON(needs.gather-versions.outputs.metadata) }}
steps:
- name: Set image_name
id: context
run: |
if [[ "${{ matrix.image }}" == "slim" ]] ; then
echo "image_name=ruby:${{ matrix.version }}-slim" >> ${GITHUB_OUTPUT}
elif [[ "${{ matrix.image }}" == "ubuntu-20.04" ]] ; then
echo "image_name=ubuntu:20.04" >> ${GITHUB_OUTPUT}
elif [[ "${{ matrix.image }}" == "ubuntu-22.04" ]] ; then
echo "image_name=ubuntu:22.04" >> ${GITHUB_OUTPUT}
fi
if [[ "${{ startsWith(matrix.version, '3.2') }}" == "true" ]] ; then
echo "flags=--enable-yjit" >> ${GITHUB_OUTPUT}
fi
- uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:v0.10.6
- uses: docker/build-push-action@v5
name: Build
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/main' }}
cache-from: type=gha
cache-to: type=gha
build-args: |
RUBY_VERSION=${{ matrix.version }}
RUBY_CHECKSUM=${{ matrix.checksum }}
IMAGE_NAME=${{ steps.context.outputs.image_name }}
ADDITIONAL_FLAGS=${{ steps.context.outputs.flags }}
tags: "ghcr.io/moritzheiber/ruby-jemalloc:${{ matrix.version }}-${{ matrix.image }}"