From 682d5a642a56954f49f9e51e630f7f82f9df241b Mon Sep 17 00:00:00 2001 From: Ryo Nakamura Date: Tue, 7 Jan 2025 16:44:56 +0900 Subject: [PATCH] parallelize test on GitHub Actions uing matrix --- .github/workflows/test.yml | 18 +++++++++++++++--- CMakeLists.txt | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 32f9273..3b12d0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,18 @@ env: jobs: test: runs-on: ubuntu-latest + strategy: + fail-fast: false: + matrix: + index: # see DIST_IDS and DIST_VERS lists in CMakeLists.txt + - ubuntu-20.04 + - ubuntu-22.04 + - ubuntu-24.04 + - rocky-8.9 + - rocky-9.3 + - almalinux-9.3 + - alpine-3.19 + - arch-base steps: - uses: actions/checkout@v4 with: @@ -20,7 +32,7 @@ jobs: - name: patch to libssh run: patch -d libssh -p1 < patch/libssh-0.10.6-2-g6f1b1e76.patch - # TODO: just building docker does not require libssh. fix CMakeLists + # TODO: just building docker images does not require libssh. fix CMakeLists - name: install build dependency run: | sudo apt-get update @@ -30,7 +42,7 @@ jobs: run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build Containers - run: make -C ${{github.workspace}}/build docker-build-all + run: make -C ${{github.workspace}}/build docker-build-${{ matrix.index }} - name: Run Test - run: make -C ${{github.workspace}}/build docker-test-all + run: make -C ${{github.workspace}}/build docker-test-${{ matrix.index }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f769a6..9fc294e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,6 +165,8 @@ enable_testing() # Custom targets to build and test mscp in docker containers. # foreach(IN ZIP_LISTS) (cmake >= 3.17) can shorten the following lists. # However, ubuntu 20.04 has cmake 3.16.3. So this is a roundabout trick. +# +# When edit DIST_IDS and DIST_VERS, also edit .github/workflows/test.yaml list(APPEND DIST_IDS ubuntu ubuntu ubuntu rocky rocky almalinux alpine arch) list(APPEND DIST_VERS 20.04 22.04 24.04 8.9 9.3 9.3 3.19 base)