From 98a8fd627c45238423575263f9042be8f3d51a47 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Mon, 30 Aug 2021 22:37:56 +0200 Subject: [PATCH 1/7] Add dockcross builder Add dockcross builder Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 82 +++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/dockcross.yml diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml new file mode 100644 index 00000000..08d82d15 --- /dev/null +++ b/.github/workflows/dockcross.yml @@ -0,0 +1,82 @@ +name: Dockcross + +on: + push: + branches: + - "*" + paths-ignore: + - "**/README.md" + pull_request: + branches: + - "*" + +jobs: + image: + name: "Build ${{ matrix.image_name }} ${{ matrix.build_type }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Remove images that you do not need + image_name: + [ + android-arm, + android-arm64, + android-x86, + android-x86_64, + linux-x86, + linux-x64, + linux-x64-clang, + linux-arm64, + linux-arm64-musl, + linux-arm64-full, + linux-armv5, + linux-armv5-musl, + linux-m68k-uclibc, + linux-s390x, + linux-x64-tinycc, + linux-armv6, + linux-armv6-lts, + linux-armv6-musl, + linux-armv7l-musl, + linux-armv7, + linux-armv7a, + linux-x86_64-full, + linux-mips, + linux-ppc64le, + linux-riscv64, + linux-riscv32, + linux-xtensa-uclibc, + windows-static-x86, + windows-static-x64, + windows-static-x64-posix, + windows-armv7, + windows-shared-x86, + windows-shared-x64, + windows-shared-x64-posix, + windows-arm64, + manylinux2014-x64, + manylinux2014-x86, + manylinux2014-aarch64, + web-wasm, + ] + # Disable MinSizeRel RelWithDebInfo Debug Release + build_type: [Debug] + steps: + - name: "Checkout Code" + uses: actions/checkout@v2 + with: + submodules: "recursive" + fetch-depth: 0 + - name: "Pull ${{ matrix.image_name }}..." + run: docker pull dockcross/${{ matrix.image_name }} + - name: "Make script" + run: docker run --rm dockcross/${{ matrix.image_name }} > ./dockcross-${{ matrix.image_name }} + - name: "Config CMakefile" + run: cmake -B dockcross-${{ matrix.image_name }} -S . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + - name: "Build" + run: ninja -C dockcross-${{ matrix.image_name }} + - name: "Test" + run: | + cd dockcross-${{ matrix.image_name }} + ctest --build-config ${{ matrix.build_type }} From 4d683ce9673051b7991ca687dcf3a4f27ed06694 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Mon, 30 Aug 2021 23:01:22 +0200 Subject: [PATCH 2/7] Fix dependency Fix dependency Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml index 08d82d15..21913a31 100644 --- a/.github/workflows/dockcross.yml +++ b/.github/workflows/dockcross.yml @@ -68,6 +68,8 @@ jobs: with: submodules: "recursive" fetch-depth: 0 + - name: "Install dependency" + run: sudo apt-get update && sudo apt-get install -y ninja-build - name: "Pull ${{ matrix.image_name }}..." run: docker pull dockcross/${{ matrix.image_name }} - name: "Make script" From a4f458751c0351ca33c4a2c3bcce7d6ba236c7fd Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Tue, 31 Aug 2021 10:09:31 +0200 Subject: [PATCH 3/7] Fix script Fix script Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml index 21913a31..c80fc5dd 100644 --- a/.github/workflows/dockcross.yml +++ b/.github/workflows/dockcross.yml @@ -67,18 +67,16 @@ jobs: uses: actions/checkout@v2 with: submodules: "recursive" - fetch-depth: 0 - - name: "Install dependency" - run: sudo apt-get update && sudo apt-get install -y ninja-build + fetch-depth: 0 - name: "Pull ${{ matrix.image_name }}..." run: docker pull dockcross/${{ matrix.image_name }} - name: "Make script" run: docker run --rm dockcross/${{ matrix.image_name }} > ./dockcross-${{ matrix.image_name }} - name: "Config CMakefile" - run: cmake -B dockcross-${{ matrix.image_name }} -S . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + run: ./dockcross-${{ matrix.image_name }} cmake -B dockcross-${{ matrix.image_name }} -S . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - name: "Build" - run: ninja -C dockcross-${{ matrix.image_name }} + run: ./dockcross-${{ matrix.image_name }} ninja -C dockcross-${{ matrix.image_name }} - name: "Test" run: | cd dockcross-${{ matrix.image_name }} - ctest --build-config ${{ matrix.build_type }} + ./dockcross-${{ matrix.image_name }} ctest --build-config ${{ matrix.build_type }} From 5bba89e98ae51bbaa357fb2c01ca5d7dcf470422 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Tue, 31 Aug 2021 10:12:54 +0200 Subject: [PATCH 4/7] Fix script perm Fix script perm Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml index c80fc5dd..7d76e660 100644 --- a/.github/workflows/dockcross.yml +++ b/.github/workflows/dockcross.yml @@ -71,7 +71,9 @@ jobs: - name: "Pull ${{ matrix.image_name }}..." run: docker pull dockcross/${{ matrix.image_name }} - name: "Make script" - run: docker run --rm dockcross/${{ matrix.image_name }} > ./dockcross-${{ matrix.image_name }} + run: | + docker run --rm dockcross/${{ matrix.image_name }} > ./dockcross-${{ matrix.image_name }} + chmod +x ./dockcross-${{ matrix.image_name }} - name: "Config CMakefile" run: ./dockcross-${{ matrix.image_name }} cmake -B dockcross-${{ matrix.image_name }} -S . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - name: "Build" From 3d0368dc943979f110de9653ba69b775c7f1763c Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Tue, 31 Aug 2021 10:13:17 +0200 Subject: [PATCH 5/7] Fix CI format Fix CI format Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml index 7d76e660..baf64cf8 100644 --- a/.github/workflows/dockcross.yml +++ b/.github/workflows/dockcross.yml @@ -67,7 +67,7 @@ jobs: uses: actions/checkout@v2 with: submodules: "recursive" - fetch-depth: 0 + fetch-depth: 0 - name: "Pull ${{ matrix.image_name }}..." run: docker pull dockcross/${{ matrix.image_name }} - name: "Make script" From ed48742468323603f42ce13139a3e633f83d7370 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Tue, 31 Aug 2021 10:16:49 +0200 Subject: [PATCH 6/7] Add test Add test Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml index baf64cf8..465869d8 100644 --- a/.github/workflows/dockcross.yml +++ b/.github/workflows/dockcross.yml @@ -74,6 +74,10 @@ jobs: run: | docker run --rm dockcross/${{ matrix.image_name }} > ./dockcross-${{ matrix.image_name }} chmod +x ./dockcross-${{ matrix.image_name }} + - name: "Make script" + run: | + ls + pwd - name: "Config CMakefile" run: ./dockcross-${{ matrix.image_name }} cmake -B dockcross-${{ matrix.image_name }} -S . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - name: "Build" From 19c735c523def61d149f6c57e034e3d5788410b3 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Tue, 31 Aug 2021 10:36:04 +0200 Subject: [PATCH 7/7] New test New test Signed-off-by: Bensuperpc --- .github/workflows/dockcross.yml | 20 ++------------------ tools/dockcross-cmake-builder.sh | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 18 deletions(-) create mode 100755 tools/dockcross-cmake-builder.sh diff --git a/.github/workflows/dockcross.yml b/.github/workflows/dockcross.yml index 465869d8..a0606b96 100644 --- a/.github/workflows/dockcross.yml +++ b/.github/workflows/dockcross.yml @@ -68,21 +68,5 @@ jobs: with: submodules: "recursive" fetch-depth: 0 - - name: "Pull ${{ matrix.image_name }}..." - run: docker pull dockcross/${{ matrix.image_name }} - - name: "Make script" - run: | - docker run --rm dockcross/${{ matrix.image_name }} > ./dockcross-${{ matrix.image_name }} - chmod +x ./dockcross-${{ matrix.image_name }} - - name: "Make script" - run: | - ls - pwd - - name: "Config CMakefile" - run: ./dockcross-${{ matrix.image_name }} cmake -B dockcross-${{ matrix.image_name }} -S . -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} - - name: "Build" - run: ./dockcross-${{ matrix.image_name }} ninja -C dockcross-${{ matrix.image_name }} - - name: "Test" - run: | - cd dockcross-${{ matrix.image_name }} - ./dockcross-${{ matrix.image_name }} ctest --build-config ${{ matrix.build_type }} + - name: "build" + run: ./tools/dockcross-cmake-builder.sh ${{ matrix.image_name }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} diff --git a/tools/dockcross-cmake-builder.sh b/tools/dockcross-cmake-builder.sh new file mode 100755 index 00000000..c96b5988 --- /dev/null +++ b/tools/dockcross-cmake-builder.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +if (( $# >= 1 )); then + image=$1 + build_file=build-${image%:*} + shift 1 + + cmake_arg=$@ + echo "cmake arg: $cmake_arg" + + #echo "Pulling dockcross/$image" + #docker pull dockcross/"$image" + + echo "Make script dockcross-$image" + docker run --rm dockcross/"$image" > ./dockcross-"$image" + chmod +x ./dockcross-"$image" + + echo "Build $build_file" + ./dockcross-"$image" cmake -B "$build_file" -S . -G Ninja $cmake_arg + ./dockcross-"$image" ninja -C "$build_file" +else + echo "Usage: ${0##*/} " + exit 1 +fi