Skip to content

Fix Error problem and enhanced the error message logic (#3163) #1440

Fix Error problem and enhanced the error message logic (#3163)

Fix Error problem and enhanced the error message logic (#3163) #1440

Workflow file for this run

name: build
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
jobs:
ios:
runs-on: macos-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: |
third_party
key: third-party-ios-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-ios-
- uses: tecolicom/actions-use-homebrew-tools@v1
with:
tools: ninja yasm
- name: Install Build Tools
run: |
chmod +x install_tools.sh
./install_tools.sh
shell: bash
- name: Run depsync
run: |
npm install depsync -g
depsync
shell: bash
- name: Build iOS
run: |
mkdir -p third_party/tgfx/out/cache
cd ios
node gen_ios
xcodebuild -workspace PAGViewer.xcworkspace -scheme PAGViewer -configuration Release -sdk iphoneos -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
third_party
key: third-party-ios-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ios_build
path: ios
android:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: |
third_party
key: third-party-android-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-android-
- name: Run depsync
run: |
npm install depsync -g
depsync
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Build Android
run: |
mkdir -p third_party/tgfx/out/cache
cd android
./gradlew assembleRelease -Parm64-only --no-daemon
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
third_party
key: third-party-android-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: android_build
path: android
web:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get emsdk Cache
id: emsdk-cache
uses: actions/cache/restore@v4
with:
path: web/emsdk
key: emsdk-web-linux-20251212
restore-keys: emsdk-web-linux-
- name: Get node_modules Cache
id: node-cache
uses: actions/cache/restore@v4
with:
path: |
web/node_modules
web/package-lock.json
key: node-modules-web-linux-${{ hashFiles('web/package.json') }}
restore-keys: node-modules-web-linux-
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: |
third_party
key: third-party-web-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-web-
- name: Install emsdk
if: ${{ (steps.emsdk-cache.outputs.cache-hit != 'true') }}
run: |
cd web
if [ ! -d "emsdk" ]; then
git clone https://github.com/emscripten-core/emsdk.git
else
cd emsdk
git pull
cd ..
fi
cd emsdk
./emsdk install 3.1.71
./emsdk activate 3.1.71
- name: Install node_modules
if: ${{ (steps.node-cache.outputs.cache-hit != 'true') }}
run: |
cd web
npm install
- name: Run depsync
run: |
npm install depsync -g
depsync
- name: Build Web
run: |
cd web
source emsdk/emsdk_env.sh
npm run build:st
- name: Cypress run:st
uses: cypress-io/github-action@v6
with:
working-directory: web
start: npm run server:cypress
wait-on: 'http://localhost:8080'
command: npm run cypress
- name: Save emsdk Cache
if: ${{ (github.event_name == 'push') && (steps.emsdk-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: web/emsdk
key: emsdk-web-linux-20251212
- name: Save node_modules Cache
if: ${{ (github.event_name == 'push') && (steps.node-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
web/node_modules
web/package-lock.json
key: node-modules-web-linux-${{ hashFiles('web/package.json') }}
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
third_party
key: third-party-web-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: web_build
path: |
web
!web/emsdk
!web/node_modules
win:
runs-on: windows-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: |
third_party
key: third-party-windows-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-windows-
- name: Run depsync
run: |
npm install depsync -g
depsync
shell: bash
- name: Build Windows
run: |
New-Item -ItemType Directory -Force -Path third_party/tgfx/out/cache
node third_party/vendor_tools/ms-build -a x64 win/Win32Demo.sln
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
third_party
key: third-party-windows-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: win_build
path: out
linux:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: |
third_party
key: third-party-linux-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-linux-
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Run depsync
run: |
npm install depsync -g
depsync
shell: bash
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libx11-dev
version: 1.0
- name: Build Linux
run: |
mkdir -p third_party/tgfx/out/cache
cd linux
./build_pag.sh
cmake -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build -- -j 12
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
third_party
key: third-party-linux-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: linux_build
path: linux
qt:
runs-on: macos-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: |
third_party
key: third-party-qt-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-qt-
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Run depsync
run: |
npm install depsync -g
depsync
shell: bash
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
host: 'mac'
target: 'desktop'
version: '6.8.3'
dir: '${{github.workspace}}/qt/'
install-deps: 'true'
aqtversion: '==3.2.1'
cache: 'true'
cache-key-prefix: 'install-qt-action'
modules: 'qtmultimedia'
- name: Setup ccache
run: |
brew install ccache
ccache --max-size=2G
ccache --zero-stats
- name: Restore ccache
uses: actions/cache/restore@v4
with:
path: ~/Library/Caches/ccache
key: ccache-qt-${{ runner.os }}-main
restore-keys: |
ccache-qt-${{ runner.os }}-
- name: Build QT
run: |
mkdir -p third_party/tgfx/out/cache
export PATH="/opt/homebrew/opt/ccache/libexec:$PATH"
export CMAKE_C_COMPILER_LAUNCHER=ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
node build_pag -s ./viewer PAGViewer -DCMAKE_PREFIX_PATH="${{env.QT_ROOT_DIR}}/lib/cmake" -o ./out/release/viewer -a x64
- name: Save ccache
if: ${{ github.event_name == 'push' }}
uses: actions/cache/save@v4
with:
path: ~/Library/Caches/ccache
key: ccache-qt-${{ runner.os }}-main
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: |
third_party
key: third-party-qt-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: qt_build
path: out
ohos:
runs-on: macos-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Get CLI Tools Cache
id: cli-tools-cache
uses: actions/cache/restore@v4
with:
path: /opt/ohos-cmd-tools
key: ohos-cli-6.0.0.868-mac-arm64-x64
restore-keys: ohos-cli-
- name: Install CLI Tools
if: steps.cli-tools-cache.outputs.cache-hit != 'true'
run: |
TOOLS_URL="https://github.com/libpag/ohos-sdk/releases/download/6.0.0.868/commandline-tools-mac-arm64-6.0.0.868.zip"
curl -L -o /tmp/cmdtools.zip "$TOOLS_URL"
unzip -q /tmp/cmdtools.zip -d /tmp
sudo mv /tmp/command-line-tools /opt/ohos-cmd-tools
- name: Save CLI Tools Cache
if: ${{ (github.event_name == 'push') && (steps.cli-tools-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: /opt/ohos-cmd-tools
key: ohos-cli-6.0.0.868-mac-arm64-x64
- name: Configure Environment
run: |
CLI_DIR=/opt/ohos-cmd-tools
echo "$CLI_DIR/sdk/default/openharmony/toolchains" >> $GITHUB_PATH
echo "$CLI_DIR/ohpm/bin" >> $GITHUB_PATH
echo "$CLI_DIR/hvigor/bin" >> $GITHUB_PATH
echo "DEVECO_SDK_HOME=$CLI_DIR/sdk" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup pnpm
run: |
npm install -g pnpm@8.13.1
echo "$(npm prefix -g)/bin" >> $GITHUB_PATH
- name: Cache hvigor & ohpm
uses: actions/cache@v4
with:
path: |
~/.hvigor
~/.ohpm
ohos/.hvigor
key: hvigor-${{ runner.os }}-${{ hashFiles('**/oh-package.json5', '**/hvigorfile.ts') }}
restore-keys: |
hvigor-${{ runner.os }}-
- name: Get Third-Party Cache
id: third-party-cache
uses: actions/cache/restore@v4
with:
path: third_party
key: third-party-ohos-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third-party-ohos-
- name: Run depsync
run: |
npm install depsync -g
depsync
- name: Install ohpm dependencies
run: |
cd ohos
ohpm config set registry https://ohpm.openharmony.cn/ohpm/
ohpm install --all
- name: Build Harmony
run: |
cd ohos
hvigorw assembleHar --mode module -p module=libpag@default -p product=default --no-daemon
- name: Save Third-Party Cache
if: ${{ (github.event_name == 'push') && (steps.third-party-cache.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: third_party
key: third-party-ohos-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
- name: Job Failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ohos_build
path: ohos/out