added pkg-config cairo pango libpng jpeg giflib librsvg in workflows #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Screenshot Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| screenshot-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout react-native-gifted-charts | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: npm | |
| - name: Setup Python for node-gyp | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies (gifted-charts) | |
| run: rm -rf node_modules package-lock.json && npm install --legacy-peer-deps | |
| - name: Build react-native-gifted-charts | |
| run: npm run build | |
| - name: Pack local library | |
| run: npm pack | |
| - name: Checkout TestingCharts repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Abhinandan-Kushwaha/TestingCharts | |
| path: TestingCharts | |
| - name: Create branch from PR name | |
| run: | | |
| cd TestingCharts | |
| BRANCH_NAME="${{ github.event.pull_request.title }}" | |
| BRANCH_NAME=$(echo "$BRANCH_NAME" | tr ' ' '-' | tr -cd '[:alnum:]-_') | |
| git fetch origin pre-merge | |
| git checkout pre-merge | |
| git pull origin pre-merge | |
| git checkout -b "$BRANCH_NAME" | |
| echo "Using branch: $BRANCH_NAME" | |
| - name: Install generated package in TestingCharts | |
| run: | | |
| cd TestingCharts | |
| npm install ../*.tgz | |
| - name: Install canvas system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| pkg-config \ | |
| libcairo2-dev \ | |
| libpango1.0-dev \ | |
| libjpeg-dev \ | |
| libpng-dev \ | |
| libgif-dev \ | |
| librsvg2-dev | |
| echo "npm_config_python=$(which python3)" >> "$GITHUB_ENV" | |
| - name: Verify pkg-config | |
| run: | | |
| pkg-config --modversion pango | |
| pkg-config --modversion cairo | |
| pkg-config --libs pangocairo | |
| - name: Install dependencies (TestingCharts) | |
| run: | | |
| cd TestingCharts | |
| echo "Using PKG_CONFIG_PATH=$PKG_CONFIG_PATH" | |
| npm install | |
| - name: Enable user namespaces for Puppeteer sandbox | |
| run: | | |
| sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 || true | |
| sudo sysctl -w kernel.unprivileged_userns_clone=1 || true | |
| sysctl kernel.apparmor_restrict_unprivileged_userns || true | |
| sysctl kernel.unprivileged_userns_clone || true | |
| - name: Start TestingCharts web server (port 8081) | |
| run: | | |
| cd TestingCharts | |
| nohup npm start -- --port 8081 > /tmp/testingcharts-web.log 2>&1 & | |
| for i in {1..90}; do | |
| if curl -fsS http://127.0.0.1:8081 > /dev/null; then | |
| echo "TestingCharts web server is up on :8081" | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "TestingCharts web server did not start in time" | |
| cat /tmp/testingcharts-web.log || true | |
| exit 1 | |
| - name: Start screenshot tests in background | |
| run: | | |
| cd TestingCharts | |
| nohup npm run ss-test > /tmp/ss-test.log 2>&1 & | |
| echo "SS_TEST_PID=$!" >> "$GITHUB_ENV" | |
| # Android emulator boot step | |
| - name: Run Android app on emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 34 | |
| arch: x86_64 | |
| profile: pixel_6 | |
| disable-animations: true | |
| emulator-options: -no-snapshot -no-window -noaudio -no-boot-anim -gpu swiftshader_indirect -camera-back none -camera-front none | |
| emulator-boot-timeout: 1200 | |
| script: | | |
| adb kill-server || true | |
| adb start-server | |
| adb devices | |
| adb reconnect offline || true | |
| adb wait-for-device | |
| adb shell getprop sys.boot_completed | |
| cd TestingCharts | |
| npm run android -- --no-packager | |
| - name: Wait for screenshot tests to complete | |
| run: | | |
| if [ -z "$SS_TEST_PID" ]; then | |
| echo "SS_TEST_PID is not set" | |
| exit 1 | |
| fi | |
| timeout 25m bash -c 'while kill -0 "$SS_TEST_PID" 2>/dev/null; do sleep 5; done' | |
| wait "$SS_TEST_PID" || { | |
| echo "Screenshot tests failed. Logs:" | |
| tail -n 200 /tmp/ss-test.log || true | |
| exit 1 | |
| } | |
| echo "Screenshot tests completed successfully" |