Skip to content

Hydra

Hydra #1021

Workflow file for this run

name: Hydra
on:
schedule:
# Once per day, Monday to Friday
- cron: '0 19 * * 1-5'
push:
branches:
- main
pull_request:
jobs:
test:
strategy:
fail-fast: false
matrix:
platform:
- os: macos-latest
cc: clang
cxx: clang++
type: static
- os: macos-latest
cc: clang
cxx: clang++
type: shared
- os: ubuntu-latest
cc: clang
cxx: clang++
type: static
- os: ubuntu-latest
cc: gcc
cxx: g++
type: static
- os: ubuntu-latest
cc: clang
cxx: clang++
type: shared
- os: ubuntu-latest
cc: gcc
cxx: g++
type: shared
- os: windows-latest
type: static
- os: windows-latest
type: shared
# Sanitizers
# TODO: Re-enable. Rigtht now ASAN on GitHub Actions
# seems broken for some reason
# - os: ubuntu-latest
# cc: clang
# cxx: clang++
# type: static
# options: -DHYDRA_ADDRESS_SANITIZER:BOOL=ON
- os: ubuntu-latest
cc: clang
cxx: clang++
type: static
options: -DHYDRA_UNDEFINED_SANITIZER:BOOL=ON
runs-on: ${{ matrix.platform.os }}
env:
MINIO_ROOT_USER: sourcemeta
MINIO_ROOT_PASSWORD: sourcemeta
MINIO_PORT: 9000
MINIO_PROTOCOL: http
MINIO_ADDRESS: 127.0.0.1
MINIO_REGION: us-east-1
MINIO_ALIAS: sourcemeta
MINIO_ACCESS_KEY: sourcemeta-test
MINIO_SECRET_KEY: 12345678
MINIO_BUCKET: test
HTTPCLIENT_STUB_PORT: 9999
HTTPSERVER_STUB_PORT: 9998
CC: ${{ matrix.platform.cc }}
CXX: ${{ matrix.platform.cxx }}
steps:
- name: Install ClangFormat
run: pipx install clang-format==19.1.0
- name: Install dependencies (GNU/Linux)
if: runner.os == 'linux'
run: |
sudo apt-get update --yes
sudo apt-get install --yes nodejs
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20240307004348.0.0_amd64.deb -O minio.deb
sudo dpkg -i minio.deb
rm minio.deb
curl https://dl.min.io/client/mc/release/linux-amd64/mc --output /usr/local/bin/mc
chmod +x /usr/local/bin/mc
- uses: actions/checkout@v3
- name: Install dependencies (macOS)
if: runner.os == 'macos'
run: brew bundle
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
- run: cmake --version
- name: Configure Hydra (static)
if: matrix.platform.type == 'static'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DHYDRA_CRYPTO:BOOL=ON
-DHYDRA_TESTS:BOOL=ON
-DHYDRA_DOCS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ matrix.platform.options }}
- name: Configure Hydra (shared)
if: matrix.platform.type == 'shared'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DHYDRA_CRYPTO:BOOL=ON
-DHYDRA_TESTS:BOOL=ON
-DHYDRA_DOCS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ matrix.platform.options }}
- run: cmake --build ./build --config Release --target clang_format_test
- run: cmake --build ./build --config Release --parallel 4
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_jsontoolkit
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_jsontoolkit_dev
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_hydra
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_hydra_dev
# Run stubs
- name: Run MinIO stub (*nix)
run: (minio server --address :${{ env.MINIO_PORT }} build/minio &) && sleep 10 && make configure-minio
if: runner.os != 'windows'
- name: Run HTTP client stub (Windows)
run: cmd /c "start /b node test\e2e\httpclient\stub.js ${{ env.HTTPCLIENT_STUB_PORT }}" && Start-Sleep -Seconds 10
if: runner.os == 'windows'
- name: Run HTTP client stub (*nix)
run: (node test/e2e/httpclient/stub.js ${{ env.HTTPCLIENT_STUB_PORT }} &) && sleep 10
if: runner.os != 'windows'
- name: Run HTTP server stub (*nix)
run: (./build/test/e2e/httpserver/sourcemeta_hydra_httpserver_e2e_stub ${{ env.HTTPSERVER_STUB_PORT }} &) && sleep 10
if: runner.os != 'windows'
# Not every CTest version supports the --test-dir option. If such option
# is not recognized, `ctest` will successfully exit finding no tests.
# Better to be sure and `cd` all the time here.
- name: Tests (*nix)
run: cd ./build && ctest --build-config Release --output-on-failure --parallel
if: runner.os != 'windows'
env:
SOURCEMETA_HYDRA_TEST_HTTPCLIENT_BASE_URL: 'http://localhost:${{ env.HTTPCLIENT_STUB_PORT }}'
SOURCEMETA_HYDRA_TEST_HTTPSERVER_BASE_URL: 'http://localhost:${{ env.HTTPSERVER_STUB_PORT }}'
SOURCEMETA_HYDRA_TEST_BUCKET_BASE_URL: ${{ env.MINIO_PROTOCOL }}://${{ env.MINIO_ADDRESS }}:${{ env.MINIO_PORT }}/${{ env.MINIO_BUCKET }}
SOURCEMETA_HYDRA_TEST_BUCKET_REGION: ${{ env.MINIO_REGION }}
SOURCEMETA_HYDRA_TEST_BUCKET_ACCESS_KEY: ${{ env.MINIO_ACCESS_KEY }}
SOURCEMETA_HYDRA_TEST_BUCKET_SECRET_KEY: ${{ env.MINIO_SECRET_KEY }}
# See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
UBSAN_OPTIONS: print_stacktrace=1
- name: Tests (Windows)
# TODO: Run Bucket MinIO tests on Windows
run: cd ./build && ctest --build-config Release --exclude-regex e2e_Bucket --output-on-failure --parallel
if: runner.os == 'windows'
env:
SOURCEMETA_HYDRA_TEST_HTTPCLIENT_BASE_URL: 'http://localhost:${{ env.HTTPCLIENT_STUB_PORT }}'