From 6787a5bbef0e69aacadc9182f773ffc8a6d12127 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 18 May 2023 13:07:19 -0500 Subject: Hdf5 1 12 dt action (#2965) --- .github/workflows/cmake-ctest.yml | 217 ++++++++++++++++++++++++++++++++++++++ .github/workflows/daily-build.yml | 28 +++++ .github/workflows/tarball.yml | 105 ++++++++++++++++++ config/toolchain/aarch64.cmake | 8 +- 4 files changed, 354 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/cmake-ctest.yml create mode 100644 .github/workflows/daily-build.yml create mode 100644 .github/workflows/tarball.yml diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml new file mode 100644 index 0000000..365039e --- /dev/null +++ b/.github/workflows/cmake-ctest.yml @@ -0,0 +1,217 @@ +name: hdf5 1.12 ctest runs + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel +jobs: + build_and_test_win: + # Windows w/ MSVC + CMake + # + name: "Windows MSVC CTest" + runs-on: windows-latest + steps: + - name: Install Dependencies (Windows) + run: choco install ninja + + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.12.1 + + - name: Set file base name (Windows) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + shell: bash + + # Get files created by release script + - name: Get zip-tarball (Windows) + uses: actions/download-artifact@v3 + with: + name: zip-tarball + path: ${{ github.workspace }} + + - name: using powershell + shell: pwsh + run: Get-Location + + - name: List files for the space (Windows) + run: | + Get-ChildItem -Path ${{ github.workspace }} + Get-ChildItem -Path ${{ runner.workspace }} + shell: pwsh + + - name: Uncompress source (Windows) + working-directory: ${{ github.workspace }} + run: 7z x ${{ steps.set-file-base.outputs.FILE_BASE }}.zip + shell: bash + + - name: Run ctest (Windows) + run: | + cd "${{ runner.workspace }}/hdf5/hdfsrc" + cmake --workflow --preset=ci-StdShar-MSVC --fresh + shell: bash + + - name: Publish binary (Windows) + id: publish-ctest-binary + run: | + mkdir "${{ runner.workspace }}/build" + mkdir "${{ runner.workspace }}/build/hdf5" + Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/COPYING -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/hdfsrc/README.md -Destination ${{ runner.workspace }}/build/hdf5/ + Copy-Item -Path ${{ runner.workspace }}/hdf5/build/ci-StdShar-MSVC/* -Destination ${{ runner.workspace }}/build/hdf5/ -Include *.zip + cd "${{ runner.workspace }}/build" + 7z a -tzip ${{ steps.set-file-base.outputs.FILE_BASE }}-win_vs2022.zip hdf5 + shell: pwsh + + - name: List files in the space (Windows) + run: | + Get-ChildItem -Path ${{ github.workspace }} + Get-ChildItem -Path ${{ runner.workspace }} + shell: pwsh + + # Save files created by ctest script + - name: Save published binary (Windows) + uses: actions/upload-artifact@v3 + with: + name: zip-vs2022-binary + path: ${{ runner.workspace }}/build/${{ steps.set-file-base.outputs.FILE_BASE }}-win_vs2022.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + build_and_test_linux: + # Linux (Ubuntu) w/ gcc + CMake + # + name: "Ubuntu gcc CMake" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux) + run: sudo apt-get install ninja-build + + - name: Set file base name (Linux) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (Linux) + uses: actions/download-artifact@v3 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (Linux) + run: | + ls ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (Linux) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + - name: Run ctest (Linux) + run: | + cd "${{ runner.workspace }}/hdf5/hdfsrc" + cmake --workflow --preset=ci-StdShar-GNUC --fresh + shell: bash + + - name: Publish binary (Linux) + id: publish-ctest-binary + run: | + mkdir "${{ runner.workspace }}/build" + mkdir "${{ runner.workspace }}/build/hdf5" + cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/README.md ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/ci-StdShar-GNUC/*.tar.gz ${{ runner.workspace }}/build/hdf5 + cd "${{ runner.workspace }}/build" + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204.tar.gz hdf5 + shell: bash + + - name: List files in the space (Linux) + run: | + ls ${{ github.workspace }} + ls ${{ runner.workspace }} + + # Save files created by ctest script + - name: Save published binary (Linux) + uses: actions/upload-artifact@v3 + with: + name: tgz-ubuntu-2204-binary + path: ${{ runner.workspace }}/build/${{ steps.set-file-base.outputs.FILE_BASE }}-ubuntu-2204.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + build_and_test_mac: + # MacOS w/ Clang + CMake + # + name: "MacOS Clang CMake" + runs-on: macos-11 + steps: + - name: Install Dependencies (MacOS) + run: brew install ninja + + - name: Set file base name (MacOS) + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + # Get files created by release script + - name: Get tgz-tarball (MacOS) + uses: actions/download-artifact@v3 + with: + name: tgz-tarball + path: ${{ github.workspace }} + + - name: List files for the space (MacOS) + run: | + ls ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Uncompress source (MacOS) + run: tar -zxvf ${{ github.workspace }}/${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + + # symlinks the compiler executables to a common location + - name: Setup GNU Fortran + uses: modflowpy/install-gfortran-action@v1 + + - name: Run ctest (MacOS) + id: run-ctest + run: | + cd "${{ runner.workspace }}/hdf5/hdfsrc" + cmake --workflow --preset=ci-StdShar-Clang --fresh + shell: bash + + - name: Publish binary (MacOS) + id: publish-ctest-binary + run: | + mkdir "${{ runner.workspace }}/build" + mkdir "${{ runner.workspace }}/build/hdf5" + cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/COPYING_LBNL_HDF5 ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/hdfsrc/README.md ${{ runner.workspace }}/build/hdf5 + cp ${{ runner.workspace }}/hdf5/build/ci-StdShar-Clang/*.tar.gz ${{ runner.workspace }}/build/hdf5 + cd "${{ runner.workspace }}/build" + tar -zcvf ${{ steps.set-file-base.outputs.FILE_BASE }}-osx12.tar.gz hdf5 + shell: bash + + - name: List files in the space (MacOS) + run: | + ls ${{ github.workspace }} + ls ${{ runner.workspace }} + + # Save files created by ctest script + - name: Save published binary (MacOS) + uses: actions/upload-artifact@v3 + with: + name: tgz-osx12-binary + path: ${{ runner.workspace }}/build/${{ steps.set-file-base.outputs.FILE_BASE }}-osx12.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml new file mode 100644 index 0000000..63b7dab --- /dev/null +++ b/.github/workflows/daily-build.yml @@ -0,0 +1,28 @@ +name: hdf5 1.12 daily build + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_dispatch: + schedule: + - cron: "8 0 * * *" + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel. +jobs: + call-workflow-tarball: + uses: ./.github/workflows/tarball.yml + + call-workflow-ctest: + needs: call-workflow-tarball + uses: ./.github/workflows/cmake-ctest.yml + with: + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + + call-workflow-release: + needs: call-workflow-ctest + uses: ./.github/workflows/release.yml + with: + file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml new file mode 100644 index 0000000..62fd270 --- /dev/null +++ b/.github/workflows/tarball.yml @@ -0,0 +1,105 @@ +name: hdf5 1.12 tarball + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + outputs: + has_changes: + description: "Whether there were changes the previous day" + value: ${{ jobs.check_commits.outputs.has_changes }} + file_base: + description: "The common base name of the source tarballs" + value: ${{ jobs.create_tarball.outputs.file_base }} + +# A workflow run is made up of one or more jobs that can run sequentially or +# in parallel +jobs: + check_commits: + name: Check for recent commits + runs-on: ubuntu-latest + outputs: + has_changes: ${{ steps.check-new-commits.outputs.has-new-commits }} + branch_ref: ${{ steps.get-branch-name.outputs.BRANCH_REF }} + branch_sha: ${{ steps.get-branch-sha.outputs.BRANCH_SHA }} + steps: + - name: Get branch name + id: get-branch-name + env: + GITHUB_REF: ${{ github.ref }} + GITHUB_REF_NAME: ${{ github.ref_name }} + GITHUB_HEAD_REF: ${{ github.head_ref }} + #run: echo "${{ env.GITHUB_REF_NAME }} | grep -P '[0-9]+/merge' &> /dev/null && BRANCH_REF=${{ env.GITHUB_HEAD_REF }} || BRANCH_REF=${{ env.GITHUB_REF_NAME }}" >> $GITHUB_OUTPUT + run: echo "BRANCH_REF=${{ env.GITHUB_HEAD_REF || env.GITHUB_REF_NAME }}" >> $GITHUB_OUTPUT + + - name: Get branch sha + id: get-branch-sha + env: + GITHUB_SHA: ${{ github.sha }} + GITHUB_WF_SHA: ${{ github.workflow_sha }} + run: | + SHORT_SHA=$(echo "${{ env.GITHUB_WF_SHA }}" | cut -c1-7) + echo "BRANCH_SHA=$SHORT_SHA" >> $GITHUB_OUTPUT + + - name: Check for changed source + id: check-new-commits + uses: adriangl/check-new-commits-action@v1 + with: + seconds: 86400 # One day in seconds + branch: '${{ steps.get-branch-name.outputs.branch_ref }}' + + - run: echo "You have ${{ steps.check-new-commits.outputs.new-commits-number }} new commit(s) in ${{ steps.get-branch-name.outputs.BRANCH_REF }} ✅!" + if: ${{ steps.check-new-commits.outputs.has-new-commits == 'true' }} + + - run: echo "Short commit sha is ${{ steps.get-branch-sha.outputs.BRANCH_SHA }}!" + + create_tarball: + name: Create a source tarball + runs-on: ubuntu-latest + needs: check_commits + if: ${{ needs.check_commits.outputs.has_changes == 'true' }} + outputs: + file_base: ${{ steps.set-file-base.outputs.FILE_BASE }} + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Get Sources + uses: actions/checkout@v3 + with: + path: hdfsrc + + - name: Install Autotools Dependencies (Linux, serial) + run: | + sudo apt update + sudo apt install automake autoconf libtool libtool-bin gzip dos2unix + + - name: Set file base name + id: set-file-base + run: | + FILE_NAME_BASE=$(echo "hdf5-${{ needs.check_commits.outputs.branch_ref }}-${{ needs.check_commits.outputs.branch_sha }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + - name: Run release script + id: run-release-script + run: | + cd "$GITHUB_WORKSPACE/hdfsrc" + bin/bbrelease -d $GITHUB_WORKSPACE --branch ${{ needs.check_commits.outputs.branch_ref }} --revision gzip zip + shell: bash + + - name: List files in the repository + run: | + ls ${{ github.workspace }} + ls $GITHUB_WORKSPACE + + # Save files created by release script + - name: Save tgz-tarball + uses: actions/upload-artifact@v3 + with: + name: tgz-tarball + path: ${{ steps.set-file-base.outputs.FILE_BASE }}.tar.gz + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` + + - name: Save zip-tarball + uses: actions/upload-artifact@v3 + with: + name: zip-tarball + path: ${{ steps.set-file-base.outputs.FILE_BASE }}.zip + if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` diff --git a/config/toolchain/aarch64.cmake b/config/toolchain/aarch64.cmake index 6996833..fd216a9 100644 --- a/config/toolchain/aarch64.cmake +++ b/config/toolchain/aarch64.cmake @@ -1,7 +1,7 @@ set(TOOLCHAIN_PREFIX aarch64-linux-gnu) -set(ANDROID_NDK /opt/android-ndk-linux) -set (CMAKE_SYSTEM_NAME Android) -set (CMAKE_ANDROID_ARCH_ABI x86_64) +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR aarch64) +#set (CMAKE_ANDROID_ARCH_ABI x86_64) #set (CMAKE_ANDROID_STANDALONE_TOOLCHAIN ${ANDROID_NDK}/build/cmake/android.toolchain.cmake) set (CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set (CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) @@ -12,7 +12,7 @@ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) -set (CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64) +set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-aarch64-static;-L;/usr/aarch64-linux-gnu/" CACHE FILEPATH "Path to the emulator for the target system.") include_directories(/usr/${TOOLCHAIN_PREFIX}/include) -- cgit v0.12