Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 61 additions & 5 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ jobs:
version: '>= 363.0.0'

- name: Build, test, deploy.
id: build_test_deploy
run: |
# Those two bash arrays will be populated depending on the required options,
# and expended as CLI arguments for the docker and scripts calls.
Expand All @@ -188,6 +189,11 @@ jobs:
script_args+=(--install-dir-basename GEOS-${SHORT_COMMIT})

if [[ "${{ inputs.UPLOAD_TO_GCP }}" == "true" && -z "${{ inputs.GCP_BUCKET }}" ]]; then
echo "::group::Baseline and log uploads"
echo "Status: configuration error"
echo "Google Cloud configuration: bucket=not set, project=${GCP_PROJECT:-not set}"
echo "No files were uploaded."
echo "::endgroup::"
echo "::error::UPLOAD_TO_GCP=true requires GCP_BUCKET to be set."
exit 1
fi
Expand Down Expand Up @@ -366,6 +372,28 @@ jobs:
echo "Received exit status ${EXIT_STATUS} from the build process."
set -e

echo "exit_status=${EXIT_STATUS}" >> "${GITHUB_OUTPUT}"
echo "data_basename=${DATA_BASENAME}" >> "${GITHUB_OUTPUT}"
echo "data_exchange_dir=${DATA_EXCHANGE_DIR}" >> "${GITHUB_OUTPUT}"

exit ${EXIT_STATUS}

- name: Baseline and log uploads
if: ${{ always() && steps.build_test_deploy.outputs.data_basename != '' }}
env:
GEOS_BUILD_EXIT_STATUS: ${{ steps.build_test_deploy.outputs.exit_status }}
GEOS_DATA_BASENAME: ${{ steps.build_test_deploy.outputs.data_basename }}
GEOS_DATA_EXCHANGE_DIR: ${{ steps.build_test_deploy.outputs.data_exchange_dir }}
run: |
EXIT_STATUS=${GEOS_BUILD_EXIT_STATUS:-1}
DATA_BASENAME=${GEOS_DATA_BASENAME}
DATA_EXCHANGE_DIR=${GEOS_DATA_EXCHANGE_DIR}
UPLOAD_HEADER_PRINTED=false
GCP_CREDENTIALS_STATUS="not set"
if [[ -n "${GOOGLE_APPLICATION_CREDENTIALS:-}" ]]; then
GCP_CREDENTIALS_STATUS=configured
fi

if [[ -n "${DATA_BASENAME}" ]]; then
if [ -f "${DATA_EXCHANGE_DIR}/${DATA_BASENAME}" ]; then
echo "Generated artifact at ${DATA_EXCHANGE_DIR}/${DATA_BASENAME}"
Expand Down Expand Up @@ -398,25 +426,53 @@ jobs:

if [[ "${{ inputs.UPLOAD_TO_GCP }}" == "true" && -n "${{ inputs.GCP_BUCKET }}" ]]; then
if [[ "${{ inputs.BUILD_TYPE }}" = "integrated_tests" || ${EXIT_STATUS} -eq 0 ]]; then
CLOUDSDK_PYTHON=python3 gcloud config set storage/parallel_composite_upload_enabled True
if ! CLOUDSDK_PYTHON=python3 gcloud config set storage/parallel_composite_upload_enabled True; then
echo "Status: upload configuration failed"
echo "Google Cloud configuration: bucket=gs://${{ inputs.GCP_BUCKET }}, project=${GCP_PROJECT:-not set}, credentials=${GCP_CREDENTIALS_STATUS}"
exit 1
fi

for file in \
"${DATA_EXCHANGE_DIR}/${DATA_BASENAME}" \
"${DATA_EXCHANGE_DIR}/test_logs_${DATA_BASENAME}" \
"${DATA_EXCHANGE_DIR}/baseline_${DATA_BASENAME}"
do
if [ -f "${file}" ]; then
CLOUDSDK_PYTHON=python3 gcloud storage cp --quiet -a publicRead "${file}" gs://${{ inputs.GCP_BUCKET }}/
echo "Uploaded https://storage.googleapis.com/${{ inputs.GCP_BUCKET }}/$(basename "${file}")"
case "$(basename "${file}")" in
baseline_*)
UPLOAD_LABEL=baselines
;;
test_logs_*)
UPLOAD_LABEL=logs
;;
*)
UPLOAD_LABEL=artifact
;;
esac

if ! CLOUDSDK_PYTHON=python3 gcloud storage cp --quiet -a publicRead "${file}" gs://${{ inputs.GCP_BUCKET }}/; then
echo "Status: upload failed"
echo "Google Cloud configuration: bucket=gs://${{ inputs.GCP_BUCKET }}, project=${GCP_PROJECT:-not set}, credentials=${GCP_CREDENTIALS_STATUS}, access=publicRead"
echo
echo "Failed upload:"
echo " ${UPLOAD_LABEL}: gs://${{ inputs.GCP_BUCKET }}/$(basename "${file}")"
exit 1
fi

if [[ "${UPLOAD_HEADER_PRINTED}" != "true" ]]; then
echo
echo "Users can download uploaded files at:"
UPLOAD_HEADER_PRINTED=true
fi
echo " ${UPLOAD_LABEL}:"
echo " https://storage.googleapis.com/${{ inputs.GCP_BUCKET }}/$(basename "${file}")"
fi
done
fi
else
echo "GCP upload disabled."
fi

exit ${EXIT_STATUS}

- name: Prepare pip for Codecov
if: inputs.CODE_COVERAGE
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ jobs:
ENABLE_TRILINOS: OFF
GEOS_ENABLE_BOUNDS_CHECK: ON
GCP_BUCKET: geosx/integratedTests
UPLOAD_TO_GCP: false
UPLOAD_TO_GCP: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
RUNS_ON: streak2-32core
NPROC: 32
DOCKER_RUN_ARGS: "--cpus=32 --memory=256g -v /etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro -v /etc/pki/tls/certs/ca-bundle.crt:/certs/ca-bundle.crt:ro"
Expand Down
Loading