From d5efb644099bf750408d89846dcbbb350f645214 Mon Sep 17 00:00:00 2001 From: flagarde Date: Mon, 17 Jan 2022 10:48:00 +0800 Subject: [PATCH] ci: Add workflows --- .github/workflows/Linux-Clang.yml | 2 +- .github/workflows/Linux-GCC.yml | 62 +++++++++++++++++++++++++++++ .github/workflows/MacOS-Clang.yml | 45 +++++++++++++++++++++ .github/workflows/MacOS-GCC.yml | 55 +++++++++++++++++++++++++ .github/workflows/Windows-MSVC.yml | 57 ++++++++++++++++++++++++++ .github/workflows/Windows-MSYS2.yml | 62 +++++++++++++++++++++++++++++ 6 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/Linux-GCC.yml create mode 100644 .github/workflows/MacOS-Clang.yml create mode 100644 .github/workflows/MacOS-GCC.yml create mode 100644 .github/workflows/Windows-MSVC.yml create mode 100644 .github/workflows/Windows-MSYS2.yml diff --git a/.github/workflows/Linux-Clang.yml b/.github/workflows/Linux-Clang.yml index ec18455..468428a 100644 --- a/.github/workflows/Linux-Clang.yml +++ b/.github/workflows/Linux-Clang.yml @@ -35,7 +35,7 @@ jobs: if: hashFiles('.github/workflows/.env') != '' uses: xom9ikk/dotenv@v1.0.2 with: - path: .github/workflows/ + path: .github/workflows - name: '${{ matrix.icon }} Setup CMake' uses: jwlawson/actions-setup-cmake@v1.11 diff --git a/.github/workflows/Linux-GCC.yml b/.github/workflows/Linux-GCC.yml new file mode 100644 index 0000000..b7b349d --- /dev/null +++ b/.github/workflows/Linux-GCC.yml @@ -0,0 +1,62 @@ +name: 'Linux GCC' + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - { icon: '๐ŸŸจ', cc: gcc-7, cxx: g++-7, name: 'GCC 7', gpp : 'g++-7-multilib' } + - { icon: '๐ŸŸฆ', cc: gcc-8, cxx: g++-8, name: 'GCC 8', gpp : 'g++-8-multilib' } + - { icon: '๐ŸŸฉ', cc: gcc-9, cxx: g++-9, name: 'GCC 9', gpp : 'g++-9-multilib' } + - { icon: '๐ŸŸฅ', cc: gcc-10, cxx: g++-10, name: 'GCC 10', gpp : 'g++-10-multilib' } + name: '๐Ÿšง ${{ matrix.icon }} ${{ matrix.name }}' + + steps: + + - name: '๐Ÿงฐ Add toolchains' + run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get update + + - name: '๐Ÿงฐ Checkout' + uses: actions/checkout@v2.4.0 + + - name: '๐Ÿ“ฅ Load .env file' + if: hashFiles('.github/workflows/.env/.env') != '' + uses: xom9ikk/dotenv@v1.0.2 + with: + path: .github/workflows + + - name: '${{ matrix.icon }} Setup CMake' + uses: jwlawson/actions-setup-cmake@v1.11 + with: + cmake-version: '${{env.CMAKE_VERSION}}' + github-api-token: ${{ secrets.GITHUB_TOKEN }} + + - name: '${{ matrix.icon }} Install ${{ matrix.cc }}' + run: sudo apt-get install ${{ matrix.cc }} ${{ matrix.gpp }} + + - name: '${{ matrix.icon }} Install packages' + if: ${{ env.INSTALL_PACKAGES != '' }} + run: sudo apt-get install ${{env.INSTALL_PACKAGES}} + + - name: '๐Ÿ”ง Configure' + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + run: cmake -S . -B ${{ env.CMAKE_BUILD_PREFIX }} -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DBUILD_TESTS=${{ env.BUILD_TESTS }} -DBUILD_DOCS=${{ env.BUILD_DOCS }} -DBUILD_EXAMPLES=${{ env.BUILD_EXAMPLES }} + + - name: 'โš™๏ธ Build' + run: cmake --build ${{ env.CMAKE_BUILD_PREFIX }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS }} + + - name: '๐Ÿงช Run tests' + working-directory: ${{ env.CMAKE_BUILD_PREFIX }} + run: ctest -C ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS_TESTS }} -VV --output-on-failure diff --git a/.github/workflows/MacOS-Clang.yml b/.github/workflows/MacOS-Clang.yml new file mode 100644 index 0000000..cc41cb6 --- /dev/null +++ b/.github/workflows/MacOS-Clang.yml @@ -0,0 +1,45 @@ +name: 'MacOS Clang' + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + pull_request: + +jobs: + build: + runs-on: macos-latest + name: '๐Ÿšง ๐ŸŸจ Clang' + + steps: + + - name: '๐Ÿงฐ Checkout' + uses: actions/checkout@v2.4.0 + + - name: '๐Ÿ“ฅ Load .env file' + if: hashFiles('.github/workflows/.env/.env') != '' + uses: xom9ikk/dotenv@v1.0.2 + with: + path: .github/workflows + + - name: '๐ŸŸจ Setup CMake' + uses: jwlawson/actions-setup-cmake@v1.11 + with: + cmake-version: '${{env.CMAKE_VERSION}}' + github-api-token: ${{ secrets.GITHUB_TOKEN }} + + - name: '๐ŸŸจ Install packages' + if: ${{ env.INSTALL_PACKAGES != '' }} + run: brew install ${{env.INSTALL_PACKAGES}} + + - name: '๐Ÿ”ง Configure' + run: cmake -S ${{ github.workspace }} -B ${{ env.CMAKE_BUILD_PREFIX }} -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DBUILD_TESTS=${{ env.BUILD_TESTS }} -DBUILD_DOCS=${{ env.BUILD_DOCS }} -DBUILD_EXAMPLES=${{ env.BUILD_EXAMPLES }} + + - name: 'โš™๏ธ Build' + run: cmake --build ${{ env.CMAKE_BUILD_PREFIX }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS }} + + - name: '๐Ÿงช Run tests' + working-directory: ${{ env.CMAKE_BUILD_PREFIX }} + run: ctest -C ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS_TESTS }} -VV --output-on-failure diff --git a/.github/workflows/MacOS-GCC.yml b/.github/workflows/MacOS-GCC.yml new file mode 100644 index 0000000..7e29bc4 --- /dev/null +++ b/.github/workflows/MacOS-GCC.yml @@ -0,0 +1,55 @@ +name: 'MacOS GCC' + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + pull_request: + +jobs: + build: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + include: + - { icon: '๐ŸŸจ', cc: gcc-9, cxx: g++-9, name: 'GCC 9' } + - { icon: '๐ŸŸฆ', cc: gcc-10, cxx: g++-10, name: 'GCC 10' } + - { icon: '๐ŸŸฉ', cc: gcc-11, cxx: g++-11, name: 'GCC 11' } + name: '๐Ÿšง ${{ matrix.icon }} ${{ matrix.name }}' + + steps: + + - name: '๐Ÿงฐ Checkout' + uses: actions/checkout@v2.4.0 + + - name: '๐Ÿ“ฅ Load .env file' + if: hashFiles('.github/workflows/.env/.env') != '' + uses: xom9ikk/dotenv@v1.0.2 + with: + path: .github/workflows + + - name: '${{ matrix.icon }} Setup CMake' + uses: jwlawson/actions-setup-cmake@v1.11 + with: + cmake-version: '${{env.CMAKE_VERSION}}' + github-api-token: ${{ secrets.GITHUB_TOKEN }} + + - name: '๐ŸŸจ Install packages' + if: ${{ env.INSTALL_PACKAGES != '' }} + run: brew install ${{env.INSTALL_PACKAGES}} + + - name: '๐Ÿ”ง Configure' + env: + CC: ${{matrix.cc}} + CXX: ${{matrix.cxx}} + run: cmake -S . -B ${{ env.CMAKE_BUILD_PREFIX }} -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DBUILD_TESTS=${{ env.BUILD_TESTS }} -DBUILD_DOCS=${{ env.BUILD_DOCS }} -DBUILD_EXAMPLES=${{ env.BUILD_EXAMPLES }} + + - name: 'โš™๏ธ Build' + run: cmake --build ${{ env.CMAKE_BUILD_PREFIX }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS }} + + - name: '๐Ÿงช Run tests' + working-directory: ${{ env.CMAKE_BUILD_PREFIX }} + run: ctest -C ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS_TESTS }} -VV --output-on-failure diff --git a/.github/workflows/Windows-MSVC.yml b/.github/workflows/Windows-MSVC.yml new file mode 100644 index 0000000..32b7d35 --- /dev/null +++ b/.github/workflows/Windows-MSVC.yml @@ -0,0 +1,57 @@ +name: 'Windows MSVC' + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + pull_request: + +jobs: + build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { icon: '๐ŸŸจ', env: Win32, toolset: x86 } + - { icon: '๐ŸŸฆ', env: x64, toolset: x64 } + #- { icon: '๐ŸŸฉ', env: ARM, toolset: x86 } + #- { icon: '๐ŸŸฅ', env: ARM64, toolset: x64 } + name: '๐Ÿšง ${{ matrix.icon }} ${{ matrix.env }}' + + steps: + + - name: '๐Ÿงฐ Checkout' + uses: actions/checkout@v2.4.0 + + - name: '๐Ÿ“ฅ Load .env file' + if: hashFiles('.github/workflows/.env/.env') != '' + uses: xom9ikk/dotenv@v1.0.2 + with: + path: .github/workflows + + - name: '${{ matrix.icon }} Setup CMake' + uses: jwlawson/actions-setup-cmake@v1.11 + with: + cmake-version: '${{env.CMAKE_VERSION}}' + github-api-token: ${{ secrets.GITHUB_TOKEN }} + + - name: '${{ matrix.icon }} Setup Visual Studio' + uses: ilammy/msvc-dev-cmd@v1.10.0 + + - name: '${{ matrix.icon }} Install package' + if: ${{ env.INSTALL_PACKAGES != '' }} + run: choco install ${{env.INSTALL_PACKAGES}} + + - name: '๐Ÿ”ง Configure' + run: cmake -S ${{ github.workspace }} -B ${{ env.CMAKE_BUILD_PREFIX }} -A ${{matrix.env}} -T host=${{matrix.toolset}} -DBUILD_TESTS=${{ env.BUILD_TESTS }} -DBUILD_DOCS=${{ env.BUILD_DOCS }} -DBUILD_EXAMPLES=${{ env.BUILD_EXAMPLES }} + + - name: 'โš™๏ธ Build' + run: cmake --build ${{ env.CMAKE_BUILD_PREFIX }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS }} + + - name: '๐Ÿงช Run tests' + if: ${{ matrix.env != 'ARM' && matrix.env != 'ARM64' }} + working-directory: ${{ env.CMAKE_BUILD_PREFIX }} + run: ctest -C ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS_TESTS }} -VV --output-on-failure diff --git a/.github/workflows/Windows-MSYS2.yml b/.github/workflows/Windows-MSYS2.yml new file mode 100644 index 0000000..6e014db --- /dev/null +++ b/.github/workflows/Windows-MSYS2.yml @@ -0,0 +1,62 @@ +name: 'Windows MSYS2' + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' + pull_request: + +jobs: + build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { icon: '๐ŸŸจ', sys: mingw32, env: i686, name: MINGW32 } + - { icon: '๐ŸŸฆ', sys: mingw64, env: x86_64, name: MINGW64 } + - { icon: '๐ŸŸฉ', sys: ucrt64, env: ucrt-x86_64, name: UCRT64 } # Experimental! + - { icon: '๐ŸŸฅ', sys: clang64, env: clang-x86_64, name: Clang64 } # Experimental! + + name: '๐Ÿšง ${{ matrix.icon }} ${{ matrix.name }}' + defaults: + run: + shell: msys2 {0} + + steps: + + - name: '๐Ÿงฐ Checkout' + uses: actions/checkout@v2.4.0 + + - name: '๐Ÿ“ฅ Load .env file' + if: hashFiles('.github/workflows/.env/.env') != '' + uses: xom9ikk/dotenv@v1.0.2 + with: + path: .github/workflows + + - name: '${{ matrix.icon }} Setup MSYS2' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + path-type: minimal + release: true + update: true + install: >- + git + make + mingw-w64-${{matrix.env}}-toolchain + mingw-w64-${{matrix.env}}-cmake + mingw-w64-${{matrix.env}}-ninja + pcre + ${{env.INSTALL_PACKAGES}} + - name: '๐Ÿ”ง Configure' + run: cmake -S . -B ${{ env.CMAKE_BUILD_PREFIX }} -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DBUILD_TESTS=${{ env.BUILD_TESTS }} -DBUILD_DOCS=${{ env.BUILD_DOCS }} -DBUILD_EXAMPLES=${{ env.BUILD_EXAMPLES }} + + - name: 'โš™๏ธ Build' + run: cmake --build ${{ env.CMAKE_BUILD_PREFIX }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS }} + + - name: '๐Ÿงช Run tests' + working-directory: ${{ env.CMAKE_BUILD_PREFIX }} + run: ctest -C ${{ env.CMAKE_BUILD_TYPE }} --parallel ${{ env.CMAKE_NUMBER_JOBS_TESTS }} -VV --output-on-failure