Skip to content

Commit

Permalink
ci: build with meson
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Aug 20, 2024
1 parent 100ca69 commit 77ae542
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 52 deletions.
20 changes: 20 additions & 0 deletions .github/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -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
81 changes: 30 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,37 @@ defaults:

jobs:

build_cmake:
name: CMake build
build:
name: Build
strategy:
fail-fast: false
matrix:
runner: [ ubuntu-latest, macos-latest ]
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
Expand All @@ -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
1 change: 1 addition & 0 deletions hipo4/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ hipo_lib = library(
'-Wno-unused-but-set-variable',
'-Wno-misleading-indentation',
'-Wno-format',
'-Wno-stringop-overflow',
],
install: true
)
Expand Down
2 changes: 1 addition & 1 deletion meson.options
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 77ae542

Please sign in to comment.