Skip to content

Commit

Permalink
add generic ioc build tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jun 18, 2024
1 parent d344029 commit 4a13316
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 34 deletions.
61 changes: 46 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@ on:
pull_request:

jobs:
check-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Run schema/ioc instance generation tests
run: |
python tests/test_generate.py
check-docker-build:
# pull requests are a duplicate of a branch push if within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
permissions:
contents: read
packages: write
env:
CACHE: /tmp/.buildx-cache
strategy:
fail-fast: false
max-parallel: 5
matrix:
include:
# rtems is cross compiled on ubuntu-latest
Expand All @@ -25,8 +36,10 @@ jobs:
# os: ubuntu-latest
# platform: linux/amd64

- architecture: linux
- repo: [ioc-adaravis, ioc-pmac, ioc-lakeshore340, ioc-tetramm, ioc-opcua, ioc-motorSim, ioc-adsimdetector]
os: ubuntu-latest
epics-target: linux-x86_64
extension: ""
platform: linux/amd64

# enable below for MACOS native build on M1 macs
Expand All @@ -52,13 +65,31 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Test Build Script
env:
ARCH: ${{ matrix.architecture }}
PLATFORM: ${{ matrix.platform }}
CACHE: ${{ env.CACHE }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup
# before building the container set up to use this version of ibek-support
# and its associated version of ibek
run: |
for test in tests/*.sh; do
echo "RUNNING TEST SCRIPT ${test}"
${test}
done
git clone ${{matrix.repo}} -/tmp/generic_ioc
cp -r . /tmp/generic_ioc/ibek-support
cp ./requirements.txt /tmp/generic_ioc
- name: Build image
uses: docker/build-push-action@v5
with:
context: /tmp/generic_ioc
platforms: ${{ matrix.platform }}
target: runtime
build-args: |
IMAGE_EXT=${{ matrix.extension }}
cache-from: type=gha,scope=${{ matrix.epics-target }}
cache-to: type=gha,mode=max,scope=${{ matrix.epics-target }}
tags: ci_test
load: true

- name: Test image
# can't test non native without some hardware to run on
if: ${{ matrix.epics-target == 'linux-x86_64' }}
run: /tmp/generic_ioc/tests/run-tests.sh ci_test
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "tests/beamlines/bl47p"]
path = tests/ioc_repos/bl47p
url = https://github.com/epics-containers/bl47p.git
[submodule "tests/beamlines/bl45p"]
path = tests/ioc_repos/bl45p
url = https://github.com/epics-containers/bl45p.git
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ibek==2.0.2
1 change: 1 addition & 0 deletions tests/ioc_repos/bl45p
Submodule bl45p added at 02d9b6
1 change: 1 addition & 0 deletions tests/ioc_repos/bl47p
Submodule bl47p added at 3fff47
14 changes: 14 additions & 0 deletions tests/test_generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -xe

THIS_FOLDER=$(realpath $(dirname ${0}))
IBEK_SROOT=${THIS_FOLDER}/../

pip install --upgrade -r $IBEK_SROOT/requirements.txt

# make a global ioc schema for all the support modules combined
# this validates all ibek.support.yaml files
echo generating all support schema
ibek ioc generate-schema ${IBEK_SROOT}*/*.ibek.support.yaml --no-ibek-defs --output /tmp/all.ibek.ioc.schema.json

19 changes: 0 additions & 19 deletions tests/test_ioc_generate.sh

This file was deleted.

0 comments on commit 4a13316

Please sign in to comment.