Skip to content

Add proof metadata timestamps and fix thread quit handling #44

Add proof metadata timestamps and fix thread quit handling

Add proof metadata timestamps and fix thread quit handling #44

name: Release Builds
on:
push:
branches:
- master
- dev
tags:
- '*'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-builds-${{ github.ref }}
cancel-in-progress: true
jobs:
release-policy:
name: Resolve release policy
runs-on: ubuntu-24.04
outputs:
artifact_branch: ${{ steps.policy.outputs.artifact_branch }}
artifact_date: ${{ steps.policy.outputs.artifact_date }}
channel: ${{ steps.policy.outputs.channel }}
move_tag: ${{ steps.policy.outputs.move_tag }}
prerelease: ${{ steps.policy.outputs.prerelease }}
publish: ${{ steps.policy.outputs.publish }}
release_tag: ${{ steps.policy.outputs.release_tag }}
release_title: ${{ steps.policy.outputs.release_title }}
steps:
- name: Check out sources
uses: actions/checkout@v4
- name: Resolve release policy
id: policy
run: |
bash ./.github/scripts/resolve-release-policy.sh
linux-x86:
name: Linux x86 build
needs: release-policy
uses: ./.github/workflows/linux-x86-build.yml
with:
artifact_branch: ${{ needs.release-policy.outputs.artifact_branch }}
artifact_date: ${{ needs.release-policy.outputs.artifact_date }}
linux-arm:
name: Linux ARM build
needs: release-policy
uses: ./.github/workflows/linux-arm-build.yml
with:
artifact_branch: ${{ needs.release-policy.outputs.artifact_branch }}
artifact_date: ${{ needs.release-policy.outputs.artifact_date }}
macos-arm:
name: macOS arm64 build
needs: release-policy
uses: ./.github/workflows/apple-silicon-build.yml
with:
artifact_branch: ${{ needs.release-policy.outputs.artifact_branch }}
artifact_date: ${{ needs.release-policy.outputs.artifact_date }}
secrets: inherit
macos-x86:
name: macOS x86_64 build
needs: release-policy
uses: ./.github/workflows/apple-x86-build.yml
with:
artifact_branch: ${{ needs.release-policy.outputs.artifact_branch }}
artifact_date: ${{ needs.release-policy.outputs.artifact_date }}
secrets: inherit
publish-release:
name: Publish release assets
runs-on: ubuntu-24.04
needs:
- release-policy
- linux-x86
- linux-arm
- macos-arm
- macos-x86
if: ${{ always() && needs.release-policy.outputs.publish == 'true' && needs.linux-x86.result == 'success' && needs.linux-arm.result == 'success' && needs.macos-arm.result == 'success' && needs.macos-x86.result == 'success' }}
permissions:
contents: write
defaults:
run:
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ARTIFACT_BRANCH: ${{ needs.release-policy.outputs.artifact_branch }}
RELEASE_ARTIFACT_DATE: ${{ needs.release-policy.outputs.artifact_date }}
RELEASE_MOVE_TAG: ${{ needs.release-policy.outputs.move_tag }}
RELEASE_PRERELEASE: ${{ needs.release-policy.outputs.prerelease }}
RELEASE_TAG: ${{ needs.release-policy.outputs.release_tag }}
RELEASE_TITLE: ${{ needs.release-policy.outputs.release_title }}
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/release-artifacts
- name: Publish release assets
run: |
artifact_root="$RUNNER_TEMP/release-artifacts"
first_publish=true
find_one_required() {
local dir=$1
local pattern=$2
local -a matches=()
if [[ ! -d $dir ]]; then
echo "Expected artifact directory $dir" >&2
exit 1
fi
while IFS= read -r path; do
matches+=("$path")
done < <(find "$dir" -type f -name "$pattern" -print | sort)
if [[ ${#matches[@]} -ne 1 ]]; then
echo "Expected exactly one file matching $pattern under $dir, found ${#matches[@]}" >&2
printf '%s\n' "${matches[@]}" >&2
exit 1
fi
printf '%s\n' "${matches[0]}"
}
find_one_optional() {
local dir=$1
local pattern=$2
local -a matches=()
if [[ ! -d $dir ]]; then
return 0
fi
while IFS= read -r path; do
matches+=("$path")
done < <(find "$dir" -type f -name "$pattern" -print | sort)
if [[ ${#matches[@]} -eq 0 ]]; then
return 0
fi
if [[ ${#matches[@]} -ne 1 ]]; then
echo "Expected at most one file matching $pattern under $dir, found ${#matches[@]}" >&2
printf '%s\n' "${matches[@]}" >&2
exit 1
fi
printf '%s\n' "${matches[0]}"
}
publish_asset() {
local file=$1
local stable_name=$2
shift 2
local -a args=(
--tag "$RELEASE_TAG"
--title "$RELEASE_TITLE"
--asset "$file"
--asset-name "$stable_name"
)
local glob
for glob in "$@"; do
args+=(--prune-asset-glob "$glob")
done
if [[ $RELEASE_PRERELEASE == 'true' ]]; then
args+=(--prerelease)
fi
if [[ $first_publish == true && $RELEASE_MOVE_TAG == 'true' ]]; then
args+=(--move-tag)
fi
bash ./.github/scripts/publish-github-release.sh "${args[@]}"
first_publish=false
}
artifact_prefix="pvs-${RELEASE_ARTIFACT_BRANCH}-${RELEASE_ARTIFACT_DATE}"
linux_x86_tgz_name="${artifact_prefix}-linux-x86_64.tgz"
linux_arm_tgz_name="${artifact_prefix}-linux-aarch64.tgz"
macos_arm_tgz_name="${artifact_prefix}-macos-arm64.tgz"
macos_x86_tgz_name="${artifact_prefix}-macos-x86_64.tgz"
macos_arm_pkg_name="${artifact_prefix}-macos-arm64.pkg"
macos_x86_pkg_name="${artifact_prefix}-macos-x86_64.pkg"
linux_x86_tgz=$(find_one_required "$artifact_root" "$linux_x86_tgz_name")
linux_arm_tgz=$(find_one_required "$artifact_root" "$linux_arm_tgz_name")
macos_arm_tgz=$(find_one_required "$artifact_root" "$macos_arm_tgz_name")
macos_x86_tgz=$(find_one_required "$artifact_root" "$macos_x86_tgz_name")
macos_arm_pkg=$(find_one_optional "$artifact_root" "$macos_arm_pkg_name")
macos_x86_pkg=$(find_one_optional "$artifact_root" "$macos_x86_pkg_name")
publish_asset "$linux_x86_tgz" "$linux_x86_tgz_name" \
'pvs-*-*-linux-x86_64.tgz' \
'pvs*-ix86_64-Linux-sbclisp.tgz' \
'pvs-linux-x86_64.tgz'
publish_asset "$linux_arm_tgz" "$linux_arm_tgz_name" \
'pvs-*-*-linux-aarch64.tgz' \
'pvs*-aarch64-Linux-sbclisp.tgz' \
'pvs-linux-aarch64.tgz'
publish_asset "$macos_arm_tgz" "$macos_arm_tgz_name" \
'pvs-*-*-macos-arm64.tgz' \
'pvs*-arm-MacOSX-sbclisp.tgz' \
'pvs-macos-arm64.tgz'
publish_asset "$macos_x86_tgz" "$macos_x86_tgz_name" \
'pvs-*-*-macos-x86_64.tgz' \
'pvs*-ix86-MacOSX-sbclisp.tgz' \
'pvs-macos-x86_64.tgz'
if [[ -n $macos_arm_pkg ]]; then
publish_asset "$macos_arm_pkg" "$macos_arm_pkg_name" \
'pvs-*-*-macos-arm64.pkg' \
'pvs*-arm-MacOSX-sbclisp.pkg' \
'pvs-macos-arm64.pkg'
fi
if [[ -n $macos_x86_pkg ]]; then
publish_asset "$macos_x86_pkg" "$macos_x86_pkg_name" \
'pvs-*-*-macos-x86_64.pkg' \
'pvs*-ix86-MacOSX-sbclisp.pkg' \
'pvs-macos-x86_64.pkg'
fi
- name: Summarize outputs
run: |
{
echo "### Release publication"
echo
echo "- GitHub release: \`$RELEASE_TAG\`"
echo "- Release channel: \`${{ needs.release-policy.outputs.channel }}\`"
echo "- Uploaded assets:"
artifact_prefix="pvs-${RELEASE_ARTIFACT_BRANCH}-${RELEASE_ARTIFACT_DATE}"
echo " - \`${artifact_prefix}-linux-aarch64.tgz\`"
echo " - \`${artifact_prefix}-linux-x86_64.tgz\`"
echo " - \`${artifact_prefix}-macos-arm64.tgz\`"
echo " - \`${artifact_prefix}-macos-x86_64.tgz\`"
if find "$RUNNER_TEMP/release-artifacts" -type f -name "${artifact_prefix}-macos-arm64.pkg" -print -quit | grep -q .; then
echo " - \`${artifact_prefix}-macos-arm64.pkg\`"
fi
if find "$RUNNER_TEMP/release-artifacts" -type f -name "${artifact_prefix}-macos-x86_64.pkg" -print -quit | grep -q .; then
echo " - \`${artifact_prefix}-macos-x86_64.pkg\`"
fi
} >> "$GITHUB_STEP_SUMMARY"