-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
90 lines (82 loc) · 3.26 KB
/
Copy pathaction.yml
File metadata and controls
90 lines (82 loc) · 3.26 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: 'start-sirepo'
description: 'Start Sirepo with pre-defined simulations'
inputs:
image-tag:
description: 'Sirepo Docker image tag to use'
required: false
default: 'beta'
docker-binary:
description: 'Docker binary (docker or podman)'
required: false
default: 'docker'
sirepo-bluesky-repo:
description: 'sirepo-bluesky repo with GH org name'
required: false
default: 'NSLS-II/sirepo-bluesky'
sirepo-bluesky-branch:
description: 'Branch to clone from the sirepo-bluesky repo'
required: false
default: 'main'
sirepo-srdb-target-dir:
description: 'The directory where to copy SIREPO_SRDB_ROOT dir to'
required: false
default: '/tmp/SIREPO_SRDB_ROOT'
runs:
using: "composite"
steps:
- name: Optionally clone Sirepo-Bluesky repo and get example files
shell: bash -l {0}
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
set -vxeuo pipefail
if [ -d "${GITHUB_WORKSPACE}/sirepo_bluesky/tests/SIREPO_SRDB_ROOT" ]; then
# In Sirepo-Bluesky repo.
SIREPO_BLUESKY_REPO_ROOT="${GITHUB_WORKSPACE}"
else
# In other repos.
where_to_clone="/tmp/sirepo-bluesky"
# git clone --depth=1 https://github.com/NSLS-II/sirepo-bluesky.git ${where_to_clone}
git clone --depth=1 --single-branch -b ${{ inputs.sirepo-bluesky-branch }} https://github.com/${{ inputs.sirepo-bluesky-repo }}.git ${where_to_clone}
SIREPO_BLUESKY_REPO_ROOT="${where_to_clone}"
fi
echo "SIREPO_BLUESKY_REPO_ROOT=${SIREPO_BLUESKY_REPO_ROOT}" >> $GITHUB_ENV
SIREPO_SRDB_ROOT="${SIREPO_BLUESKY_REPO_ROOT}/sirepo_bluesky/tests/SIREPO_SRDB_ROOT"
SIREPO_SRDB_HOST_RO=${{ inputs.sirepo-srdb-target-dir }}
echo "SIREPO_SRDB_HOST_RO=${SIREPO_SRDB_HOST_RO}" >> $GITHUB_ENV
cp -Rv ${SIREPO_SRDB_ROOT} ${SIREPO_SRDB_HOST_RO}
- name: Install Podman
if: inputs.docker-binary == 'podman'
shell: bash -l {0}
run: |
set -vxeuo pipefail
sudo apt-get -y update
sudo apt-get -y install podman
- name: Set up env vars
shell: bash -l {0}
run: |
set -vxeuo pipefail
export DOCKER_IMAGE_TAG=${{ inputs.image-tag }}
echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}" >> $GITHUB_ENV
export DOCKER_BINARY=${{ inputs.docker-binary }}
echo "DOCKER_BINARY=${DOCKER_BINARY}" >> $GITHUB_ENV
- name: Start Sirepo Docker container
shell: bash -l {0}
run: |
set -vxeuo pipefail
. ${SIREPO_BLUESKY_REPO_ROOT}/scripts/start_sirepo.sh -d
export SIREPO_DOCKER_CONTAINER_ID
echo "SIREPO_DOCKER_CONTAINER_ID=${SIREPO_DOCKER_CONTAINER_ID}" >> $GITHUB_ENV
- name: Check Sirepo state
shell: bash -l {0}
run: |
set -vxeuo pipefail
# Sleeping to allow sirepo time to start up
sleep 10
${DOCKER_BINARY} images
${DOCKER_BINARY} ps -a
container=$(${DOCKER_BINARY} ps -q -f id=${SIREPO_DOCKER_CONTAINER_ID})
${DOCKER_BINARY} logs ${SIREPO_DOCKER_CONTAINER_ID}
if [ -z "${container}" ]; then
echo "Container ID ${SIREPO_DOCKER_CONTAINER_ID} is not running. Exiting."
exit 1
fi