Merge pull request #310 from paulsengroup/warnings/cxx23 #1305
This file contains 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) 2023 Roberto Rossini <[email protected]> | |
# SPDX-License-Identifier: MIT | |
name: Windows CI | |
on: | |
push: | |
branches: [main] | |
paths: | |
- ".github/workflows/build-conan-deps.yml" | |
- ".github/workflows/cache-test-dataset.yml" | |
- ".github/workflows/windows-ci.yml" | |
- "cmake/**" | |
- "examples/**" | |
- "src/**" | |
- "test/integration/**" | |
- "test/units/**" | |
- "CMakeLists.txt" | |
- "conanfile.py" | |
pull_request: | |
paths: | |
- ".github/workflows/build-conan-deps.yml" | |
- ".github/workflows/cache-test-dataset.yml" | |
- ".github/workflows/windows-ci.yml" | |
- "cmake/**" | |
- "examples/**" | |
- "src/**" | |
- "test/integration/**" | |
- "test/units/**" | |
- "CMakeLists.txt" | |
- "conanfile.py" | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
CONAN_HOME: "${{ github.workspace }}\\.conan2" | |
HICTK_CI: "1" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
matrix-factory: | |
name: Generate job matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-result.outputs.result }} | |
steps: | |
- uses: actions/github-script@v7 | |
id: set-result | |
with: | |
script: | | |
// Documentation | |
// https://docs.github.com/en/actions/learn-github-actions/contexts#fromjson | |
// https://github.com/actions/runner/issues/982#issuecomment-809360765 | |
var includes = [] | |
includes.push({ compiler_name: 'msvc', os: 'windows-2022', cmake: '3.30.*', build_type: 'Debug', developer_mode: 'OFF' }) | |
includes.push({ compiler_name: 'msvc', os: 'windows-2022', cmake: '3.30.*', build_type: 'Release', developer_mode: 'OFF' }) | |
return { include: includes } | |
cache-test-dataset: | |
uses: paulsengroup/hictk/.github/workflows/cache-test-dataset.yml@main | |
name: Cache test dataset | |
build-conan-deps: | |
name: Build Conan deps | |
uses: paulsengroup/hictk/.github/workflows/build-conan-deps.yml@main | |
with: | |
os: windows-2019 | |
build-project: | |
needs: | |
- matrix-factory | |
- build-conan-deps | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.matrix-factory.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate requirements.txt for pip | |
run: echo 'cmake==${{ matrix.cmake }}' > requirements.txt | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Detect number available CPUs | |
run: | | |
ncpus=$(python -c 'import multiprocessing as mp; print(mp.cpu_count())') | |
echo "CMAKE_BUILD_PARALLEL_LEVEL=$ncpus" >> $GITHUB_ENV | |
echo "CTEST_PARALLEL_LEVEL=$ncpus" >> $GITHUB_ENV | |
- name: Install deps | |
run: pip install -r requirements.txt | |
- name: Restore Conan cache | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ needs.build-conan-deps.outputs.conan-key }} | |
path: ${{ env.CONAN_HOME }}\p | |
fail-on-cache-miss: true | |
- name: Restore CMake configs (Debug) | |
if: matrix.build_type == 'Debug' | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ needs.build-conan-deps.outputs.cmake-prefix-debug-key }} | |
path: ${{ github.workspace }}\cmake-prefix-dbg.tar | |
fail-on-cache-miss: true | |
- name: Restore CMake configs (Release) | |
if: matrix.build_type == 'Release' | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ needs.build-conan-deps.outputs.cmake-prefix-release-key }} | |
path: ${{ github.workspace }}\cmake-prefix-rel.tar | |
fail-on-cache-miss: true | |
- name: Extract CMake configs | |
run: | | |
mkdir conan-env | |
srcdir="$(cygpath '${{ github.workspace }}')" | |
tar -xf "$srcdir/"cmake-prefix-*.tar -C conan-env/ --strip-components=1 | |
- name: Configure project | |
run: | | |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DCMAKE_PREFIX_PATH="$PWD/conan-env" \ | |
-DENABLE_DEVELOPER_MODE=${{ matrix.developer_mode }} \ | |
-DHICTK_ENABLE_TESTING=ON \ | |
-DHICTK_BUILD_EXAMPLES=ON \ | |
-DHICTK_DOWNLOAD_TEST_DATASET=OFF \ | |
-DHICTK_ENABLE_GIT_VERSION_TRACKING=OFF \ | |
-DOPT_ENABLE_CLANG_TIDY=OFF \ | |
-DOPT_ENABLE_CPPCHECK=OFF \ | |
-DCMAKE_INSTALL_PREFIX=dest \ | |
-S "${{ github.workspace }}" \ | |
-B "${{ github.workspace }}/build" | |
- name: Build project | |
run: cmake --build build --config ${{ matrix.build_type }} | |
- name: Package binaries | |
run: | | |
cmake --install build | |
tar -cf - -C dest/ bin | zstd -T0 -13 -o binaries.tar.zst | |
- name: Package unit tests | |
run: | | |
rm -r build/src | |
tar --exclude='*.obj' -cf - build/ | zstd -T0 -13 -o unit-tests.tar.zst | |
- name: Upload unit tests | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "unit-tests-${{ matrix.os }}-\ | |
${{ matrix.compiler_name }}-\ | |
${{ matrix.build_type }}-\ | |
${{ matrix.developer_mode }}" | |
path: unit-tests.tar.zst | |
if-no-files-found: error | |
retention-days: 1 | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "binaries-${{ matrix.os }}-\ | |
${{ matrix.compiler_name }}-\ | |
${{ matrix.build_type }}-\ | |
${{ matrix.developer_mode }}" | |
path: binaries.tar.zst | |
if-no-files-found: error | |
retention-days: 1 | |
run-unit-tests: | |
name: Run unit tests | |
needs: [matrix-factory, cache-test-dataset, build-project] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.matrix-factory.outputs.matrix) }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Restore test dataset | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ needs.cache-test-dataset.outputs.cache-key }} | |
path: test/data/hictk_test_data.tar.zst | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Download unit tests artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: "unit-tests-${{ matrix.os }}-\ | |
${{ matrix.compiler_name }}-\ | |
${{ matrix.build_type }}-\ | |
${{ matrix.developer_mode }}" | |
- name: Extract binaries test dataset | |
run: | | |
tar -xf unit-tests.tar.zst | |
tar -xf test/data/hictk_test_data.tar.zst | |
- name: Generate requirements.txt for pip | |
run: | | |
echo 'cmake==${{ matrix.cmake }}' > requirements.txt | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
- name: Install test dependencies | |
run: pip install -r requirements.txt | |
- name: Run unit tests (Debug) | |
if: matrix.build_type == 'Debug' | |
run: | | |
skip_labels=( | |
'.*dataset large read\/write.*' | |
'.*HiCFileWriter.*' | |
'.*VectorOfAtomicDecimals.*' | |
) | |
pattern="$(IFS='|' ; echo "${skip_labels[*]}")" | |
ctest --test-dir build \ | |
--schedule-random \ | |
--output-on-failure \ | |
--no-tests=error \ | |
--timeout 360 \ | |
--exclude-regex "$pattern" |& | |
tail -n 1000 | |
- name: Run unit tests (Release) | |
if: matrix.build_type == 'Release' | |
run: | | |
ctest --test-dir build \ | |
--schedule-random \ | |
--output-on-failure \ | |
--no-tests=error \ | |
--timeout 120 |& | |
tail -n 1000 | |
run-integration-tests: | |
name: Run integration tests | |
needs: [matrix-factory, cache-test-dataset, build-project] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.matrix-factory.outputs.matrix) }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache-dependency-path: "test/integration/pyproject.toml" | |
cache: "pip" | |
- name: Restore test dataset | |
uses: actions/cache/restore@v4 | |
with: | |
key: ${{ needs.cache-test-dataset.outputs.cache-key }} | |
path: test/data/hictk_test_data.tar.zst | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Download binaries artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: "binaries-${{ matrix.os }}-\ | |
${{ matrix.compiler_name }}-\ | |
${{ matrix.build_type }}-\ | |
${{ matrix.developer_mode }}" | |
- name: Extract binaries test dataset | |
run: | | |
tar -xf binaries.tar.zst | |
tar -xf test/data/hictk_test_data.tar.zst | |
- name: Install test suite | |
run: | | |
python.exe -m venv venv --upgrade | |
venv/Scripts/pip.exe install test/integration | |
- name: Detect number available CPUs | |
run: | | |
ncpus=$(python -c 'import multiprocessing as mp; print(mp.cpu_count())') | |
echo "NPROC=$ncpus" | tee -a $GITHUB_ENV | |
- name: Test hictk balance | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.balance.json \ | |
--suites=balance | |
- name: Test hictk convert | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.convert.json \ | |
--suites=convert | |
- name: Test hictk dump | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.dump.json \ | |
--suites=dump | |
- name: Test hictk fix-mcool | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.fix-mcool.json \ | |
--suites=fix-mcool | |
- name: Test hictk load | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.load.json \ | |
--suites=load | |
- name: Test hictk merge | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.merge.json \ | |
--suites=merge | |
- name: Test hictk metadata | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.metadata.json \ | |
--suites=metadata | |
- name: Test hictk rename-chromosomes | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.rename-chromosomes.json \ | |
--suites=rename-chromosomes | |
- name: Test hictk validate | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.validate.json \ | |
--suites=validate | |
- name: Test hictk zoomify | |
run: | | |
venv/Scripts/hictk_integration_suite.exe \ | |
bin/hictk.exe \ | |
test/integration/config.toml \ | |
--data-dir test/data \ | |
--threads "$NPROC" \ | |
--result-file integration-test-report.zoomify.json \ | |
--suites=zoomify | |
windows-ci-status-check: | |
name: Status Check (Windows CI) | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
needs: | |
- matrix-factory | |
- cache-test-dataset | |
- build-project | |
- run-unit-tests | |
- run-integration-tests | |
steps: | |
- name: Collect job results | |
if: | | |
needs.build-project.result != 'success' || | |
needs.run-unit-tests.result != 'success' || | |
needs.run-integration-tests.result != 'success' | |
run: exit 1 |