Skip to content

Branch Build (1.270) - main #270

Branch Build (1.270) - main

Branch Build (1.270) - main #270

Workflow file for this run

name: Build
run-name: "Branch Build (${{ github.run_attempt }}.${{ github.run_number }}) - ${{ github.ref_name }}"
on:
workflow_dispatch:
inputs:
amalgam-build:
description: |
(Optional) Amalgam build or version number. Defaults to the latest release.
Examples:
'6807310618',
'https://github.com/howsoai/amalgam/actions/runs/6807310618',
'57.0.1'
required: false
type: string
default: 'latest'
workflow_call:
inputs:
build-type:
required: false
type: string
optional-release-tag:
required: false
type: string
amalgam-build:
required: false
type: string
default: 'latest'
defaults:
run:
shell: bash
jobs:
metadata:
uses: howsoai/.github/.github/workflows/set-metadata.yml@main
secrets: inherit
with:
build-type: ${{ inputs.build-type }}
optional-release-tag: ${{ inputs.optional-release-tag }}
amalgam-build: ${{ inputs.amalgam-build }}
test:
name: Fuzz tests (${{ matrix.amlg-postfix }})
needs: ["metadata"]
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
amlg-postfix: ['-st-afmi', '-mt-afmi']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Download Amalgam linux-amd64
env:
GH_TOKEN: ${{ github.token }}
run: |
run_id=$(printf "%s" '${{ needs.metadata.outputs.upstream-details }}' | jq -r '."amalgam".run_id')
run_type=$(printf "%s" '${{ needs.metadata.outputs.upstream-details }}' | jq -r '."amalgam".run_type')
if [[ "$run_type" == "release" ]]; then
gh $run_type download -D amalgam/lib/linux/amd64 -R "howsoai/amalgam" -p "*linux-amd64.tar.gz" "$run_id"
else
gh $run_type download -D amalgam/lib/linux/amd64 -R "howsoai/amalgam" -p "*linux-amd64" "$run_id"
fi
# Needed because release/non-release downloads are different structure
cd amalgam/lib/linux/amd64 && if [ ! -f *.tar.gz ]; then mv */*.tar.gz ./; fi && tar -xvzf *.tar.gz
- name: Extract Amalgam binaries
run: |
cd amalgam/lib
find . -type d -name lib -exec sh -c 'mv {}/* "$(dirname {})"' \;
cd ../..
mv amalgam/lib/linux/amd64/bin/amalgam${{ matrix.amlg-postfix }} amalgam${{ matrix.amlg-postfix }}
chmod +x amalgam${{ matrix.amlg-postfix }}
- name: Print Amalgam version
run: |
./amalgam${{ matrix.amlg-postfix }} --version
- name: Run Evolver
timeout-minutes: 20
id: run
run: |
sudo apt-get update
# Install GDB
sudo apt-get install -y gdb
echo "GDB installation complete"
gdb --version
# Don't immediately fail if GDB exits with a non-zero code
set +e
# Set stack size and run (stack size adjustments cannot be done with cmake on Linux)
ulimit -s 524288
echo "Note: output is supressed due to length. See build artifacts for full logs."
echo "Running..."
# Run Evolver with GDB
# However, sent a SIGINT after 6 minutes (indicating a hanging Evolver) to get a stacktrace
TIMEOUT=360
# Run GDB in the background
gdb_output_file=$(mktemp)
if [[ "${{ matrix.amlg-postfix }}" == *"mt"* ]]; then
gdb -batch -ex run -ex "thread apply all bt" --args ./amalgam${{ matrix.amlg-postfix }} --debug-internal-memory tic_tac_toe_evolver.amlg -target-time 300 > "$gdb_output_file" 2>&1 &
GDB_PID=$!
else
gdb -batch -ex run -ex bt --args ./amalgam${{ matrix.amlg-postfix }} --debug-internal-memory tic_tac_toe_evolver.amlg -target-time 300 > "$gdb_output_file" 2>&1 &
GDB_PID=$!
fi
echo "GDB PID: $GDB_PID"
# Set up a timer to send SIGINT to GDB after the timeout
{
sleep $TIMEOUT
kill -SIGINT $GDB_PID
} &
wait $GDB_PID
gdb_output=$(cat "$gdb_output_file")
# Save output to logs.txt, uploaded later
echo "$gdb_output" >> logs.txt
# Print a reasonable amount of the logs to the console
echo "$gdb_output" | tail -n 400
# Evaluate GDB exit code and exit this workflow accordingly
if echo "$gdb_output" | tail -n 100 | grep -q "exited normally"; then
exit 0
# Else, something failed, exit 1
else
exit 1
fi
- name: Compress 'evolve' directory
if: always()
continue-on-error: true
run: |
tar -czvf evolver${{ matrix.amlg-postfix }}.tar.gz evolver logs.txt
- name: Upload 'evolve' directory
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: evolver${{ matrix.amlg-postfix }}-artifacts
path: evolver${{ matrix.amlg-postfix }}.tar.gz
generate-changelog:
if: inputs.build-type == 'release'
secrets: inherit
needs:
- metadata
uses: "howsoai/.github/.github/workflows/release-notes.yml@main"
release:
if: inputs.build-type == 'release'
needs:
- metadata
- generate-changelog
- test
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.metadata.outputs.version }}
commit: ${{ github.sha }}
name: "${{ github.event.repository.name }} ${{ needs.metadata.outputs.version }}"
artifactErrorsFailBuild: true
body: ${{ needs.generate-changelog.outputs.changelog }}
makeLatest: legacy