Skip to content

attempt to parrellize GHA CI #339

attempt to parrellize GHA CI

attempt to parrellize GHA CI #339

Workflow file for this run

name: Docker Image CI
on:
create:
workflow_dispatch:
schedule:
- cron: '15 05 * * 1' # Late night for the Americas, early morning for Europe
pull_request:
paths-ignore:
- '**.md'
branches:
- master
push:
paths-ignore:
- '**.md'
tags-ignore:
- '**'
branches:
- master
- fork/master
- el8_migration
jobs:
code_check:
name: Code checks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ludeeus/action-shellcheck@2
env:
SHELLCHECK_OPTS: -x
- name: Install eclint
run: sudo npm install -g eclint
- name: Check EditorConfig compliance
run: eclint check $(git ls-files)
build_pr:
name: "Test Build Docker images"
if: github.event_name == 'pull_request' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
BUILD_AMD64: ${{ fromJSON('[0, 1]')[matrix.arch == 'amd64'] }}
BUILD_ARM64: ${{ fromJSON('[0, 1]')[matrix.arch == 'arm64'] }}
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
env:
OWNER: '${{ github.repository_owner }}'
- name: Build the Docker images
run: make DISABLE_OPTIMIZATIONS=1 "OWNER=$OWNER_LC"
build_edge:
name: "Build edge Docker images"
if: github.event_name != 'create' && github.event_name != 'pull_request' && github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
BUILD_AMD64: ${{ fromJSON('[0, 1]')[matrix.arch == 'amd64'] }}
BUILD_ARM64: ${{ fromJSON('[0, 1]')[matrix.arch == 'arm64'] }}
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
env:
OWNER: '${{ github.repository_owner }}'
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker images
run: make "OWNER=$OWNER_LC" VERSION=edge
- name: Push the Docker images
run: docker push "ghcr.io/$OWNER_LC/holy-build-box:edge"
build_release:
name: "Build release Docker images"
if: github.event_name == 'create' && github.event.ref_type == 'tag'
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'amd64'
- 'arm64'
env:
BUILD_AMD64: ${{ fromJSON('[0, 1]')[matrix.arch == 'amd64'] }}
BUILD_ARM64: ${{ fromJSON('[0, 1]')[matrix.arch == 'arm64'] }}
steps:
- uses: actions/checkout@v4
- name: Set lower case repository owner name
run: echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
env:
OWNER: '${{ github.repository_owner }}'
- name: Check versions match (Makefile & git-tag)
run: |
MAKEFILE_VERSION=$(grep '^VERSION = ' Makefile | sed 's|.*= *||')
GIT_TAG_VERSION=$(sed 's|^rel-||' <<< "$TAG")
if [[ "MAKEFILE_$VERSION" != "$GIT_TAG_VERSION" ]]; then
echo "ERROR: version in Makefile ($MAKEFILE_VERSION) doesn't match Git tag ($GIT_TAG_VERSION)"
exit 1
fi
env:
TAG: ${{ github.event.ref }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker images
run: make build "OWNER=$OWNER_LC"
- name: Tag and push the Docker images
run: make release "OWNER=$OWNER_LC"