diff --git a/.github/install-dependencies.sh b/.github/install-dependencies.sh new file mode 100755 index 0000000..3b35497 --- /dev/null +++ b/.github/install-dependencies.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +[ $# -ne 1 ] && exit 1 +runner=$1 + +case "$runner" in + 'ubuntu-latest') + python -m pip install meson ninja + ;; + 'macos-latest') + brew install meson ninja tree + # install fortran compiler: + brew install gcc + brew unlink gcc + brew link gcc + ;; + *) + exit 1 + ;; +esac diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09a1736..d087b7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ defaults: jobs: - build_cmake: - name: CMake build + build: + name: Build strategy: fail-fast: false matrix: @@ -25,42 +25,28 @@ jobs: runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 - - name: build + - name: install dependencies + run: .github/install-dependencies.sh ${{ matrix.runner }} + - name: meson setup run: | - cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install - cmake --build build -j4 - cmake --install build - - run: brew install tree - if: ${{ matrix.runner == 'macos-latest' }} + meson setup build . \ + --prefix=`pwd`/install \ + -D install_examples=true \ + -D test_file=`pwd`/test_data.hipo \ + -D test_fortran=true + - run: meson install + working-directory: build + - name: dump build log + if: always() + run: cat build/meson-logs/meson-log.txt - run: tree install - - build_make: - name: Makefile build - strategy: - fail-fast: false - matrix: - runner: [ ubuntu-latest, macos-latest ] - runs-on: ${{ matrix.runner }} - steps: - - uses: actions/checkout@v4 - with: - path: hipo_src - submodules: recursive # FIXME: need `lz4` submoudle for Makefile, whereas `cmake` does not - - name: build - working-directory: hipo_src - run: | - make -j4 - make -j4 -C examples - - run: brew install tree - if: ${{ matrix.runner == 'macos-latest' }} - - run: tree hipo_src - name: tar - run: tar cavf hipo_src{.tar.zst,} + run: tar cavf build{.tar.zst,} - uses: actions/upload-artifact@v4 with: - name: build_make_${{ matrix.runner }} + name: build-${{ matrix.runner }} retention-days: 5 - path: hipo_src.tar.zst + path: build.tar.zst download_test_data: name: Download test data @@ -82,35 +68,28 @@ jobs: tar xvf validation_files_${{ env.type }}.tar.zst mv -v $(find validation_files -type f -name "*.hipo" | head -n1) test_data.hipo - examples: - name: Run examples - needs: [ download_test_data, build_make ] + test: + name: Test + needs: [ download_test_data, build ] strategy: fail-fast: false matrix: runner: [ ubuntu-latest, macos-latest ] runs-on: ${{ matrix.runner }} steps: - - uses: actions/download-artifact@v4 + - uses: actions/checkout@v4 + - name: install dependencies + run: .github/install-dependencies.sh ${{ matrix.runner }} + - name: download build + uses: actions/download-artifact@v4 with: - name: build_make_${{ matrix.runner }} + name: build-${{ matrix.runner }} - name: untar artifacts - run: | - ls *.tar.zst | xargs -I{} tar xvf {} - rm *.tar.zst - mv -v hipo_src/* ./ - rm -rf hipo_src + run: ls *.tar.zst | xargs -I{} tar xvf {} - name: get test data uses: actions/cache/restore@v4 with: key: test_data path: test_data.hipo - - run: examples/writeFile.exe - - run: examples/readFile.exe example_output.hipo - - run: examples/readFileTags.exe - - run: examples/showFile.exe example_output.hipo event::particle - - run: examples/readJson.exe test_data.hipo - - run: examples/tupleFile.exe - - run: examples/writeUserHeader.exe - - run: examples/bankRowList.exe test_data.hipo - - run: examples/histograms.exe test_data.hipo + - run: meson test + working-directory: build diff --git a/hipo4/meson.build b/hipo4/meson.build index 3fe8e9d..25e4f25 100644 --- a/hipo4/meson.build +++ b/hipo4/meson.build @@ -46,6 +46,7 @@ hipo_lib = library( '-Wno-unused-but-set-variable', '-Wno-misleading-indentation', '-Wno-format', + '-Wno-stringop-overflow', ], install: true ) diff --git a/meson.options b/meson.options index 5bc338c..ed2eb5d 100644 --- a/meson.options +++ b/meson.options @@ -1,4 +1,4 @@ option('dataframes', type: 'boolean', value: true, description: 'install HIPO dataframes extension') option('install_examples', type: 'boolean', value: false, description: 'install examples') -option('test_file', type: 'string', value: '', description: 'sample HIPO file to use for certain tests; if unspecified, those tests will not run') +option('test_file', type: 'string', value: '', description: 'sample HIPO file to use for certain tests; if unspecified, those tests will not run; must be an absolute path') option('test_fortran', type: 'boolean', value: false, description: 'test Fortran example; you must have a Fortran compiler, and "test_file" option must be set')