-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (128 loc) · 3.93 KB
/
tests.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
name: Tests
# yamllint disable-line rule:truthy
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
jobs:
pytest:
runs-on: ubuntu-22.04
if: |
github.event_name == 'push' ||
github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
tokamak:
- C-MOD
- DIII-D
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MDSplus sources
env:
GPG: http://www.mdsplus.org/dist/mdsplus.gpg.key
KEY: /usr/share/keyrings/mdsplus.asc
REPO: http://www.mdsplus.org/dist/Ubuntu22/repo
APT: /etc/apt/sources.list.d/mdsplus.list
run: |
curl -fsSL "$GPG" \
| sudo tee "$KEY"
echo "deb [arch=amd64 signed-by=$KEY] $REPO MDSplus alpha" \
| sudo tee "$APT"
- name: Update sources
run: sudo apt-get update
- name: Install prerequisites
run: |
sudo apt-get install msodbcsql17 # pre-installed
sudo apt-get install tdsodbc unixodbc # freetds
sudo apt-get install mdsplus-alpha-python # mdsplus
- name: Configure MDSplus
run: |
{
echo PYTHONPATH=/usr/local/mdsplus/python
echo LD_LIBRARY_PATH=/usr/local/mdsplus/lib
} \
| tee -a "$GITHUB_ENV"
- name: Setup SSH key
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_TUNNEL }}" \
| tee ~/.ssh/id_rsa \
| sha256sum
chmod 600 ~/.ssh/id_rsa
- name: Setup C-MOD
if: ${{ matrix.tokamak == 'C-MOD' }}
run: |
ssh "${{ secrets.CMOD_USER }}@${{ secrets.CMOD_HOST }}" \
-p "${{ secrets.CMOD_PORT }}" \
-L 8000:alcdata-archives:8000 \
-L 1433:alcdb2:1433 \
-o StrictHostKeyChecking=no \
-N -v 2> ssh.log &
echo "$!" \
| tee ssh.pid
echo "127.0.0.1 alcdata-archives alcdb2" \
| sudo tee -a /etc/hosts
echo "${{ secrets.CMOD_LOGIN }}" \
| tee ~/logbook.sybase_login \
| sha256sum
echo DISPY_TOKAMAK=cmod \
| tee -a "$GITHUB_ENV"
- name: Setup DIII-D
if: ${{ matrix.tokamak == 'DIII-D' }}
env:
TDS: /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
run: |
ssh "${{ secrets.DIIID_USER }}@${{ secrets.DIIID_HOST }}" \
-p "${{ secrets.DIIID_PORT }}" \
-L 8000:atlas:8000 \
-L 8001:d3drdb:8001 \
-o StrictHostKeyChecking=no \
-N -v 2> ssh.log &
echo "$!" \
| tee ssh.pid
echo "127.0.0.1 atlas d3drdb" \
| sudo tee -a /etc/hosts
echo "${{ secrets.DIIID_LOGIN }}" \
| tee ~/D3DRDB.sybase_login \
| sha256sum
echo -e "[FreeTDS]\nDescription = FreeTDS\nDriver = $TDS" \
| sudo tee -a /etc/odbcinst.ini
echo DISPY_TOKAMAK=d3d \
| tee -a "$GITHUB_ENV"
- name: Install poetry
run: pipx install 'poetry<2.0.0'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: 'pyproject.toml'
cache: 'poetry'
- name: Install requirements
run: make install-all
- name: Check tunnel
run: |
xargs -a ssh.pid ps -p || true
if ! grep 'Authenticated.*publickey' ssh.log
then
curl -s ipinfo.io && echo
cat -n ssh.log
false
fi
- name: Test SQL
run: poetry run python examples/sql.py
- name: Test MDSplus
run: poetry run python examples/mdsplus.py
- name: Test EFIT
run: poetry run python examples/efit.py
- name: Run all tests
run: make test
- name: Close tunnel
run: xargs -a ssh.pid kill -TERM