Skip to content

Commit

Permalink
Create new engine release workflow (#1950)
Browse files Browse the repository at this point in the history
- Uses the new v2 build to create releases
- Builds both regular and tracy builds as part of the same release
- Is able to create and push a new annoted release tag

* Change release auto tag and archive naming scheme
  • Loading branch information
p2004a authored Feb 17, 2025
1 parent 8e453d6 commit 8e9cd08
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bar-cdn-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ jobs:
release_id: context.payload.release?.id ?? context.payload.inputs.releaseId
});
const engines = rel.data.assets
.filter((a) => a.name.endsWith('64-minimal-portable.7z'))
.filter((a) => /amd64-(linux|windows)\.7z$/.test(a.name))
.map((a) => a.browser_download_url)
.sort();
if (engines.length != 2 || !/linux/.test(engines[0]) || !/windows/.test(engines[1])) {
if (engines.length != 2) {
throw new Error("Not found engine archives!");
}
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/engine-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,28 @@ on:
workflow_dispatch:
inputs:
recache:
description: "Recache ccache build objects"
description: 'Recache ccache build objects'
type: boolean
default: false
cmake-options:
description: 'Custom CMake options for build'
type: string
split-debug-info:
description: 'Split debug info'
type: boolean
default: true
workflow_call:
inputs:
cmake-options:
description: 'Custom CMake options for build'
type: string
split-debug-info:
description: 'Split debug info'
type: boolean
default: true
package-suffix:
description: 'Custom suffix for the package name'
type: string
pull_request:
paths-ignore:
- 'doc/**'
Expand Down Expand Up @@ -94,8 +113,8 @@ jobs:
BAZEL_REMOTE_S3_SECRET_ACCESS_KEY: ${{ github.event_name == 'pull_request' && vars.R2_RO_ACCESS_KEY_SECRET || secrets.R2_ACCESS_KEY_SECRET }}
with:
run: |
if ! sha256sum --status -c <<< "8679a76074b1408a95d2b3ec0f5b1a6d0c20500cfc24c3a87ef08c1b60200f8c tools/bazel-remote"; then
curl -L https://github.com/buchgr/bazel-remote/releases/download/v2.4.4/bazel-remote-2.4.4-linux-x86_64 -o bazel-remote
if ! sha256sum --status -c <<< "0e3ccc67bced00bc783ee395160092c107a4699e06586a68dcd53fcfa7d8063e tools/bazel-remote"; then
curl -L https://github.com/buchgr/bazel-remote/releases/download/v2.5.0/bazel-remote-2.5.0-linux-x86_64 -o bazel-remote
chmod +x bazel-remote
mv bazel-remote tools/bazel-remote
fi
Expand All @@ -121,6 +140,7 @@ jobs:
# of health checking.
wait-on: |
http-get://127.0.0.1:8085/cas/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
wait-for: 3m
- name: Pull builder image
run: docker pull ghcr.io/${{ github.repository_owner }}/recoil-build-${{ matrix.system }}:latest
- name: Build
Expand All @@ -141,18 +161,18 @@ jobs:
bash <<EOF
set -e
cd /build/src/docker-build-v2/scripts
./configure.sh
./configure.sh ${{ inputs.cmake-options || '' }}
./compile.sh
./split-debug-info.sh
./package.sh
${{ inputs.split-debug-info == false && 'echo "Not splitting debug info."' || './split-debug-info.sh' }}
./package.sh ${{ inputs.package-suffix }}
EOF
# TODO: Switch to publickly accessible storage
- name: Save
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
id: save-artifact
with:
name: artifacts-${{ matrix.system }}
name: engine-artifacts-${{ matrix.system }}-${{ inputs.package-suffix }}
path: ./artifacts
compression-level: 0 # already compressed
- name: Unmount bazel remote overlay
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Create Engine Release v2
on:
workflow_dispatch:
inputs:
new-tag:
description: 'Set to create a new annotated release tag, e.g. 2025.01.10.'
type: string
jobs:
get-tag:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
tag_name: ${{ steps.release-tag.outputs.tag_name }}
steps:
- uses: actions/checkout@v4
with:
filter: tree:0
fetch-depth: 0
- name: Create new annotated tag
if: inputs.new-tag != ''
env:
NEW_TAG: ${{ inputs.new-tag }}
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git tag -a -m "Version $NEW_TAG" "$NEW_TAG"
git push origin tag "$NEW_TAG"
- name: Get release tag
id: release-tag
run: |
if git describe --exact-match HEAD >/dev/null 2>&1; then
echo "tag_name=$(git describe --exact-match HEAD)" >> "$GITHUB_OUTPUT"
else
echo "tag_name=recoil{$(git rev-parse --abbrev-ref HEAD)}$(git describe --abbrev=7)" >> "$GITHUB_OUTPUT"
fi
build-engine:
needs: get-tag
uses: ./.github/workflows/engine-build.yml
with:
cmake-options: '-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g -DNDEBUG" -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g -DNDEBUG"'
secrets: inherit
build-engine-tracy:
needs: get-tag
uses: ./.github/workflows/engine-build.yml
with:
cmake-options: '-DTRACY_ENABLE=ON -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g1 -DNDEBUG -fno-omit-frame-pointer" -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g1 -DNDEBUG -fno-omit-frame-pointer"'
package-suffix: '-tracy'
split-debug-info: false
secrets: inherit
create-release:
runs-on: ubuntu-latest
needs: [build-engine, build-engine-tracy, get-tag]
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: engine-artifacts-*
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
draft: true
tag_name: ${{ needs.get-tag.outputs.tag_name }}
19 changes: 12 additions & 7 deletions docker-build-v2/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,25 @@ set -e -u -o pipefail

cd /build/src

branch=$(git rev-parse --abbrev-ref HEAD)
tag_name="{$branch}$(git describe --abbrev=7)_$ENGINE_PLATFORM"
bin_name=spring_bar_$tag_name-minimal-portable.7z
dbg_name=spring_bar_$tag_name-minimal-symbols.tar.zst
package_suffix="${1-}"
base_name="recoil_$(git describe --abbrev=7)_${ENGINE_PLATFORM}"
bin_name="${base_name}${package_suffix}.7z"
dbg_name="${base_name}-dbgsym${package_suffix}.tar.zst"

cd /build/out/install

# Compute md5 hashes of all files in archive. We additionally gzip it as gzip adds
# checksum to the list itself. To validate just `zcat files.md5.gz | md5sum -c -`
find . -type f ! -name '*.dbg' ! -name files.md5.gz -exec md5sum {} \; | gzip > files.md5.gz

rm -f /build/artifacts/$bin_name /build/artifacts/$dbg_name
rm -f "/build/artifacts/$bin_name" "/build/artifacts/$dbg_name"

# Trigger compression of main binaries and debug info concurrently
7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on /build/artifacts/$bin_name ./* -xr\!*.dbg &
tar cvf - $(find ./ -name '*.dbg') | zstd -T0 > /build/artifacts/$dbg_name &
7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on "/build/artifacts/$bin_name" ./* -xr\!*.dbg &

DEBUG_SYMBOLS=$(find ./ -name '*.dbg')
if [[ -n $DEBUG_SYMBOLS ]]; then
tar cvf - $DEBUG_SYMBOLS | zstd -T0 > "/build/artifacts/$dbg_name" &
fi

wait

0 comments on commit 8e9cd08

Please sign in to comment.