From 50ae58ec96f28055ee7f26a0b74c1d2d2126b34e Mon Sep 17 00:00:00 2001 From: milkschen Date: Mon, 22 Sep 2025 17:08:04 -0700 Subject: [PATCH 1/6] Use a tiered testing approach --- .github/workflows/cmake_htslib.yml | 89 ++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cmake_htslib.yml b/.github/workflows/cmake_htslib.yml index 2e53ca9..af6bd67 100644 --- a/.github/workflows/cmake_htslib.yml +++ b/.github/workflows/cmake_htslib.yml @@ -26,17 +26,89 @@ env: BUILD_TYPE: Release jobs: - htslib_matrix: + # Critical compatibility tests - always run + critical_tests: strategy: matrix: - version: [1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18] - os: [ubuntu-22.04, ubuntu-latest] + version: [1.12, 1.18] # Oldest and newest supported versions + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Set up SDSL + run: sudo apt-get -y install libsdsl-dev + + - name: Set up htslib + run: + sudo apt-get -y install libbz2-dev liblzma-dev && + wget https://github.com/samtools/htslib/releases/download/${{ matrix.version }}/htslib-${{ matrix.version }}.tar.bz2 && + tar -vxjf htslib-${{ matrix.version }}.tar.bz2 && + cd htslib-${{ matrix.version }} && + ./configure && + make && + sudo make install && + cd ../ && + rm htslib-${{ matrix.version }}.tar.bz2 + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + run: + gcc -v && + cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}} - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + # Extended compatibility tests - run on PRs and main branch + extended_tests: + if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' + strategy: + matrix: + version: [1.13, 1.15, 1.17] # Representative middle versions + os: [ubuntu-22.04] runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + + - name: Set up SDSL + run: sudo apt-get -y install libsdsl-dev + + - name: Set up htslib + run: + sudo apt-get -y install libbz2-dev liblzma-dev && + wget https://github.com/samtools/htslib/releases/download/${{ matrix.version }}/htslib-${{ matrix.version }}.tar.bz2 && + tar -vxjf htslib-${{ matrix.version }}.tar.bz2 && + cd htslib-${{ matrix.version }} && + ./configure && + make && + sudo make install && + cd ../ && + rm htslib-${{ matrix.version }}.tar.bz2 + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + - name: Build + run: + gcc -v && + cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}} + + # Full compatibility tests - run only on main branch or manual trigger + full_tests: + if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' + strategy: + matrix: + version: [1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18] + os: [ubuntu-22.04, ubuntu-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -56,18 +128,13 @@ jobs: rm htslib-${{ matrix.version }}.tar.bz2 - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build - # Build your program with the given configuration run: gcc -v && cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - name: Test working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}} From 5372892642de041a32ce26304dfe8e0f66563554 Mon Sep 17 00:00:00 2001 From: milkschen Date: Mon, 22 Sep 2025 17:44:33 -0700 Subject: [PATCH 2/6] refactor --- .github/actions/build-test/action.yml | 39 +++++++ .github/actions/setup-htslib/action.yml | 43 +++++++ .github/workflows/cmake_htslib.yml | 106 ++++-------------- .github/workflows/cmake_htslib_with_cache.yml | 95 ++++++++++++++++ 4 files changed, 199 insertions(+), 84 deletions(-) create mode 100644 .github/actions/build-test/action.yml create mode 100644 .github/actions/setup-htslib/action.yml create mode 100644 .github/workflows/cmake_htslib_with_cache.yml diff --git a/.github/actions/build-test/action.yml b/.github/actions/build-test/action.yml new file mode 100644 index 0000000..eb604ad --- /dev/null +++ b/.github/actions/build-test/action.yml @@ -0,0 +1,39 @@ +name: 'Build and Test LevioSAM2' +description: 'Build and test LevioSAM2 with CMake' +inputs: + build-type: + description: 'CMake build type' + required: false + default: 'Release' + cache-enabled: + description: 'Enable caching for CMake builds' + required: false + default: 'true' + +runs: + using: 'composite' + steps: + - name: Cache CMake build + if: inputs.cache-enabled == 'true' + uses: actions/cache@v3 + with: + path: ${{github.workspace}}/build + key: cmake-build-${{ runner.os }}-${{ inputs.build-type }}-${{ hashFiles('**/CMakeLists.txt', '**/src/**') }} + restore-keys: | + cmake-build-${{ runner.os }}-${{ inputs.build-type }}- + cmake-build-${{ runner.os }}- + + - name: Configure CMake + shell: bash + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} + + - name: Build + shell: bash + run: | + gcc -v && + cmake --build ${{github.workspace}}/build --config ${{ inputs.build-type }} + + - name: Test + shell: bash + working-directory: ${{github.workspace}}/build + run: ./leviosam2 -h && ctest -C ${{ inputs.build-type }} diff --git a/.github/actions/setup-htslib/action.yml b/.github/actions/setup-htslib/action.yml new file mode 100644 index 0000000..374d12c --- /dev/null +++ b/.github/actions/setup-htslib/action.yml @@ -0,0 +1,43 @@ +name: 'Setup htslib' +description: 'Install and configure htslib with caching' +inputs: + version: + description: 'htslib version to install' + required: true + cache-enabled: + description: 'Enable caching for htslib builds' + required: false + default: 'true' + +runs: + using: 'composite' + steps: + - name: Cache htslib + if: inputs.cache-enabled == 'true' + uses: actions/cache@v3 + with: + path: /tmp/htslib-${{ inputs.version }} + key: htslib-${{ inputs.version }}-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }} + restore-keys: | + htslib-${{ inputs.version }}-${{ runner.os }}- + htslib-${{ inputs.version }}- + + - name: Set up SDSL + shell: bash + run: sudo apt-get -y install libsdsl-dev + + - name: Set up htslib + shell: bash + run: | + if [ ! -d "/tmp/htslib-${{ inputs.version }}" ]; then + sudo apt-get -y install libbz2-dev liblzma-dev && + wget https://github.com/samtools/htslib/releases/download/${{ inputs.version }}/htslib-${{ inputs.version }}.tar.bz2 && + tar -vxjf htslib-${{ inputs.version }}.tar.bz2 && + cd htslib-${{ inputs.version }} && + ./configure --prefix=/tmp/htslib-${{ inputs.version }} && + make && + make install && + cd ../ && + rm htslib-${{ inputs.version }}.tar.bz2 + fi + sudo cp -r /tmp/htslib-${{ inputs.version }}/* /usr/local/ diff --git a/.github/workflows/cmake_htslib.yml b/.github/workflows/cmake_htslib.yml index af6bd67..e70ce3c 100644 --- a/.github/workflows/cmake_htslib.yml +++ b/.github/workflows/cmake_htslib.yml @@ -30,111 +30,49 @@ jobs: critical_tests: strategy: matrix: - version: [1.12, 1.18] # Oldest and newest supported versions + version: [1.12, 1.22.1] # Oldest and newest supported versions os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - - name: Set up SDSL - run: sudo apt-get -y install libsdsl-dev - - - name: Set up htslib - run: - sudo apt-get -y install libbz2-dev liblzma-dev && - wget https://github.com/samtools/htslib/releases/download/${{ matrix.version }}/htslib-${{ matrix.version }}.tar.bz2 && - tar -vxjf htslib-${{ matrix.version }}.tar.bz2 && - cd htslib-${{ matrix.version }} && - ./configure && - make && - sudo make install && - cd ../ && - rm htslib-${{ matrix.version }}.tar.bz2 - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - run: - gcc -v && - cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}} + - uses: ./.github/actions/setup-htslib + with: + version: ${{ matrix.version }} + - uses: ./.github/actions/build-test + with: + build-type: ${{ env.BUILD_TYPE }} # Extended compatibility tests - run on PRs and main branch extended_tests: if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' strategy: matrix: - version: [1.13, 1.15, 1.17] # Representative middle versions + version: [1.19.1, 1.20, 1.21] # Representative middle versions os: [ubuntu-22.04] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - - name: Set up SDSL - run: sudo apt-get -y install libsdsl-dev - - - name: Set up htslib - run: - sudo apt-get -y install libbz2-dev liblzma-dev && - wget https://github.com/samtools/htslib/releases/download/${{ matrix.version }}/htslib-${{ matrix.version }}.tar.bz2 && - tar -vxjf htslib-${{ matrix.version }}.tar.bz2 && - cd htslib-${{ matrix.version }} && - ./configure && - make && - sudo make install && - cd ../ && - rm htslib-${{ matrix.version }}.tar.bz2 - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - run: - gcc -v && - cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}} + - uses: ./.github/actions/setup-htslib + with: + version: ${{ matrix.version }} + - uses: ./.github/actions/build-test + with: + build-type: ${{ env.BUILD_TYPE }} # Full compatibility tests - run only on main branch or manual trigger full_tests: if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' strategy: matrix: - version: [1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18] + # Test the oldest supported version (1.12) and four most recent versions + version: [1.12, 1.19.1, 1.20, 1.21, 1.22.1] os: [ubuntu-22.04, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - - name: Set up SDSL - run: sudo apt-get -y install libsdsl-dev - - - name: Set up htslib - run: - sudo apt-get -y install libbz2-dev liblzma-dev && - wget https://github.com/samtools/htslib/releases/download/${{ matrix.version }}/htslib-${{ matrix.version }}.tar.bz2 && - tar -vxjf htslib-${{ matrix.version }}.tar.bz2 && - cd htslib-${{ matrix.version }} && - ./configure && - make && - sudo make install && - cd ../ && - rm htslib-${{ matrix.version }}.tar.bz2 - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - run: - gcc -v && - cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - run: ./leviosam2 -h && ctest -C ${{env.BUILD_TYPE}} + - uses: ./.github/actions/setup-htslib + with: + version: ${{ matrix.version }} + - uses: ./.github/actions/build-test + with: + build-type: ${{ env.BUILD_TYPE }} diff --git a/.github/workflows/cmake_htslib_with_cache.yml b/.github/workflows/cmake_htslib_with_cache.yml new file mode 100644 index 0000000..568f70d --- /dev/null +++ b/.github/workflows/cmake_htslib_with_cache.yml @@ -0,0 +1,95 @@ +name: Optimized Compatibility Testing + +on: + push: + branches: [ main ] + paths: + - '.github/**' + - 'src/**' + - 'leviosam-test.py' + - 'CMakeLists.txt' + - 'CMakeLists.txt.in' + - 'testdata/**' + pull_request: + branches: [ main ] + paths: + - '.github/**' + - 'src/**' + - 'leviosam-test.py' + - 'CMakeLists.txt' + - 'CMakeLists.txt.in' + - 'testdata/**' + workflow_dispatch: + inputs: + test_level: + description: 'Test level to run' + required: true + default: 'smart' + type: choice + options: + - smart + - extended + - full + +env: + BUILD_TYPE: Release + +jobs: + # Smart matrix testing - tests edge cases and representative versions + smart_tests: + if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'smart' || github.event_name != 'workflow_dispatch' + strategy: + matrix: + # Test critical versions: oldest, newest, and one middle version + # Plus one version that historically had issues (if any) + version: [1.12, 1.15, 1.18] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-htslib + with: + version: ${{ matrix.version }} + cache-enabled: 'true' + - uses: ./.github/actions/build-test + with: + build-type: ${{ env.BUILD_TYPE }} + cache-enabled: 'true' + + # Extended testing for PRs + extended_tests: + if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'extended') + strategy: + matrix: + version: [1.13, 1.16, 1.17] + os: [ubuntu-22.04, ubuntu-20.04] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-htslib + with: + version: ${{ matrix.version }} + cache-enabled: 'true' + - uses: ./.github/actions/build-test + with: + build-type: ${{ env.BUILD_TYPE }} + cache-enabled: 'true' + + # Full compatibility matrix - only for releases or manual trigger + full_tests: + if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'full') + strategy: + matrix: + version: [1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18] + os: [ubuntu-22.04, ubuntu-20.04, ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-htslib + with: + version: ${{ matrix.version }} + cache-enabled: 'true' + - uses: ./.github/actions/build-test + with: + build-type: ${{ env.BUILD_TYPE }} + cache-enabled: 'true' From 5bf8ece809c4f67d032dc9e3b446b0dbb5936bc6 Mon Sep 17 00:00:00 2001 From: milkschen Date: Mon, 22 Sep 2025 17:51:07 -0700 Subject: [PATCH 3/6] updates cached tests --- .github/workflows/cmake_htslib_with_cache.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cmake_htslib_with_cache.yml b/.github/workflows/cmake_htslib_with_cache.yml index 568f70d..1079537 100644 --- a/.github/workflows/cmake_htslib_with_cache.yml +++ b/.github/workflows/cmake_htslib_with_cache.yml @@ -1,4 +1,4 @@ -name: Optimized Compatibility Testing +name: Build and ctest (with cache) on: push: @@ -40,9 +40,7 @@ jobs: if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'smart' || github.event_name != 'workflow_dispatch' strategy: matrix: - # Test critical versions: oldest, newest, and one middle version - # Plus one version that historically had issues (if any) - version: [1.12, 1.15, 1.18] + version: [1.12, 1.22.1] # Oldest and newest supported versions os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: @@ -61,8 +59,8 @@ jobs: if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'extended') strategy: matrix: - version: [1.13, 1.16, 1.17] - os: [ubuntu-22.04, ubuntu-20.04] + version: [1.19.1, 1.20, 1.21] # Representative middle versions + os: [ubuntu-22.04] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -80,8 +78,9 @@ jobs: if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'full') strategy: matrix: - version: [1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18] - os: [ubuntu-22.04, ubuntu-20.04, ubuntu-latest] + # Test the oldest supported version (1.12) and four most recent versions + version: [1.12, 1.19.1, 1.20, 1.21, 1.22.1] + os: [ubuntu-22.04, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 From e1232326d9e61629b484337b7e94a1f54edaf006 Mon Sep 17 00:00:00 2001 From: milkschen Date: Mon, 22 Sep 2025 21:57:49 -0700 Subject: [PATCH 4/6] add quotes --- .github/workflows/cmake_htslib_with_cache.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake_htslib_with_cache.yml b/.github/workflows/cmake_htslib_with_cache.yml index 1079537..2663a86 100644 --- a/.github/workflows/cmake_htslib_with_cache.yml +++ b/.github/workflows/cmake_htslib_with_cache.yml @@ -40,8 +40,8 @@ jobs: if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'smart' || github.event_name != 'workflow_dispatch' strategy: matrix: - version: [1.12, 1.22.1] # Oldest and newest supported versions - os: [ubuntu-latest] + version: ['1.12', '1.22.1'] # Oldest and newest supported versions + os: ['ubuntu-latest'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -59,8 +59,8 @@ jobs: if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'extended') strategy: matrix: - version: [1.19.1, 1.20, 1.21] # Representative middle versions - os: [ubuntu-22.04] + version: ['1.19.1', '1.20', '1.21'] # Representative middle versions + os: ['ubuntu-22.04'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -79,8 +79,8 @@ jobs: strategy: matrix: # Test the oldest supported version (1.12) and four most recent versions - version: [1.12, 1.19.1, 1.20, 1.21, 1.22.1] - os: [ubuntu-22.04, ubuntu-latest] + version: ['1.12', '1.19.1', '1.20', '1.21', '1.22.1'] + os: ['ubuntu-22.04', 'ubuntu-latest'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 From 7739195a1b6c50921ac25f1a155770726ab3c941 Mon Sep 17 00:00:00 2001 From: milkschen Date: Mon, 22 Sep 2025 22:02:03 -0700 Subject: [PATCH 5/6] add quotes --- .github/workflows/cmake_htslib.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake_htslib.yml b/.github/workflows/cmake_htslib.yml index e70ce3c..734fdcc 100644 --- a/.github/workflows/cmake_htslib.yml +++ b/.github/workflows/cmake_htslib.yml @@ -30,8 +30,8 @@ jobs: critical_tests: strategy: matrix: - version: [1.12, 1.22.1] # Oldest and newest supported versions - os: [ubuntu-latest] + version: ['1.12', '1.22.1'] # Oldest and newest supported versions + os: ['ubuntu-latest'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -47,8 +47,8 @@ jobs: if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' strategy: matrix: - version: [1.19.1, 1.20, 1.21] # Representative middle versions - os: [ubuntu-22.04] + version: ['1.19.1', '1.20', '1.21'] # Representative middle versions + os: ['ubuntu-22.04'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -65,8 +65,8 @@ jobs: strategy: matrix: # Test the oldest supported version (1.12) and four most recent versions - version: [1.12, 1.19.1, 1.20, 1.21, 1.22.1] - os: [ubuntu-22.04, ubuntu-latest] + version: ['1.12', '1.19.1', '1.20', '1.21', '1.22.1'] + os: ['ubuntu-22.04', 'ubuntu-latest'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 From d8c90e5bb329daa1659df13e285a1b53fabceeb8 Mon Sep 17 00:00:00 2001 From: milkschen Date: Mon, 22 Sep 2025 22:06:29 -0700 Subject: [PATCH 6/6] consolidate and refactor --- .github/workflows/cmake_htslib.yml | 69 +++++++++++--- .github/workflows/cmake_htslib_with_cache.yml | 94 ------------------- 2 files changed, 54 insertions(+), 109 deletions(-) delete mode 100644 .github/workflows/cmake_htslib_with_cache.yml diff --git a/.github/workflows/cmake_htslib.yml b/.github/workflows/cmake_htslib.yml index 734fdcc..4a62532 100644 --- a/.github/workflows/cmake_htslib.yml +++ b/.github/workflows/cmake_htslib.yml @@ -1,4 +1,4 @@ -name: Build and ctest +name: Build and ctest (with cache) on: push: @@ -11,8 +11,7 @@ on: - 'CMakeLists.txt.in' - 'testdata/**' pull_request: - branches: - - 'main' + branches: [ main ] paths: - '.github/**' - 'src/**' @@ -20,17 +19,48 @@ on: - 'CMakeLists.txt' - 'CMakeLists.txt.in' - 'testdata/**' + workflow_dispatch: + inputs: + test_level: + description: 'Test level to run' + required: true + default: 'smart' + type: choice + options: + - smart + - extended + - full env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release jobs: - # Critical compatibility tests - always run + # Setup job to define version lists + setup: + runs-on: ubuntu-latest + outputs: + all_versions: ${{ steps.versions.outputs.all }} + critical_versions: ${{ steps.versions.outputs.critical }} + extended_versions: ${{ steps.versions.outputs.extended }} + steps: + - name: Define version lists + id: versions + run: | + ALL_VERSIONS='["1.12", "1.19.1", "1.20", "1.21", "1.22.1"]' + CRITICAL_VERSIONS='["1.12", "1.22.1"]' + EXTENDED_VERSIONS='["1.19.1", "1.20", "1.21"]' + + echo "all=$ALL_VERSIONS" >> $GITHUB_OUTPUT + echo "critical=$CRITICAL_VERSIONS" >> $GITHUB_OUTPUT + echo "extended=$EXTENDED_VERSIONS" >> $GITHUB_OUTPUT + + # Critical matrix testing - tests edge cases and representative versions critical_tests: + needs: setup + if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'smart' || github.event_name != 'workflow_dispatch' strategy: matrix: - version: ['1.12', '1.22.1'] # Oldest and newest supported versions + version: ${{ fromJSON(needs.setup.outputs.critical_versions) }} # Oldest and newest supported versions os: ['ubuntu-latest'] runs-on: ${{ matrix.os }} steps: @@ -38,16 +68,20 @@ jobs: - uses: ./.github/actions/setup-htslib with: version: ${{ matrix.version }} + cache-enabled: 'true' - uses: ./.github/actions/build-test with: build-type: ${{ env.BUILD_TYPE }} - - # Extended compatibility tests - run on PRs and main branch + cache-enabled: 'true' + + # Extended testing for PRs extended_tests: - if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' + needs: setup + if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'extended') strategy: matrix: - version: ['1.19.1', '1.20', '1.21'] # Representative middle versions + # Representative middle versions + version: ${{ fromJSON(needs.setup.outputs.extended_versions) }} os: ['ubuntu-22.04'] runs-on: ${{ matrix.os }} steps: @@ -55,17 +89,20 @@ jobs: - uses: ./.github/actions/setup-htslib with: version: ${{ matrix.version }} + cache-enabled: 'true' - uses: ./.github/actions/build-test with: build-type: ${{ env.BUILD_TYPE }} - - # Full compatibility tests - run only on main branch or manual trigger + cache-enabled: 'true' + + # Full compatibility matrix - only for releases or manual trigger full_tests: - if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' + needs: setup + if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'full') strategy: matrix: - # Test the oldest supported version (1.12) and four most recent versions - version: ['1.12', '1.19.1', '1.20', '1.21', '1.22.1'] + # Test all supported versions + version: ${{ fromJSON(needs.setup.outputs.all_versions) }} os: ['ubuntu-22.04', 'ubuntu-latest'] runs-on: ${{ matrix.os }} steps: @@ -73,6 +110,8 @@ jobs: - uses: ./.github/actions/setup-htslib with: version: ${{ matrix.version }} + cache-enabled: 'true' - uses: ./.github/actions/build-test with: build-type: ${{ env.BUILD_TYPE }} + cache-enabled: 'true' diff --git a/.github/workflows/cmake_htslib_with_cache.yml b/.github/workflows/cmake_htslib_with_cache.yml deleted file mode 100644 index 2663a86..0000000 --- a/.github/workflows/cmake_htslib_with_cache.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Build and ctest (with cache) - -on: - push: - branches: [ main ] - paths: - - '.github/**' - - 'src/**' - - 'leviosam-test.py' - - 'CMakeLists.txt' - - 'CMakeLists.txt.in' - - 'testdata/**' - pull_request: - branches: [ main ] - paths: - - '.github/**' - - 'src/**' - - 'leviosam-test.py' - - 'CMakeLists.txt' - - 'CMakeLists.txt.in' - - 'testdata/**' - workflow_dispatch: - inputs: - test_level: - description: 'Test level to run' - required: true - default: 'smart' - type: choice - options: - - smart - - extended - - full - -env: - BUILD_TYPE: Release - -jobs: - # Smart matrix testing - tests edge cases and representative versions - smart_tests: - if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'smart' || github.event_name != 'workflow_dispatch' - strategy: - matrix: - version: ['1.12', '1.22.1'] # Oldest and newest supported versions - os: ['ubuntu-latest'] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-htslib - with: - version: ${{ matrix.version }} - cache-enabled: 'true' - - uses: ./.github/actions/build-test - with: - build-type: ${{ env.BUILD_TYPE }} - cache-enabled: 'true' - - # Extended testing for PRs - extended_tests: - if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'extended') - strategy: - matrix: - version: ['1.19.1', '1.20', '1.21'] # Representative middle versions - os: ['ubuntu-22.04'] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-htslib - with: - version: ${{ matrix.version }} - cache-enabled: 'true' - - uses: ./.github/actions/build-test - with: - build-type: ${{ env.BUILD_TYPE }} - cache-enabled: 'true' - - # Full compatibility matrix - only for releases or manual trigger - full_tests: - if: github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_level == 'full') - strategy: - matrix: - # Test the oldest supported version (1.12) and four most recent versions - version: ['1.12', '1.19.1', '1.20', '1.21', '1.22.1'] - os: ['ubuntu-22.04', 'ubuntu-latest'] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-htslib - with: - version: ${{ matrix.version }} - cache-enabled: 'true' - - uses: ./.github/actions/build-test - with: - build-type: ${{ env.BUILD_TYPE }} - cache-enabled: 'true'