Skip to content

Commit

Permalink
Small cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvami committed Sep 18, 2024
1 parent 3998496 commit b7f6f95
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 5 deletions.
74 changes: 74 additions & 0 deletions .github/actions/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash

###############################################################################
# common.sh
# Shared bash functions between many different actions.
#
# Assumptions
# - The env variable LDMX_DOCKER_TAG has the image we should be using
# - The label for the gold plots is in
# .github/actions/validate/gold_label
# - ldmx-sw has been checked out using actions/checkout@v2
# OR the build package was unpacked to mimic this effect
# (this assumption basically means that GITHUB_WORKSPACE points to ldmx-sw)
#
# Usage
# GitHub defines GITHUB_ACTION_PATH to be the full path to the diretory
# for the action that is being run. This means, since this file is one
# below that directory, we can source it like so
# source ${GITHUB_ACTION_PATH}/../common.sh
# https://docs.github.com/en/actions/reference/environment-variables
###############################################################################

# Print the gold label
ldmx_gold_label() {
cat ${LDMX_GOLD_LABEL_FILE}
}

# container running command
# - Assume LDMX_DOCKER_TAG is the image we run in
# - Full command needs to be provided
# - Runs inside the present working directory
ldmx() {
docker run \
-i -v ${LDMX_BASE}:${LDMX_BASE} -e LDMX_BASE \
-e LDMX_NUM_EVENTS -e LDMX_RUN_NUMBER \
-u $(id -u $USER):$(id -g $USER) \
${LDMX_DOCKER_TAG} $(pwd) $@
return $?
}

# GitHub workflow command to set an output key,val pair
set_output() {
local _key="$1"
local _val="$2"
echo "${_key} = ${_val}"
echo "${_key}=${_val}" >> $GITHUB_OUTPUT
}

# GitHub workflow command to start an group of output messages
start_group() {
echo "::group::$@"
}

# GitHub workflow command to end previously started group
end_group() {
echo "::endgroup::"
}

# GitHub workflow command to flag message as an error
error() {
echo "::error::$@"
}

warn() {
echo "::warning::$@"
}

start_group Deduce Common Environment Variables
export LDMX_GOLD_LABEL_FILE=${GITHUB_WORKSPACE}/.github/actions/validate/gold_label
export LDMX_BASE=$(cd ${GITHUB_WORKSPACE}/../ && pwd)
echo "LDMX_GOLD_LABEL_FILE=${LDMX_GOLD_LABEL_FILE}"
echo "LDMX_BASE=${LDMX_BASE}"
end_group

2 changes: 1 addition & 1 deletion .github/workflows/basic_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
submodules: 'recursive'

- name : Install just
- name: Install just
uses: extractions/setup-just@v2
with:
just-version: 1.26.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compile_clang_lto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
submodules: 'recursive'

- name : Install just
- name: Install just
uses: extractions/setup-just@v2
with:
just-version: 1.26.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
submodules: 'recursive'

- name : Install just
- name: Install just
uses: extractions/setup-just@v2
with:
just-version: 1.26.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/new_pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
submodules: 'recursive'
ref: ${{ github.event.inputs.branch }}

- name : Install just
- name: Install just
uses: extractions/setup-just@v2
with:
just-version: 1.26.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
just build
shell: bash

- name: Git Gold Histograms from trunk
- name: Get Gold Histograms from trunk
run: git checkout origin/trunk -- .github/validation_samples/*/gold.root .github/actions/validate/gold_label
shell: bash

Expand Down

0 comments on commit b7f6f95

Please sign in to comment.