From 5b8999e417d8cc6e8c5bf9129c470390bfea99a0 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 13 Sep 2023 11:06:07 +0900 Subject: [PATCH] infra: updated gitaction CI build test with MacOS @Issue: https://github.com/thorvg/thorvg/issues/1433 --- .github/workflows/actions_cpplint.yml | 34 --------- .github/workflows/build_macos.yml | 71 ++++++++++++++++++ .../{build_linux.yml => build_ubuntu.yml} | 36 ++------- .github/workflows/build_win.yml | 29 -------- .github/workflows/build_windows.yml | 73 +++++++++++++++++++ .github/workflows/cpp_lint_check.sh | 66 ----------------- .github/workflows/regression.yml | 2 +- README.md | 5 +- 8 files changed, 156 insertions(+), 160 deletions(-) delete mode 100644 .github/workflows/actions_cpplint.yml create mode 100644 .github/workflows/build_macos.yml rename .github/workflows/{build_linux.yml => build_ubuntu.yml} (74%) delete mode 100644 .github/workflows/build_win.yml create mode 100644 .github/workflows/build_windows.yml delete mode 100644 .github/workflows/cpp_lint_check.sh diff --git a/.github/workflows/actions_cpplint.yml b/.github/workflows/actions_cpplint.yml deleted file mode 100644 index de8381c5..00000000 --- a/.github/workflows/actions_cpplint.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Check Commit - -on: - pull_request: - branches: - - main - -jobs: - coding-style: - if: ${{ false }} # disable for now - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Install Packages - run: | - sudo apt-get update - sudo apt-get install curl - sudo apt-get install cmake jq clang - sudo apt-get install software-properties-common - sudo apt-get install python3-pip - pip3 install wheel --user - pip3 install cpplint --user - - - name: Run Cpplint Script - run: | - export PATH=$PATH:~/.local/bin/ - chmod +x "${GITHUB_WORKSPACE}/.github/workflows/cpp_lint_check.sh" - "${GITHUB_WORKSPACE}/.github/workflows/cpp_lint_check.sh" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml new file mode 100644 index 00000000..0626c09d --- /dev/null +++ b/.github/workflows/build_macos.yml @@ -0,0 +1,71 @@ +name: MacOS + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Packages + run: | + export HOMEBREW_NO_INSTALL_FROM_API=1 + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + brew update + brew install meson efl + brew upgrade + + - name: Build + run: | + meson . build -Dlog=true -Dexamples=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" + ninja -C build install + + static_loaders: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Packages + run: | + brew update + brew install meson + brew upgrade + + - name: Build + run: | + meson . build -Dlog=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" -Dstatic=true + ninja -C build install + + unit_test: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Packages + run: | + brew update + brew install meson + brew upgrade + + - name: Build + run: | + meson . build -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtests=true --errorlogs + ninja -C build install test + + - uses: actions/upload-artifact@v3 + with: + name: UnitTestReport + path: build/meson-logs/testlog.txt diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_ubuntu.yml similarity index 74% rename from .github/workflows/build_linux.yml rename to .github/workflows/build_ubuntu.yml index 2b13fe23..edcdcaa1 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_ubuntu.yml @@ -1,4 +1,4 @@ -name: Linux +name: Ubuntu on: pull_request: @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: @@ -19,18 +19,19 @@ jobs: - name: Install Packages run: | sudo apt-get update - sudo apt-get install ninja-build gcc-multilib g++-multilib + sudo apt-get install ninja-build gcc-multilib g++-multilib libunwind-dev + sudo apt-get install libefl-all-dev sudo apt-get install python3-pip sudo apt-get install libturbojpeg0-dev libpng-dev libwebp-dev sudo pip3 install meson - name: Build run: | - meson . build -Dlog=true -Dloaders="all, webp_beta" -Dsavers="all" -Dbindings="capi" -Dtools="all" + meson . build -Dlog=true -Dexamples=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" sudo ninja -C build install static_loaders: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: @@ -48,29 +49,8 @@ jobs: meson . build -Dlog=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" -Dstatic=true sudo ninja -C build install - examples: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Install Packages - run: | - sudo apt-get update - sudo apt-get install ninja-build gcc-multilib g++-multilib - sudo apt-get install libefl-all-dev - sudo apt-get install python3-pip - sudo apt-get install libturbojpeg0-dev libpng-dev libwebp-dev - sudo pip3 install meson - - - name: Build - run: | - meson . build -Dexamples=true -Dloaders="all, webp_beta" -Dsavers="all" -Dbindings="capi" - sudo ninja -C build install - unit_test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: @@ -88,7 +68,7 @@ jobs: - name: Build run: | - meson . build -Dtests=true -Dloaders="all, webp_beta" -Dsavers="all" -Dbindings="capi" --errorlogs + meson . build -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtests=true --errorlogs sudo ninja -C build install test - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/build_win.yml b/.github/workflows/build_win.yml deleted file mode 100644 index 436896b6..00000000 --- a/.github/workflows/build_win.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Windows - -on: - pull_request: - branches: - - main - push: - branches: - - main - -jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: ilammy/msvc-dev-cmd@v1 - - name: Install Packages - run: | - pip install meson==0.58.0 ninja - - name: Build - run: | - meson --backend=ninja build -Dlog=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" - where link - ninja -C build install - - - uses: actions/upload-artifact@v3 - with: - name: result - path: build/src\thorvg* diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml new file mode 100644 index 00000000..0fc5d7e8 --- /dev/null +++ b/.github/workflows/build_windows.yml @@ -0,0 +1,73 @@ +name: Windows + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Install Packages + run: | + pip install meson==0.58.0 ninja + + - name: Build + run: | + meson --backend=ninja build -Dlog=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" + where link + ninja -C build install + + - uses: actions/upload-artifact@v3 + with: + name: result + path: build/src/thorvg* + + static_loaders: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Install Packages + run: | + pip install meson==0.58.0 ninja + + - name: Build + run: | + meson --backend=ninja build -Dlog=true -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtools="all" -Dstatic=true + where link + ninja -C build install + + - uses: actions/upload-artifact@v3 + with: + name: result + path: build/src/thorvg* + + unit_test: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Install Packages + run: | + pip install meson==0.58.0 ninja + + - name: Build + run: | + meson --backend=ninja build -Dloaders="all" -Dsavers="all" -Dbindings="capi" -Dtests=true --errorlogs + where link + ninja -C build install test + + - uses: actions/upload-artifact@v3 + with: + name: UnitTestReport + path: build/meson-logs/testlog.txt \ No newline at end of file diff --git a/.github/workflows/cpp_lint_check.sh b/.github/workflows/cpp_lint_check.sh deleted file mode 100644 index a78455aa..00000000 --- a/.github/workflows/cpp_lint_check.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -if [[ -z "$GITHUB_TOKEN" ]]; then - echo "The GITHUB_TOKEN is required." - exit 1 -fi - -FILES_LINK=`jq -r '.pull_request._links.self.href' "$GITHUB_EVENT_PATH"`/files -echo "Files = $FILES_LINK" - -curl $FILES_LINK > files.json -FILES_URLS_STRING=`jq -r '.[].raw_url' files.json` - -readarray -t URLS <<<"$FILES_URLS_STRING" - -echo "File names: $URLS" - -mkdir files -cd files -for i in "${URLS[@]}" -do - echo "Downloading $i" - curl -LOk --remote-name $i -done - -echo "Files downloaded!" -echo "Performing checkup:" - -cpplint --filter=-,\ -+whitespace/parens,\ -+whitespace/indent,\ -+whitespace/end_of_line,\ -+whitespace/blank_line \ ---extension=cpp,h,c \ ---recursive \ -./ > cpp-report.txt 2>&1 - -PAYLOAD_CPPLINT=`cat cpp-report.txt` -COMMENTS_URL=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.comments_url) - -echo $COMMENTS_URL -echo "Cppcheck errors:" -echo $PAYLOAD_CPPLINT - -if [[ $PAYLOAD_CPPLINT == *"Total errors found: "* ]]; then - OUTPUT+=$'\n**CODING STYLE CHECK**:\n' - OUTPUT+=$'\n```\n' - OUTPUT+="$PAYLOAD_CPPLINT" - OUTPUT+=$'\n```\n' -fi - -curl $COMMENTS_URL > comments.json -EXIST_COMMENTS=`jq -r '.[] | select(.body | contains("*CODING STYLE CHECK*")) | .id' comments.json` -echo $EXIST_COMMENTS -for exist_comment in $EXIST_COMMENTS -do - echo "---------------------" - echo $exist_comment - COMMENT_URL="https://api.github.com/repos/Samsung/thorvg/issues/comments/""$exist_comment" - curl -X "DELETE" -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/vnd.github.VERSION.text+json" "$COMMENT_URL" - echo "==================" -done - -PAYLOAD=$(echo '{}' | jq --arg body "$OUTPUT" '.body = $body') - -curl -s -S -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/vnd.github.VERSION.text+json" --data "$PAYLOAD" "$COMMENTS_URL" diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 889cdc55..2cf46702 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -1,4 +1,4 @@ -name: Regression Testing +name: Regression on: pull_request: diff --git a/README.md b/README.md index c6f3d004..77d52228 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ [![Discord](https://img.shields.io/badge/Community-5865f2?style=flat&logo=discord&logoColor=white)](https://discord.gg/n25xj6J6HM)
[![CodeFactor](https://www.codefactor.io/repository/github/hermet/thorvg/badge)](https://www.codefactor.io/repository/github/hermet/thorvg) -[![Build Linux](https://github.com/thorvg/thorvg/actions/workflows/build_linux.yml/badge.svg?branch=main&event=push)](https://github.com/thorvg/thorvg/actions/workflows/actions.yml) -[![Build Windows](https://github.com/thorvg/thorvg/actions/workflows/build_win.yml/badge.svg?branch=main&event=push)](https://github.com/thorvg/thorvg/actions/workflows/build_win.yml) +[![Build Ubuntu](https://github.com/thorvg/thorvg/actions/workflows/build_ubuntu.yml/badge.svg?branch=main&event=push)](https://github.com/thorvg/thorvg/actions/workflows/build_ubuntu.yml) +[![Build Windows](https://github.com/thorvg/thorvg/actions/workflows/build_windows.yml/badge.svg?branch=main&event=push)](https://github.com/thorvg/thorvg/actions/workflows/build_windows.yml) +[![Build MacOS](https://github.com/thorvg/thorvg/actions/workflows/build_macos.yml/badge.svg?branch=main&event=push)](https://github.com/thorvg/thorvg/actions/workflows/build_macos.yml) # ThorVG