mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
## Problem We practice a manual release flow for the compute module. This will allow automation of the compute release process. ## Summary of changes The workflow was modified to make a compute release automatically on the branch release-compute. ## Checklist before requesting a review - [x] I have performed a self-review of my code. - [ ] If it is a core feature, I have added thorough tests. - [ ] Do we need to implement analytics? if so did you add the relevant metrics to the dashboard? - [ ] If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section. ## Checklist before merging - [ ] Do not forget to reformat commit message to not include the above checklist
86 lines
3.2 KiB
YAML
86 lines
3.2 KiB
YAML
name: 'Store Allure results'
|
|
description: 'Upload test results to be used by actions/allure-report-generate'
|
|
|
|
inputs:
|
|
report-dir:
|
|
description: 'directory with test results generated by tests'
|
|
required: true
|
|
unique-key:
|
|
description: 'string to distinguish different results in the same run'
|
|
required: true
|
|
aws_oicd_role_arn:
|
|
description: 'the OIDC role arn to (re-)acquire for allure report upload - if not set call must acquire OIDC role'
|
|
required: false
|
|
default: ''
|
|
|
|
runs:
|
|
using: "composite"
|
|
|
|
steps:
|
|
- name: Set variables
|
|
shell: bash -euxo pipefail {0}
|
|
run: |
|
|
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH" || true)
|
|
if [ "${PR_NUMBER}" != "null" ]; then
|
|
BRANCH_OR_PR=pr-${PR_NUMBER}
|
|
elif [ "${GITHUB_REF_NAME}" = "main" ] || [ "${GITHUB_REF_NAME}" = "release" ] || \
|
|
[ "${GITHUB_REF_NAME}" = "release-proxy" ] || [ "${GITHUB_REF_NAME}" = "release-compute" ]; then
|
|
# Shortcut for special branches
|
|
BRANCH_OR_PR=${GITHUB_REF_NAME}
|
|
else
|
|
BRANCH_OR_PR=branch-$(printf "${GITHUB_REF_NAME}" | tr -c "[:alnum:]._-" "-")
|
|
fi
|
|
|
|
echo "BRANCH_OR_PR=${BRANCH_OR_PR}" >> $GITHUB_ENV
|
|
echo "REPORT_DIR=${REPORT_DIR}" >> $GITHUB_ENV
|
|
env:
|
|
REPORT_DIR: ${{ inputs.report-dir }}
|
|
|
|
- name: (Re-)configure AWS credentials # necessary to upload reports to S3 after a long-running test
|
|
if: ${{ !cancelled() && (inputs.aws_oicd_role_arn != '') }}
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
with:
|
|
aws-region: eu-central-1
|
|
role-to-assume: ${{ inputs.aws_oicd_role_arn }}
|
|
role-duration-seconds: 3600 # 1 hour should be more than enough to upload report
|
|
|
|
- name: Upload test results
|
|
shell: bash -euxo pipefail {0}
|
|
run: |
|
|
REPORT_PREFIX=reports/${BRANCH_OR_PR}
|
|
RAW_PREFIX=reports-raw/${BRANCH_OR_PR}/${GITHUB_RUN_ID}
|
|
|
|
# Add metadata
|
|
cat <<EOF > ${REPORT_DIR}/executor.json
|
|
{
|
|
"name": "GitHub Actions",
|
|
"type": "github",
|
|
"url": "https://${BUCKET}.s3.amazonaws.com/${REPORT_PREFIX}/latest/index.html",
|
|
"buildOrder": ${GITHUB_RUN_ID},
|
|
"buildName": "GitHub Actions Run #${GITHUB_RUN_NUMBER}/${GITHUB_RUN_ATTEMPT}",
|
|
"buildUrl": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}",
|
|
"reportUrl": "https://${BUCKET}.s3.amazonaws.com/${REPORT_PREFIX}/${GITHUB_RUN_ID}/index.html",
|
|
"reportName": "Allure Report"
|
|
}
|
|
EOF
|
|
|
|
cat <<EOF > ${REPORT_DIR}/environment.properties
|
|
COMMIT_SHA=${COMMIT_SHA}
|
|
EOF
|
|
|
|
ARCHIVE="${UNIQUE_KEY}-${GITHUB_RUN_ATTEMPT}-$(date +%s).tar.zst"
|
|
ZSTD_NBTHREADS=0
|
|
|
|
time tar -C ${REPORT_DIR} -cf ${ARCHIVE} --zstd .
|
|
time aws s3 mv --only-show-errors ${ARCHIVE} "s3://${BUCKET}/${RAW_PREFIX}/${ARCHIVE}"
|
|
env:
|
|
UNIQUE_KEY: ${{ inputs.unique-key }}
|
|
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
BUCKET: neon-github-public-dev
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
shell: bash -euxo pipefail {0}
|
|
run: |
|
|
rm -rf ${REPORT_DIR}
|