Skip to content

Commit 27f5480

Browse files
committed
added system tests
1 parent 88892c5 commit 27f5480

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/systems.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Systems
2+
on:
3+
schedule:
4+
# Sunday 4:30 UTC or 00:30 EDT
5+
- cron: '30 4 * * 0'
6+
7+
concurrency:
8+
group: systems-omega_h
9+
cancel-in-progress: true
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
strategy:
16+
matrix:
17+
machine: ["Perlmutter", "Frontier"]
18+
19+
steps:
20+
21+
- name: checkout omega_h
22+
uses: actions/checkout@v4
23+
with:
24+
path: omega_h
25+
26+
- name: setup python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.10'
30+
31+
- name: install packing
32+
run: sudo apt install python3-packaging
33+
34+
- name: install globus
35+
run: |
36+
python -m ensurepip --upgrade --user
37+
python -m pip install globus-compute-endpoint
38+
39+
- name: use globus
40+
working-directory: omega_h/.github/workflows
41+
env:
42+
GLOBUS_ID: ${{ secrets.GLOBUS_COMPUTE_ID }}
43+
GLOBUS_SECRET: ${{ secrets.GLOBUS_COMPUTE_SECRET }}
44+
run: |
45+
export GLOBUS_COMPUTE_CLIENT_ID="$GLOBUS_ID"
46+
export GLOBUS_COMPUTE_CLIENT_SECRET="$GLOBUS_SECRET"
47+
if [ ${{matrix.machine}} == Perlmutter ]; then TARGET_ENDPOINT=0dd4499a-8d76-4977-bae9-841e4bb2f616; fi
48+
if [ ${{matrix.machine}} == Frontier ]; then TARGET_ENDPOINT=d625c6cf-de7a-4228-ac44-56247a642fe0; fi
49+
python test_on_system.py ${{ github.event.repository.name }} ${{ github.sha }} $TARGET_ENDPOINT
50+
51+
- name: print build log
52+
working-directory: omega_h/.github/workflows
53+
run: cat omega_h-test-result/Build.log
54+
55+
- name: print test log
56+
working-directory: omega_h/.github/workflows
57+
run: cat omega_h-test-result/Test.log
58+
59+
- name: check failed test
60+
working-directory: omega_h/.github/workflows
61+
run: if grep "Failed" omega_h-test-result/Test.log; then return 1; fi
62+
63+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# How to use
2+
# 1. Login to https://app.globus.org/settings/developers and copy a project app id and secret
3+
# 2. Use the id and secret to create and endpoint https://funcx.readthedocs.io/en/latest/sdk.html#client-credentials-with-clients
4+
# $ export FUNCX_SDK_CLIENT_ID="b0500dab-ebd4-430f-b962-0c85bd43bdbb"
5+
# $ export FUNCX_SDK_CLIENT_SECRET="ABCDEFGHIJKLMNOP0123456789="
6+
# 3. Set up an endpoint on the computer that will run the tests, using these instructions: https://funcx.readthedocs.io/en/latest/endpoints.html
7+
# 4. Create install-test.sh and run-test.sh on target computer
8+
9+
from globus_compute_sdk import Executor
10+
import sys
11+
import os
12+
13+
name = sys.argv[1]
14+
branch = sys.argv[2]
15+
endpoint = sys.argv[3]
16+
17+
def run_on_endpoint(name, branch):
18+
import subprocess
19+
20+
install = subprocess.run(["./install-test.sh "+name+" "+branch], shell=True, encoding="utf_8", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
21+
if install.returncode == 1:
22+
return (install, None)
23+
24+
result = subprocess.run(["./run-test.sh "+name], shell=True, encoding="utf_8", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
25+
return (install, result)
26+
27+
gce = Executor(endpoint_id = endpoint)
28+
future = gce.submit(run_on_endpoint, name, branch)
29+
result = future.result()
30+
31+
os.popen("mkdir -p "+name+"-result").read()
32+
with open(name+"-result/Build.log", "w") as text_file:
33+
text_file.write("%s" % result[0].stdout)
34+
text_file.close()
35+
if result[0].returncode == 0:
36+
with open(name+"-result/Test.log", "w") as text_file:
37+
text_file.write("%s" % result[1].stdout)
38+
text_file.close()

0 commit comments

Comments
 (0)