ci-package #332
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ********************************************************** | |
| # Copyright (c) 2020-2026 Google, Inc. All rights reserved. | |
| # ********************************************************** | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # | |
| # * Redistributions of source code must retain the above copyright notice, | |
| # this list of conditions and the following disclaimer. | |
| # | |
| # * Redistributions in binary form must reproduce the above copyright notice, | |
| # this list of conditions and the following disclaimer in the documentation | |
| # and/or other materials provided with the distribution. | |
| # | |
| # * Neither the name of Google, Inc. nor the names of its contributors may be | |
| # used to endorse or promote products derived from this software without | |
| # specific prior written permission. | |
| # | |
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| # ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE | |
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
| # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | |
| # DAMAGE. | |
| # Github Actions workflow for release packages. | |
| # | |
| # Each package build is a separate job. When adding a new package build job, | |
| # remember to add it to the send-failure-notification job to ensure failure | |
| # notifications are set up properly. | |
| name: ci-package | |
| on: | |
| # Our weekly cronbuild: 9pm EST on Fridays. | |
| schedule: | |
| - cron: '0 2 * * SAT' | |
| # Manual trigger using the Actions page. | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Package version number (blank for cronbuild)' | |
| required: false | |
| default: '' | |
| build: | |
| description: 'Package build number' | |
| required: true | |
| default: '0' | |
| env: | |
| PATH_TO_VERSION_FILE: "./make/version.txt" | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| ########################################################################### | |
| # Linux x86 tarball with 64-bit and 32-bit builds: | |
| linux-x86: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fetch Sources | |
| run: | | |
| git fetch --no-tags --depth=1 origin master | |
| # Include Dr. Memory in packages. | |
| # We do shallow clones and assume DrM will update its DR at least once | |
| # every 250 DR commits. | |
| git clone --depth=2 https://github.com/DynamoRIO/drmemory.git drmemory | |
| cd drmemory && git submodule update --init --recursive --depth 250 && cd .. | |
| # Install multilib for non-cross-compiling Linux build. | |
| # GA CI uses packages.microsoft.com which is missing i386 packages, and | |
| # attempts at using apt with us.archive-ubuntu.com hit dep issues: | |
| # so we manually install the i386 packages we need. | |
| - name: Create Build Environment | |
| run: | | |
| sudo apt update | |
| sudo apt-get -y install doxygen vera++ zlib1g-dev libsnappy-dev \ | |
| liblz4-dev g++-multilib libunwind-dev | |
| sudo add-apt-repository 'deb [arch=i386] http://us.archive.ubuntu.com/ubuntu focal main' | |
| apt download libunwind8:i386 libunwind-dev:i386 liblzma5:i386 \ | |
| zlib1g:i386 zlib1g-dev:i386 | |
| mkdir ../extract | |
| for i in *.deb; do dpkg-deb -x $i ../extract; done | |
| sudo rsync -av ../extract/usr/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ | |
| sudo rsync -av ../extract/lib/i386-linux-gnu/ /usr/lib/i386-linux-gnu/ | |
| sudo rsync -av ../extract/usr/include/i386-linux-gnu/ /usr/include/ | |
| # Use a newer cmake to avoid 32-bit toolchain problems (i#4830). | |
| - name: Setup newer cmake | |
| uses: jwlawson/actions-setup-cmake@v2 | |
| with: | |
| cmake-version: '3.19.7' | |
| - name: Get Version | |
| id: version | |
| # We support setting the version and build for manual builds. | |
| # We only use a non-zero build # when making multiple manual builds in one day. | |
| run: | | |
| # Read the version from version.txt file. | |
| # The file is supposed to only contain MAJOR.MINOR version numbers. We read only | |
| # the first line (bash removes the trailing '\n' through command substitution | |
| # with $(command)), but otherwise there is no other input validation or | |
| # sanitization. | |
| major_dot_minor_version_number="$(head -n 1 ${PATH_TO_VERSION_FILE})" | |
| if test -z "${{ github.event.inputs.version }}"; then | |
| export VERSION_NUMBER=$major_dot_minor_version_number.$((`git log -n 1 --format=%ct` / (60*60*24))) | |
| else | |
| export VERSION_NUMBER=${{ github.event.inputs.version }} | |
| fi | |
| if [ "${{ github.event.inputs.build }}" -ne 0 ]; then | |
| export VERSION_NUMBER="${VERSION_NUMBER}-${{ github.event.inputs.build }}" | |
| fi | |
| echo "::set-output name=version_number::${VERSION_NUMBER}" | |
| - name: Build Package | |
| working-directory: ${{ github.workspace }} | |
| run: ./suite/runsuite_wrapper.pl automated_ci | |
| env: | |
| CI_TARGET: package | |
| VERSION_NUMBER: ${{ steps.version.outputs.version_number }} | |
| # We do not update the web documentation here because a newer | |
| # Doxygen is needed but we have not yet tested our tests and | |
| # packages built on newer Ubuntu on GA CI. | |
| DEPLOY_DOCS: no | |
| DYNAMORIO_CROSS_AARCHXX_LINUX_ONLY: no | |
| CI_TRIGGER: ${{ github.event_name }} | |
| CI_BRANCH: ${{ github.ref }} | |
| - name: Upload Artifacts | |
| # This points to the latest upload-artifact v4.x.x. | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-tarball | |
| path: DynamoRIO-Linux-${{ steps.version.outputs.version_number }}.tar.gz | |
| ########################################################################### | |
| # Linux AArch64 tarball: | |
| linux-aarch64: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fetch Sources | |
| run: | | |
| git fetch --no-tags --depth=1 origin master | |
| # Include Dr. Memory in packages. | |
| git clone --depth=2 https://github.com/DynamoRIO/drmemory.git drmemory | |
| cd drmemory && git submodule update --init --recursive --depth 250 && cd .. | |
| # Install cross-compiler for cross-compiling Linux build. | |
| # Unfortunately there are no libunwind or compression cross-compile | |
| # packages so we unpack the native versions and copy their files. | |
| - name: Create Build Environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install doxygen vera++ cmake g++-aarch64-linux-gnu | |
| sudo add-apt-repository 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports focal main' | |
| apt download libunwind8:arm64 libunwind-dev:arm64 liblzma5:arm64 \ | |
| zlib1g:arm64 zlib1g-dev:arm64 libsnappy1v5:arm64 libsnappy-dev:arm64 \ | |
| liblz4-1:arm64 liblz4-dev:arm64 | |
| mkdir ../extract | |
| for i in *.deb; do dpkg-deb -x $i ../extract; done | |
| for i in include lib; do sudo rsync -av ../extract/usr/${i}/aarch64-linux-gnu/ /usr/aarch64-linux-gnu/${i}/; done | |
| sudo rsync -av ../extract/usr/include/ /usr/aarch64-linux-gnu/include/ | |
| sudo rsync -av ../extract/lib/aarch64-linux-gnu/ /usr/aarch64-linux-gnu/lib/ | |
| - name: Get Version | |
| id: version | |
| run: | | |
| # Read the version from version.txt file. | |
| # The file is supposed to only contain MAJOR.MINOR version numbers. We read only | |
| # the first line (bash removes the trailing '\n' through command substitution | |
| # with $(command)), but otherwise there is no other input validation or | |
| # sanitization. | |
| major_dot_minor_version_number="$(head -n 1 ${PATH_TO_VERSION_FILE})" | |
| if test -z "${{ github.event.inputs.version }}"; then | |
| export VERSION_NUMBER=$major_dot_minor_version_number.$((`git log -n 1 --format=%ct` / (60*60*24))) | |
| else | |
| export VERSION_NUMBER=${{ github.event.inputs.version }} | |
| fi | |
| if [ "${{ github.event.inputs.build }}" -ne 0 ]; then | |
| export VERSION_NUMBER="${VERSION_NUMBER}-${{ github.event.inputs.build }}" | |
| fi | |
| echo "::set-output name=version_number::${VERSION_NUMBER}" | |
| - name: Build Package | |
| working-directory: ${{ github.workspace }} | |
| run: ./suite/runsuite_wrapper.pl automated_ci 64_only | |
| env: | |
| CI_TARGET: package | |
| VERSION_NUMBER: ${{ steps.version.outputs.version_number }} | |
| DYNAMORIO_CROSS_AARCHXX_LINUX_ONLY: yes | |
| CI_TRIGGER: ${{ github.event_name }} | |
| CI_BRANCH: ${{ github.ref }} | |
| - name: Upload AArch64 | |
| # This points to the latest upload-artifact v4.x.x. | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: aarch64-tarball | |
| path: DynamoRIO-AArch64-Linux-${{ steps.version.outputs.version_number }}.tar.gz | |
| ########################################################################### | |
| # Linux ARM tarball (package.cmake does not support same job as AArch64): | |
| linux-arm: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fetch Sources | |
| run: | | |
| git fetch --no-tags --depth=1 origin master | |
| # Include Dr. Memory in packages. | |
| git clone --depth=2 https://github.com/DynamoRIO/drmemory.git drmemory | |
| cd drmemory && git submodule update --init --recursive --depth 250 && cd .. | |
| # Install cross-compiler for cross-compiling Linux build. | |
| # Unfortunately there are no libunwind or compression cross-compile | |
| # packages so we unpack the native versions and copy their files. | |
| - name: Create Build Environment | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install doxygen vera++ cmake g++-arm-linux-gnueabihf | |
| sudo add-apt-repository 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports focal main' | |
| apt download libunwind8:armhf libunwind-dev:armhf liblzma5:armhf \ | |
| zlib1g:armhf zlib1g-dev:armhf libsnappy1v5:armhf libsnappy-dev:armhf \ | |
| liblz4-1:armhf liblz4-dev:armhf | |
| mkdir ../extract | |
| for i in *.deb; do dpkg-deb -x $i ../extract; done | |
| for i in include lib; do sudo rsync -av ../extract/usr/${i}/arm-linux-gnueabihf/ /usr/arm-linux-gnueabihf/${i}/; done | |
| sudo rsync -av ../extract/usr/include/ /usr/arm-linux-gnueabihf/include/ | |
| sudo rsync -av ../extract/lib/arm-linux-gnueabihf/ /usr/arm-linux-gnueabihf/lib/ | |
| - name: Get Version | |
| id: version | |
| run: | | |
| # Read the version from version.txt file. | |
| # The file is supposed to only contain MAJOR.MINOR version numbers. We read only | |
| # the first line (bash removes the trailing '\n' through command substitution | |
| # with $(command)), but otherwise there is no other input validation or | |
| # sanitization. | |
| major_dot_minor_version_number="$(head -n 1 ${PATH_TO_VERSION_FILE})" | |
| if test -z "${{ github.event.inputs.version }}"; then | |
| export VERSION_NUMBER=$major_dot_minor_version_number.$((`git log -n 1 --format=%ct` / (60*60*24))) | |
| else | |
| export VERSION_NUMBER=${{ github.event.inputs.version }} | |
| fi | |
| if [ "${{ github.event.inputs.build }}" -ne 0 ]; then | |
| export VERSION_NUMBER="${VERSION_NUMBER}-${{ github.event.inputs.build }}" | |
| fi | |
| echo "::set-output name=version_number::${VERSION_NUMBER}" | |
| - name: Build Package | |
| working-directory: ${{ github.workspace }} | |
| run: ./suite/runsuite_wrapper.pl automated_ci 32_only | |
| env: | |
| CI_TARGET: package | |
| VERSION_NUMBER: ${{ steps.version.outputs.version_number }} | |
| DYNAMORIO_CROSS_AARCHXX_LINUX_ONLY: yes | |
| CI_TRIGGER: ${{ github.event_name }} | |
| CI_BRANCH: ${{ github.ref }} | |
| - name: Upload ARM | |
| # This points to the latest upload-artifact v4.x.x. | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: arm-tarball | |
| path: DynamoRIO-ARM-Linux-EABIHF-${{ steps.version.outputs.version_number }}.tar.gz | |
| ########################################################################### | |
| # Android ARM tarball: Removed due to lack of support for recent Android. | |
| # TODO i#2154,i#3683: Add an Android package back when it is better supported, | |
| # whether AArch64 or AArch32. | |
| ########################################################################### | |
| # Windows .zip with 32-bit and 64-bit x86 builds: | |
| windows: | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Fetch Sources | |
| run: | | |
| git fetch --no-tags --depth=1 origin master | |
| # Include Dr. Memory in packages. | |
| git clone --depth=2 https://github.com/DynamoRIO/drmemory.git drmemory | |
| cd drmemory && git submodule update --init --recursive --depth 250 && cd .. | |
| # Install Doxygen. | |
| - uses: ssciwr/doxygen-install@v1 | |
| with: | |
| # TODO i#7796: Fix failures seen on Doxygen 1.16.1. | |
| version: "1.14.0" | |
| - name: Download Packages | |
| shell: powershell | |
| run: | | |
| md c:\projects\install | |
| (New-Object System.Net.WebClient).DownloadFile("https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip", "c:\projects\install\ninja.zip") | |
| - name: Get Version | |
| id: version | |
| run: | | |
| # Read the version from version.txt file. | |
| # The file is supposed to only contain MAJOR.MINOR version numbers. We read only | |
| # the first line (bash removes the trailing '\n' through command substitution | |
| # with $(command)), but otherwise there is no other input validation or | |
| # sanitization. | |
| major_dot_minor_version_number="$(head -n 1 ${PATH_TO_VERSION_FILE})" | |
| if test -z "${{ github.event.inputs.version }}"; then | |
| export VERSION_NUMBER=$major_dot_minor_version_number.$((`git log -n 1 --format=%ct` / (60*60*24))) | |
| else | |
| export VERSION_NUMBER=${{ github.event.inputs.version }} | |
| fi | |
| if [ "${{ github.event.inputs.build }}" -ne 0 ]; then | |
| export VERSION_NUMBER="${VERSION_NUMBER}-${{ github.event.inputs.build }}" | |
| fi | |
| echo "::set-output name=version_number::${VERSION_NUMBER}" | |
| - name: Build Package | |
| working-directory: ${{ github.workspace }} | |
| shell: cmd | |
| # We need to set up WiX for Dr. Memory. | |
| run: | | |
| echo ------ Setting up paths ------ | |
| 7z x c:\projects\install\ninja.zip -oc:\projects\install\ninja > nul | |
| set PATH=c:\projects\install\ninja;%PATH% | |
| dir "c:\Program Files (x86)\WiX Toolset"* | |
| set PATH=C:\Program Files (x86)\WiX Toolset v3.14\bin;%PATH% | |
| call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars32.bat" | |
| echo ------ Running suite ------ | |
| echo PATH is "%PATH%" | |
| echo Running in directory "%CD%" | |
| perl suite/runsuite_wrapper.pl automated_ci use_ninja | |
| env: | |
| CI_TARGET: package | |
| VERSION_NUMBER: ${{ steps.version.outputs.version_number }} | |
| CI_TRIGGER: ${{ github.event_name }} | |
| CI_BRANCH: ${{ github.ref }} | |
| - name: Upload Artifacts | |
| # This points to the latest upload-artifact v4.x.x. | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: DynamoRIO-Windows-${{ steps.version.outputs.version_number }}.zip | |
| ########################################################################### | |
| # Create release and populate with files. | |
| # We can't have each OS job create the release because only the first | |
| # succeeds and the others fail: there is no check in the create-release | |
| # action to use an existing release if it already exists. | |
| # Thus, our strategy is to share files from the build jobs with this | |
| # single release job via artifacts. | |
| create_release: | |
| needs: [linux-x86, linux-aarch64, linux-arm, windows] | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| # We need a checkout to run git log for the version. | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Get Version | |
| id: version | |
| run: | | |
| # Read the version from version.txt file. | |
| # The file is supposed to only contain MAJOR.MINOR version numbers. We read only | |
| # the first line (bash removes the trailing '\n' through command substitution | |
| # with $(command)), but otherwise there is no other input validation or | |
| # sanitization. | |
| major_dot_minor_version_number="$(head -n 1 ${PATH_TO_VERSION_FILE})" | |
| if test -z "${{ github.event.inputs.version }}"; then | |
| export VERSION_NUMBER="$major_dot_minor_version_number.$((`git log -n 1 --format=%ct` / (60*60*24)))" | |
| export PREFIX="cronbuild-" | |
| else | |
| export VERSION_NUMBER=${{ github.event.inputs.version }} | |
| export PREFIX="release_" | |
| fi | |
| if [ "${{ github.event.inputs.build }}" -ne 0 ]; then | |
| export VERSION_NUMBER="${VERSION_NUMBER}-${{ github.event.inputs.build }}" | |
| fi | |
| echo "::set-output name=version_number::${VERSION_NUMBER}" | |
| echo "::set-output name=version_string::${PREFIX}${VERSION_NUMBER}" | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.version_string }} | |
| release_name: ${{ steps.version.outputs.version_string }} | |
| body: | | |
| Auto-generated periodic build. | |
| draft: false | |
| prerelease: false | |
| - name: Download Linux | |
| # This points to the latest download-artifact v4.x.x. | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-tarball | |
| - name: Upload Linux | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| # This action doesn't seem to support a glob so we need the exact name. | |
| asset_path: DynamoRIO-Linux-${{ steps.version.outputs.version_number }}.tar.gz | |
| asset_name: DynamoRIO-Linux-${{ steps.version.outputs.version_number }}.tar.gz | |
| asset_content_type: application/x-gzip | |
| - name: Download AArch64 | |
| # This points to the latest download-artifact v4.x.x. | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: aarch64-tarball | |
| - name: Upload AArch64 | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| # This action doesn't seem to support a glob so we need the exact name. | |
| asset_path: DynamoRIO-AArch64-Linux-${{ steps.version.outputs.version_number }}.tar.gz | |
| asset_name: DynamoRIO-AArch64-Linux-${{ steps.version.outputs.version_number }}.tar.gz | |
| asset_content_type: application/x-gzip | |
| - name: Download ARM | |
| # This points to the latest download-artifact v4.x.x. | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: arm-tarball | |
| - name: Upload ARM | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| # This action doesn't seem to support a glob so we need the exact name. | |
| asset_path: DynamoRIO-ARM-Linux-EABIHF-${{ steps.version.outputs.version_number }}.tar.gz | |
| asset_name: DynamoRIO-ARM-Linux-EABIHF-${{ steps.version.outputs.version_number }}.tar.gz | |
| asset_content_type: application/x-gzip | |
| - name: Download Windows | |
| # This points to the latest download-artifact v4.x.x. | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-zip | |
| - name: Upload Windows | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| # This action doesn't seem to support a glob so we need the exact name. | |
| asset_path: DynamoRIO-Windows-${{ steps.version.outputs.version_number }}.zip | |
| asset_name: DynamoRIO-Windows-${{ steps.version.outputs.version_number }}.zip | |
| asset_content_type: application/zip | |
| send-failure-notification: | |
| uses: ./.github/workflows/failure-notification.yml | |
| needs: [create_release, windows, linux-arm, linux-aarch64, linux-x86] | |
| # By default, a failure in a job skips the jobs that need it. The | |
| # following expression ensures that failure-notification.yml is | |
| # always invoked. | |
| if: ${{ always() }} | |
| with: | |
| test_suite_status: ${{ format('{0} {1} | {2} {3} | {4} {5} | {6} {7} | {8} {9}', | |
| 'create_release', needs.create_release.result, | |
| 'windows', needs.windows.result, | |
| 'linux-arm', needs.linux-arm.result, | |
| 'linux-aarch64', needs.linux-aarch64.result, | |
| 'linux-x86', needs.linux-x86.result) }} | |
| test_suite_results_only: ${{ join(needs.*.result, ',') }} | |
| secrets: inherit |