Repository navigation
66 lines (53 loc) · 2.43 KB
/
Copy pathpython-examples.yml
File metadata and controls
66 lines (53 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Python examples
on:
push:
pull_request:
branches: [v2-main]
jobs:
run-examples:
runs-on: ubuntu-latest
# RHEL 9 platform: its system python 3.9 is the lowest supported version and the one used at JLab
container: almalinux:9
env:
CCDB_USER: test_user
steps:
- uses: actions/checkout@v7
# The system python 3.9 on purpose: proves examples run on the lowest supported python
- name: Set up the system Python in a virtual environment
run: |
dnf -y install python3
python3 -m venv /opt/venv
echo /opt/venv/bin >> "$GITHUB_PATH"
# The github.workspace context is the host path; inside the container the workspace is $GITHUB_WORKSPACE
- name: Point CCDB at the workspace
run: |
echo "CCDB_HOME=$GITHUB_WORKSPACE" >> "$GITHUB_ENV"
echo "CCDB_CONNECTION=sqlite:///$GITHUB_WORKSPACE/examples.sqlite" >> "$GITHUB_ENV"
- name: Install ccdb with examples extras
run: pip install ".[examples]"
- name: Create database (ccdb db init)
run: ccdb db init --init-i-am-sure
- name: example_llapi_readout
working-directory: python
run: python examples/example_llapi_readout.py
- name: example_llapi_change_value
working-directory: python
run: python examples/example_llapi_change_value.py
- name: example_llapi_variations
working-directory: python
run: python examples/example_llapi_variations.py
- name: example_llapi_copy
working-directory: python
run: python examples/example_llapi_copy.py
# This example documents its own prerequisite: the custom_data table
- name: example_llapi_add_custom_data
working-directory: python
run: |
ccdb mktbl /test/test_vars/custom_data -r 1 xml_data=string "#Store xml in ccdb"
python examples/example_llapi_add_custom_data.py
# SKIPPED examples (cannot run in CI):
# example_halld_connect.py - connects to the JLab HallD MySQL server (network/VPN)
# example_llapi_edit_assignment.py - snippet with hardcoded /home/user paths, not runnable as-is
# example_run_period_to_pandas.py - needs HallD run-period data absent from the standard test DB
- name: List skipped examples
run: echo "Skipped (need JLab MySQL or HallD data) - example_halld_connect, example_llapi_edit_assignment, example_run_period_to_pandas"