Skip to content

Commit

Permalink
21700/21836: Adds automated version bump for amalgam-lang-ts; turns o…
Browse files Browse the repository at this point in the history
…ff CTest concurrency; fixes WASM debug build naming issue (#275)

* After successful Amalgam releases, a PR that updates the WASM builds
with the newest version will now be automatically created in
`amalgam-lang-ts`.
* Fixes issue where CTests was running Amalgam unit tests in parallel
across different binaries, resulting in filesystem contention issues
* Fixes issue where WASM debug builds weren't uploaded to releases due
to a naming conflict
  • Loading branch information
apbassett authored Oct 17, 2024
1 parent 9fdeb9f commit 3e6bcd0
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,90 @@ jobs:
makeLatest: legacy
artifacts: amalgam-*/amalgam-*.tar.gz
artifactContentType: application/gzip

create-amalgam-lang-ts-branch:
if: inputs.build-type == 'release'
needs: ['release']
uses: "howsoai/.github/.github/workflows/create-branch.yml@main"
secrets: inherit
with:
branch: 'amalgam-${{ inputs.version }}-update'
repo: 'howsoai/amalgam-lang-ts'

update-amalgam-lang-ts:
if: inputs.build-type == 'release'
needs: ['create-amalgam-lang-ts-branch']
runs-on: ubuntu-latest
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
steps:

- uses: actions/checkout@v4
with:
token: ${{ secrets.HOWSOAI_WORKFLOW_AUTOMATION_TOKEN }}
ref: 'amalgam-${{ inputs.version }}-update'
repository: 'howsoai/amalgam-lang-ts'

- name: Clean out src/webassembly
run: |
rm -rf ./src/webassembly
mkdir -p ./src/webassembly
touch ./src/webassembly/version.json
- name: Download Release WASM
uses: actions/download-artifact@v4
with:
name: amalgam-${{ inputs.version }}-release-unknown-wasm64

- name: Extract Release WASM
run: |
tar -xvf ./amalgam-${{ inputs.version }}-wasm64.tar.gz -C ./src/webassembly
rm -rf ./amalgam-${{ inputs.version }}-wasm64.tar.gz
- name: Download Debug WASM
uses: actions/download-artifact@v4
with:
name: amalgam-${{ inputs.version }}-debug-unknown-wasm64

- name: Extract Debug WASM
run: |
# These will be located in src/webassembly/debug
mkdir -p ./src/webassembly/debug
tar -xvf ./amalgam-${{ inputs.version }}-wasm64-debug.tar.gz -C ./src/webassembly/debug
rm -rf ./amalgam-${{ inputs.version }}-wasm64.tar.gz
- name: Set version.json
run: |
cd src/webassembly && ls -l
echo '{}' | jq --arg version "${{ inputs.version }}" '.dependencies.amalgam = $version' > version.json
cat version.json
- name: Commit and push changes
run: |
git pull
if [ -n "$(git status --porcelain)" ]; then
git config user.name "howso-automation"
git config user.email "support@howso.com"
git add --all :/
git commit -m "Automated Amalgam version bump"
git push
else
echo "No changes detected in the repository."
exit 1
fi
create-amalgam-lang-ts-pr:
if: inputs.build-type == 'release'
needs: ['update-amalgam-lang-ts']
uses: "howsoai/.github/.github/workflows/create-pr.yml@main"
secrets: inherit
permissions:
contents: write
pull-requests: write
with:
branch: 'amalgam-${{ inputs.version }}-update'
repo: 'howsoai/amalgam-lang-ts'
title: 'Automated version update: Amalgam ${{ inputs.version }}'
body: 'This action was performed by a bot. Please review carefully.'
5 changes: 5 additions & 0 deletions build/cmake/create_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VERSION "${AMALGAM_VERSION_FULL}")
if(NOT IS_WASM)
# Non-WASM builds
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${OSv2}-${ARCH}")
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
# WASM debug builds
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${ARCH}-debug")
else()
# WASM release builds
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${ARCH}")
endif()
set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_INSTALL_PREFIX}/../../package")
Expand Down
2 changes: 2 additions & 0 deletions build/cmake/create_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ enable_testing()

# CTest args:
set(CMAKE_CTEST_ARGUMENTS "-j" "--schedule-random" "--output-on-failure" "--extra-verbose" "--output-log" "${CMAKE_SOURCE_DIR}/out/test/all_tests.log")
# Ensure tests are not run in parallel
set(CTEST_PARALLEL_LEVEL 1)

# Not all tests can be run on all platforms:
if(IS_WASM)
Expand Down

0 comments on commit 3e6bcd0

Please sign in to comment.