Skip to content

Build of 2867/merge by @dependabot[bot] #2789

Build of 2867/merge by @dependabot[bot]

Build of 2867/merge by @dependabot[bot] #2789

name: "build-test-lint"
run-name: Build of ${{ github.ref_name }} by @${{ github.actor }}
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
debug_step:
required: false
description: "Pause the selected step to debug using tmate"
type: choice
default: ""
options:
- ""
- build
- test
- lint
env:
REGISTRY: ghcr.io
IMAGE_NAME: samvera/hyku
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
jobs:
build:
strategy:
matrix:
component: ["solr", "web", "worker"]
os: ["ubuntu-latest", "ubuntu-24.04-arm"]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
permissions: write-all
steps:
- name: Determine git sha to checkout
uses: haya14busa/action-cond@v1
id: gitsha
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.event.pull_request.head.sha }}
if_false: ${{ github.sha }}
- name: Set env
run: echo "TAG=${GIT_SHA::8}" >> $GITHUB_ENV
env:
GIT_SHA: ${{ steps.gitsha.outputs.value }}
- name: Downcase repo
run: echo "REPO_LOWER=${REPO,,}" >> $GITHUB_ENV
env:
REPO: "${{ github.repository }}"
- name: Set platform from matrix
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
echo "PLATFORM_TAG=amd64" >> $GITHUB_ENV
else
echo "PLATFORM_TAG=arm64" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Github Container Login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push ${{ matrix.component }} on ${{ matrix.os }}
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/${{ env.PLATFORM_TAG }}
target: hyku-${{ matrix.component }}
cache-from: |
type=registry,ref=ghcr.io/samvera/hyku/${{ matrix.component }}:latest
cache-to: type=inline
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.component }}:${{ env.TAG }}-${{ env.PLATFORM_TAG }}
push:
needs: build
runs-on: ubuntu-latest
steps:
- name: Determine git sha to checkout
uses: haya14busa/action-cond@v1
id: gitsha
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: ${{ github.event.pull_request.head.sha }}
if_false: ${{ github.sha }}
- name: Set env
run: echo "TAG=${GIT_SHA::8}" >> $GITHUB_ENV
env:
GIT_SHA: ${{ steps.gitsha.outputs.value }}
- name: Downcase repo
run: echo "REPO_LOWER=${REPO,,}" >> $GITHUB_ENV
env:
REPO: "${{ github.repository }}"
- name: Github Container Login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multiarch manifests
run: |
for component in solr web worker; do
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/$component:${{ env.TAG }} \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/$component:${{ env.TAG }}-amd64 \
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/$component:${{ env.TAG }}-arm64
done
lint:
needs: push
uses: notch8/actions/.github/workflows/[email protected]
with:
webTarget: hyku-web
workerTarget: hyku-worker
rubocop_cmd: "bundle exec rubocop --parallel --format progress"
test:
needs: push
uses: notch8/actions/.github/workflows/[email protected]
with:
confdir: "/app/samvera/hyrax-webapp/solr/conf"
rspec_cmd: "gem install semaphore_test_boosters && bundle && rspec_booster --job $CI_NODE_INDEX/$CI_NODE_TOTAL"
reports:
if: always()
needs: [test, lint]
uses: notch8/actions/.github/workflows/[email protected]