From 3e6bcd0690ac4f3368f5333f402d2aab26dee7b9 Mon Sep 17 00:00:00 2001 From: Andrew Bassett <43486400+apbassett@users.noreply.github.com> Date: Thu, 17 Oct 2024 08:12:12 -0400 Subject: [PATCH] 21700/21836: Adds automated version bump for amalgam-lang-ts; turns off 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 --- .github/workflows/build.yml | 87 ++++++++++++++++++++++++++++++++ build/cmake/create_package.cmake | 5 ++ build/cmake/create_tests.cmake | 2 + 3 files changed, 94 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c51f1e5..ba17840c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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.' diff --git a/build/cmake/create_package.cmake b/build/cmake/create_package.cmake index 00b97f9f..e2daaf67 100644 --- a/build/cmake/create_package.cmake +++ b/build/cmake/create_package.cmake @@ -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") diff --git a/build/cmake/create_tests.cmake b/build/cmake/create_tests.cmake index 59fbea33..c83e1fa5 100644 --- a/build/cmake/create_tests.cmake +++ b/build/cmake/create_tests.cmake @@ -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)