Skip to content

CI

CI #1205

Workflow file for this run

name: CI
env:
IMAGE_NAME: arkmq-org-broker-init
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
types: [opened, edited, synchronize, reopened]
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
snapshot:
description: 'Snapshot'
required: false
default: false
type: boolean
trigger_children:
description: 'Trigger children'
required: false
default: false
type: boolean
trigger_release:
description: 'Trigger release'
required: false
default: false
type: boolean
jobs:
validate:
name: Validate
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Validate commit messages
env:
COMMIT_COUNT: ${{ github.event.pull_request.commits }}
COMMIT_PATTERN: '^\[(NO-ISSUE|#[0-9]+)\] .+$'
run: |
git log --format=%s --max-count="$COMMIT_COUNT" --skip=1 | while IFS= read -r COMMIT_MESSAGE; do
if [[ ! "$COMMIT_MESSAGE" =~ $COMMIT_PATTERN ]]; then
echo "Invalid commit message: '$COMMIT_MESSAGE'"
echo "Commit messages must start with '[NO-ISSUE]' or '[#NNN]', followed by a space and a description."
exit 1
fi
done
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v6
- name: Execute the tests
run: ./run_test.sh
- name: Update base image
if: ${{ inputs.snapshot }}
run: |
BASE_IMAGE="quay.io/${{ secrets.QUAY_NAMESPACE }}/arkmq-org-broker-kubernetes@$(skopeo inspect docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/arkmq-org-broker-kubernetes:snapshot | jq -r '.Digest')"
sed -i "s~FROM.*~FROM ${BASE_IMAGE}~g" Dockerfile
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Build the image
run: |
podman build --label git-sha=$GITHUB_SHA --no-cache --platform linux/amd64 --platform linux/arm64 --manifest $IMAGE_NAME:dev.latest .
- name: Check the image
run: podman run $IMAGE_NAME:dev.latest yacfg --profile artemis/2.15.0/default_with_user_address_settings.yaml.jinja2
- name: Push the dev image
if: ${{ github.event_name == 'push' }}
run: |
podman login --username=${{ secrets.QUAY_USERNAME }} --password=${{ secrets.QUAY_PASSWORD }} quay.io
podman manifest push $IMAGE_NAME:dev.latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:dev.latest
- name: Push the snapshot image
if: ${{ github.event_name == 'schedule' || inputs.snapshot }}
run: |
podman login --username=${{ secrets.QUAY_USERNAME }} --password=${{ secrets.QUAY_PASSWORD }} quay.io
podman manifest push $IMAGE_NAME:dev.latest docker://quay.io/${{ secrets.QUAY_NAMESPACE }}/$IMAGE_NAME:snapshot
- name: Trigger release
if: ${{ inputs.trigger_release }}
uses: actions/github-script@v8
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.ref,
workflow_id: 'release.yml',
inputs: {
trigger_children: ${{ inputs.trigger_children }}
}
});