Skip to content

Commit a812318

Browse files
authored
Merge pull request #102 from jacomago/ruff-docker-test
End to end testing for RecCeiver.
2 parents fdcd310 + 26d6b4c commit a812318

32 files changed

+806
-274
lines changed

.github/workflows/server.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ name: recceiver
44
on:
55
push:
66
branches: [ "master" ]
7+
paths:
8+
- server/**
79
pull_request:
810
branches: [ "master" ]
11+
paths:
12+
- server/**
913

1014
jobs:
1115
build-server:
@@ -17,12 +21,39 @@ jobs:
1721
run:
1822
working-directory: server
1923
steps:
20-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2125
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v3
26+
uses: actions/setup-python@v5
2327
with:
2428
python-version: ${{ matrix.python-version }}
2529
- name: Install
2630
run: |
2731
python -m pip install --upgrade pip
2832
pip install .
33+
test:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] # testcontainers is not supported on <3.9
39+
needs: build-server
40+
defaults:
41+
run:
42+
working-directory: server
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
python -m pip install '.[test]'
53+
python -m pip install .
54+
- name: Clear existing docker image cache
55+
shell: bash
56+
run: docker image prune -af
57+
- name: Test with pytest
58+
run: |
59+
pytest

.gitignore

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
O.*
2-
bin
3-
lib
4-
dbd
5-
envPaths
6-
dropin.cache
1+
application.log
72

8-
*.pyc
9-
*.pyo
10-
*.log
11-
*.pid
12-
*.db
13-
client/configure/*.local
3+
# python
4+
.venv
5+
venv
6+
7+
## caches
8+
.*_cache
9+
10+
# ides
11+
.vscode
12+
.idea
1413

1514
*~
1615
.*.swp
16+
17+
DS_Store

client/.dockerignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
O.*
2+
bin
3+
lib
4+
dbd
5+
envPaths
6+
dropin.cache
7+
8+
*.pyc
9+
*.pyo
10+
*.log
11+
*.pid
12+
configure/*.local
13+
14+
*~
15+
.*.swp

client/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
O.*
2+
bin
3+
lib
4+
envPaths
5+
dropin.cache
6+
7+
*.pyc
8+
*.pyo
9+
*.log
10+
*.pid
11+
configure/*.local
12+
13+
dbd
14+
15+
16+
.iocsh_history

client/Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Download Epics
2+
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS epics-download-extract
3+
SHELL ["/bin/bash", "-c"]
4+
RUN apt-get update && apt-get install -yq wget git
5+
WORKDIR /var/cache
6+
ARG EPICSVERSION=7.0.8.1
7+
RUN wget -q --show-progress https://epics.anl.gov/download/base/base-$EPICSVERSION.tar.gz \
8+
&& mkdir /epics/ \
9+
&& tar -xf base-$EPICSVERSION.tar.gz -C /epics \
10+
&& rm base-$EPICSVERSION.tar.gz
11+
12+
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS base
13+
14+
FROM base AS base-amd64
15+
ENV EPICS_HOST_ARCH=linux-x86_64
16+
17+
FROM base AS base-386
18+
ENV EPICS_HOST_ARCH=linux-x86
19+
20+
FROM base AS base-arm64
21+
ENV EPICS_HOST_ARCH=linux-arm
22+
23+
FROM base AS base-arm
24+
ENV EPICS_HOST_ARCH=linux-arm
25+
26+
# Now finally choose the right base image:
27+
FROM base-$TARGETARCH AS build-epics
28+
SHELL ["/bin/bash", "-c"]
29+
ENV DEBIAN_FRONTEND=noninteractive
30+
RUN apt-get update \
31+
&& apt-get install --no-install-recommends -yq \
32+
build-essential \
33+
ca-certificates \
34+
curl \
35+
libreadline-dev \
36+
telnet \
37+
&& apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt
38+
39+
WORKDIR /epics
40+
COPY --from=epics-download-extract /epics /epics
41+
ARG EPICSVERSION=7.0.8.1
42+
RUN mv base-$EPICSVERSION base
43+
RUN cd base && make -j$(nproc)
44+
45+
FROM build-epics AS recsync-base
46+
47+
WORKDIR /recsync
48+
COPY . /recsync/
49+
RUN mv docker/RELEASE.local configure/RELEASE.local
50+
ENV EPICS_ROOT=/epics
51+
ENV EPICS_BASE=${EPICS_ROOT}/base
52+
RUN make
53+
WORKDIR /recsync/iocBoot/iocdemo
54+
55+
FROM recsync-base AS ioc-runner
56+
57+
CMD /recsync/bin/${EPICS_HOST_ARCH}/demo st.cmd

client/demoApp/Db/archive.db

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
record(ai, "$(P)ai:archive") {
3+
info("test", "testing")
4+
info("archive", "MONITOR@1")
5+
}
6+
7+
record(longout, "$(P)lo:archive") {
8+
info("test", "testing")
9+
info("hello", "world")
10+
info("archive", "default")
11+
}

client/demoApp/Db/somerecords.db

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ record(longin, "$(P)li") {
88
record(longout, "$(P)lo") {
99
info("test", "testing")
1010
info("hello", "world")
11+
field(DESC, "testdesc")
1112
}

client/docker/RELEASE.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EPICS_BASE=/epics/base

client/example-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
services:
3+
ioc1:
4+
build: ../client
5+
environment:
6+
- IOCSH_NAME=IOC1-2
7+
tty: true
8+
networks:
9+
- net-recc-1
10+
11+
networks:
12+
net-recc-1:
13+
driver: bridge

client/iocBoot/iocdemo/st.cmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ demo_registerRecordDeviceDriver(pdbbase)
1212
var(reccastTimeout, 5.0)
1313
var(reccastMaxHoldoff, 5.0)
1414

15-
epicsEnvSet("IOCNAME", "myioc")
15+
epicsEnvSet("IOCNAME", "$(IOCSH_NAME)")
1616
epicsEnvSet("ENGINEER", "myself")
1717
epicsEnvSet("LOCATION", "myplace")
1818

@@ -24,7 +24,7 @@ addReccasterEnvVars("CONTACT", "SECTOR")
2424
addReccasterEnvVars("BUILDING")
2525

2626
## Load record instances
27-
dbLoadRecords("../../db/reccaster.db", "P=test:")
28-
dbLoadRecords("../../db/somerecords.db","P=test:")
27+
dbLoadRecords("../../db/reccaster.db", "P=$(IOCSH_NAME):")
28+
dbLoadRecords("../../db/somerecords.db","P=$(IOCSH_NAME):")
2929

3030
iocInit()

0 commit comments

Comments
 (0)