Skip to content

CI

CI #174

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
paths-ignore:
- README.md
- .github/workflows/master.yml
schedule:
- cron: '45 4 * * *'
env:
crystal_version: 1.14.0
shards_version: 0.18.0
gc_version: 8.2.6
permissions:
contents: read
id-token: write
jobs:
alpine:
name: Alpine container
runs-on: ubuntu-latest
strategy:
matrix:
include:
- alpine_version: latest
llvm_version: 18
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
- uses: depot/setup-action@v1
- uses: depot/build-push-action@v1
with:
project: zjh7v82xv6
context: alpine
pull: true
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
llvm_version=${{ matrix.llvm_version }}
alpine_version=${{ matrix.alpine_version }}
tags: |
84codes/crystal:${{ env.crystal_version }}-alpine-${{ matrix.alpine_version }}
84codes/crystal:${{ env.crystal_version }}-alpine
84codes/crystal:latest-alpine
84codes/crystal:latest
push: ${{ github.ref == 'refs/heads/main' }}
pkgs:
name: Debian/RPM static packages
needs: alpine
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
steps:
- uses: actions/checkout@v4
- uses: depot/setup-action@v1
- uses: depot/build-push-action@v1
with:
project: zjh7v82xv6
context: pkgs
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
pkg_revision=${{ github.run_number }}
outputs: pkgs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: crystal-static-pkgs
path: pkgs
- name: Upload deb package to Packagecloud
run: find pkgs -name "*.deb" -exec curl -fsSu "${{ secrets.packagecloud_token }}:" -F "package[distro_version_id]=35" -F "package[package_file]=@{}" -XPOST https://packagecloud.io/api/v1/repos/84codes/crystal/packages.json \;
if: github.ref == 'refs/heads/main'
- name: Upload RPM package to Packagecloud
run: find pkgs -name "*.rpm" -exec curl -fsSu "${{ secrets.packagecloud_token }}:" -F "package[distro_version_id]=227" -F "package[package_file]=@{}" -XPOST https://packagecloud.io/api/v1/repos/84codes/crystal/packages.json \;
if: github.ref == 'refs/heads/main'
debian:
name: Debian
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- base_image: ubuntu
version: 24.04
codename: noble
llvm_version: 18
- base_image: ubuntu
version: 22.04
codename: jammy
llvm_version: 15
- base_image: debian
version: 12
codename: bookworm
llvm_version: 15
- base_image: debian
version: 11
codename: bullseye
llvm_version: 13
- base_image: debian
version: 10
codename: buster
llvm_version: 13
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
- name: Build and push container
uses: docker/build-push-action@v3
with:
context: debian
cache-from: type=gha,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
cache-to: type=gha,mode=max,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
pull: true
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
base_image=${{ matrix.base_image }}
codename=${{ matrix.codename }}
llvm_version=${{ matrix.llvm_version }}
tags: |
84codes/crystal:${{ env.crystal_version }}-${{ matrix.base_image }}-${{ matrix.version }}
84codes/crystal:latest-${{ matrix.base_image }}-${{ matrix.version }}
84codes/crystal:${{ env.crystal_version }}-${{ matrix.base_image }}-${{ matrix.codename }}
84codes/crystal:latest-${{ matrix.base_image }}-${{ matrix.codename }}
push: ${{ github.ref == 'refs/heads/main' }}
- name: Export packages
uses: docker/build-push-action@v3
with:
cache-from: type=gha,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
cache-to: type=gha,mode=max,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
context: debian
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
base_image=${{ matrix.base_image }}
codename=${{ matrix.codename }}
llvm_version=${{ matrix.llvm_version }}
pkg_revision=${{ github.run_number }}
target: pkgs
outputs: pkgs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: crystal-${{ matrix.base_image }}-${{ matrix.version }}-pkgs
path: pkgs
- name: Upload to Packagecloud
run: |
set -euxo pipefail
curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json
DIST_ID=$(jq ".deb[] | select(.index_name == \"${{ matrix.base_image }}\").versions[] | select(.index_name == \"${{ matrix.codename }}\").id" distributions.json)
find pkgs -name "*.deb" | xargs -I{} curl -fsSu "${{ secrets.packagecloud_token }}:" -F "package[distro_version_id]=$DIST_ID" -F "package[package_file]=@{}" -XPOST https://packagecloud.io/api/v1/repos/84codes/crystal/packages.json
if: ${{ github.ref == 'refs/heads/main' }}
debian-static:
name: Debian (static)
runs-on: ubuntu-latest
needs: alpine
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- base_image: ubuntu
version: 20.04
codename: focal
llvm_version: 12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
- name: Build and push container
uses: docker/build-push-action@v3
with:
context: debian-static
cache-from: type=gha,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
cache-to: type=gha,mode=max,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
pull: true
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
base_image=${{ matrix.base_image }}
codename=${{ matrix.codename }}
llvm_version=${{ matrix.llvm_version }}
tags: |
84codes/crystal:${{ env.crystal_version }}-${{ matrix.base_image }}-${{ matrix.version }}
84codes/crystal:latest-${{ matrix.base_image }}-${{ matrix.version }}
84codes/crystal:${{ env.crystal_version }}-${{ matrix.base_image }}-${{ matrix.codename }}
84codes/crystal:latest-${{ matrix.base_image }}-${{ matrix.codename }}
push: ${{ github.ref == 'refs/heads/main' }}
- name: Export packages
uses: docker/build-push-action@v3
with:
cache-from: type=gha,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
cache-to: type=gha,mode=max,scope=container-${{ matrix.base_image }}-${{ matrix.version }}
context: debian-static
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
base_image=${{ matrix.base_image }}
codename=${{ matrix.codename }}
llvm_version=${{ matrix.llvm_version }}
pkg_revision=${{ github.run_number }}
target: pkgs
outputs: pkgs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: crystal-${{ matrix.base_image }}-${{ matrix.version }}-pkgs
path: pkgs
- name: Upload to Packagecloud
run: |
set -euxo pipefail
curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json
DIST_ID=$(jq ".deb[] | select(.index_name == \"${{ matrix.base_image }}\").versions[] | select(.index_name == \"${{ matrix.codename }}\").id" distributions.json)
find pkgs -name "*.deb" | xargs -I{} curl -fsSu "${{ secrets.packagecloud_token }}:" -F "package[distro_version_id]=$DIST_ID" -F "package[package_file]=@{}" -XPOST https://packagecloud.io/api/v1/repos/84codes/crystal/packages.json
if: ${{ github.ref == 'refs/heads/main' }}
fedora:
name: Fedora
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- base_image: fedora
base_image_tag: 38
- base_image: fedora
base_image_tag: 39
- base_image: fedora
base_image_tag: 40
- base_image: fedora
base_image_tag: 41
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
- uses: depot/setup-action@v1
- uses: depot/build-push-action@v1
name: Build and push container
with:
project: zjh7v82xv6
context: fedora
pull: true
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
llvm_version=${{ matrix.llvm_version }}
base_image=${{ matrix.base_image }}
base_image_tag=${{ matrix.base_image_tag }}
pkg_revision=${{ github.run_number }}
tags: |
84codes/crystal:${{ env.crystal_version }}-${{ matrix.base_image }}-${{ matrix.base_image_tag }}
84codes/crystal:latest-${{ matrix.base_image }}-${{ matrix.base_image_tag }}
push: ${{ github.ref == 'refs/heads/main' }}
- uses: depot/build-push-action@v1
name: Export packages
with:
project: zjh7v82xv6
context: fedora
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
llvm_version=${{ matrix.llvm_version }}
base_image=${{ matrix.base_image }}
base_image_tag=${{ matrix.base_image_tag }}
pkg_revision=${{ github.run_number }}
target: pkgs
outputs: pkgs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: crystal-${{ matrix.base_image }}-${{ matrix.base_image_tag }}-pkgs
path: pkgs
- name: Upload to Packagecloud
run: |
set -euxo pipefail
DIST_ID=$(curl -fsSu "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | jq ".rpm[] | select(.index_name == \"${{ matrix.base_image }}\").versions[] | select(.index_name == \"${{ matrix.base_image_tag }}\").id")
find pkgs -name "*.rpm" | xargs -I{} curl -fsSu "${{ secrets.packagecloud_token }}:" -F "package[distro_version_id]=$DIST_ID" -F "package[package_file]=@{}" -XPOST https://packagecloud.io/api/v1/repos/84codes/crystal/packages.json
if: ${{ github.ref == 'refs/heads/main' }}
centos:
name: CentOS Stream
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
strategy:
fail-fast: false
matrix:
include:
- base_image: quay.io/centos/centos
base_image_tag: stream9
el_version: 9
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
- uses: depot/setup-action@v1
- uses: depot/build-push-action@v1
name: Build and push container
with:
project: zjh7v82xv6
context: centos
pull: true
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
llvm_version=${{ matrix.llvm_version }}
base_image=${{ matrix.base_image }}
base_image_tag=${{ matrix.base_image_tag }}
pkg_revision=${{ github.run_number }}
tags: |
84codes/crystal:${{ env.crystal_version }}-centos-${{ matrix.base_image_tag }}
84codes/crystal:${{ env.crystal_version }}-el-${{ matrix.el_version }}
84codes/crystal:latest-centos-${{ matrix.base_image_tag }}
84codes/crystal:latest-el-${{ matrix.el_version }}
push: ${{ github.ref == 'refs/heads/main' }}
- uses: depot/build-push-action@v1
name: Export packages
with:
project: zjh7v82xv6
context: centos
platforms: linux/amd64,linux/arm64
build-args: |
crystal_version=${{ env.crystal_version }}
shards_version=${{ env.shards_version }}
gc_version=${{ env.gc_version }}
llvm_version=${{ matrix.llvm_version }}
base_image=${{ matrix.base_image }}
base_image_tag=${{ matrix.base_image_tag }}
pkg_revision=${{ github.run_number }}
target: pkgs
outputs: pkgs
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: crystal-centos-${{ matrix.base_image_tag }}-pkgs
path: pkgs
- name: Upload to Packagecloud
run: |
set -euxo pipefail
DIST_ID=$(curl -fsSu "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | jq ".rpm[] | select(.index_name == \"el\").versions[] | select(.index_name == \"${{ matrix.el_version }}\").id")
find pkgs -name "*.rpm" | xargs -I{} curl -fsSu "${{ secrets.packagecloud_token }}:" -F "package[distro_version_id]=$DIST_ID" -F "package[package_file]=@{}" -XPOST https://packagecloud.io/api/v1/repos/84codes/crystal/packages.json
if: ${{ github.ref == 'refs/heads/main' }}