Skip to content

Commit

Permalink
Merge pull request #429 from Angelyr/ac/system-actions
Browse files Browse the repository at this point in the history
System Tests
  • Loading branch information
cwsmith authored May 21, 2024
2 parents 2dfed84 + da15a24 commit 90e1f46
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/systems.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Systems
on:
schedule:
# Sunday 4:30 UTC or 00:30 EDT
- cron: '30 4 * * 0'

concurrency:
group: systems-omega_h
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
machine: ["Perlmutter", "Frontier"]

steps:

- name: checkout omega_h
uses: actions/checkout@v4
with:
path: omega_h

- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: install packing
run: sudo apt install python3-packaging

- name: install globus
run: |
python -m ensurepip --upgrade --user
python -m pip install globus-compute-endpoint
- name: use globus
working-directory: omega_h/.github/workflows
env:
GLOBUS_ID: ${{ secrets.GLOBUS_COMPUTE_ID }}
GLOBUS_SECRET: ${{ secrets.GLOBUS_COMPUTE_SECRET }}
run: |
export GLOBUS_COMPUTE_CLIENT_ID="$GLOBUS_ID"
export GLOBUS_COMPUTE_CLIENT_SECRET="$GLOBUS_SECRET"
if [ ${{matrix.machine}} == Perlmutter ]; then TARGET_ENDPOINT=0dd4499a-8d76-4977-bae9-841e4bb2f616; fi
if [ ${{matrix.machine}} == Frontier ]; then TARGET_ENDPOINT=d625c6cf-de7a-4228-ac44-56247a642fe0; fi
python test_on_system.py ${{ github.event.repository.name }} ${{ github.sha }} $TARGET_ENDPOINT
- name: print build log
working-directory: omega_h/.github/workflows
run: cat omega_h-test-result/Build.log

- name: print test log
working-directory: omega_h/.github/workflows
run: cat omega_h-test-result/Test.log

- name: check failed test
working-directory: omega_h/.github/workflows
run: if grep "Failed" omega_h-test-result/Test.log; then return 1; fi


38 changes: 38 additions & 0 deletions .github/workflows/test_on_system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# How to use
# 1. Login to https://app.globus.org/settings/developers and copy a project app id and secret
# 2. Use the id and secret to create and endpoint https://funcx.readthedocs.io/en/latest/sdk.html#client-credentials-with-clients
# $ export FUNCX_SDK_CLIENT_ID="b0500dab-ebd4-430f-b962-0c85bd43bdbb"
# $ export FUNCX_SDK_CLIENT_SECRET="ABCDEFGHIJKLMNOP0123456789="
# 3. Set up an endpoint on the computer that will run the tests, using these instructions: https://funcx.readthedocs.io/en/latest/endpoints.html
# 4. Create install-test.sh and run-test.sh on target computer

from globus_compute_sdk import Executor
import sys
import os

name = sys.argv[1]
branch = sys.argv[2]
endpoint = sys.argv[3]

def run_on_endpoint(name, branch):
import subprocess

install = subprocess.run(["./install-test.sh "+name+" "+branch], shell=True, encoding="utf_8", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if install.returncode == 1:
return (install, None)

result = subprocess.run(["./run-test.sh "+name], shell=True, encoding="utf_8", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
return (install, result)

gce = Executor(endpoint_id = endpoint)
future = gce.submit(run_on_endpoint, name, branch)
result = future.result()

os.popen("mkdir -p "+name+"-result").read()
with open(name+"-result/Build.log", "w") as text_file:
text_file.write("%s" % result[0].stdout)
text_file.close()
if result[0].returncode == 0:
with open(name+"-result/Test.log", "w") as text_file:
text_file.write("%s" % result[1].stdout)
text_file.close()

0 comments on commit 90e1f46

Please sign in to comment.