From 96103dba5ba64d847a4f3f289a519184424ec454 Mon Sep 17 00:00:00 2001 From: Timofey Traynenkov Date: Wed, 20 Sep 2023 16:16:39 +0400 Subject: [PATCH] Rework setup browser in workflows (#25620) (#25627) --- .github/actions/run-qunit-tests/action.yml | 33 ++++++++++++------- .../{pin-browsers => setup-chrome}/action.yml | 30 +++++++---------- .github/workflows/devextreme_npm_tests.yml | 10 ++++-- .github/workflows/testcafe_tests.yml | 5 ++- 4 files changed, 45 insertions(+), 33 deletions(-) rename .github/actions/{pin-browsers => setup-chrome}/action.yml (54%) diff --git a/.github/actions/run-qunit-tests/action.yml b/.github/actions/run-qunit-tests/action.yml index bd818e1a6650..73679634d3cd 100644 --- a/.github/actions/run-qunit-tests/action.yml +++ b/.github/actions/run-qunit-tests/action.yml @@ -42,7 +42,22 @@ runs: echo "MATRIX_ENVS_NAME_SAFE=$MATRIX_ENVS_NAME_SAFE" echo "MATRIX_ENVS_NAME_SAFE=$MATRIX_ENVS_NAME_SAFE" >> $GITHUB_ENV - - name: Setup firefox profile +# - name: Update apt +# run: | +# sudo apt-get update + +# - name: Setup utils +# run: | +# sudo apt-get install -y dbus-x11 httping x11vnc xvfb + + - name: Setup Chrome + if: ${{ inputs.browser == 'chrome' }} + uses: ./.github/actions/setup-chrome + with: + chrome-version: '116.0.5845.110' + + - name: Setup Firefox profile + if: ${{ inputs.browser == 'firefox' }} shell: bash run: | mkdir -p /tmp/firefox-profile @@ -53,16 +68,12 @@ runs: '"font.name-list.sans-serif.x-western", "Liberation Sans"' \ '"font.name-list.serif.x-western", "Liberation Serif"' ; do echo "user_pref($p);" >> /tmp/firefox-profile/prefs.js; done -# - name: Update apt -# run: | -# sudo apt-get update - -# - name: Setup utils -# run: | -# sudo apt-get install -y dbus-x11 httping x11vnc xvfb - - - name: Pin browsers - uses: ./.github/actions/pin-browsers + - name: Setup Firefox + if: ${{ inputs.browser == 'firefox' }} + id: setup-firefox + uses: browser-actions/setup-firefox@v1 + with: + firefox-version: '116.0.3' - name: Use Node.js uses: actions/setup-node@v3 diff --git a/.github/actions/pin-browsers/action.yml b/.github/actions/setup-chrome/action.yml similarity index 54% rename from .github/actions/pin-browsers/action.yml rename to .github/actions/setup-chrome/action.yml index 138550561131..f6272e475988 100644 --- a/.github/actions/pin-browsers/action.yml +++ b/.github/actions/setup-chrome/action.yml @@ -1,46 +1,38 @@ -name: "Pin Browsers" -description: "Install and setup Chrome and Firefox" +name: Pin Browsers +description: Install and setup Chrome and Firefox # List of browser versions -# Chrome: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable -# Firefox: https://www.ubuntuupdates.org/package/ubuntu_mozilla_security/focal/main/base/firefox +# Chrome (ubuntu): https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable +# Chrome versions: https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions inputs: chrome-version: - description: "Chrome version to install" - default: "116.0.5845.110-1" - firefox-version: - description: "Firefox version to install" + description: Chrome version to install default: "latest" runs: using: composite steps: - - name: "Setup latest Chrome" + - name: Setup latest Chrome if: ${{ inputs.chrome-version == 'latest' }} uses: browser-actions/setup-chrome@v1 with: chrome-version: ${{ inputs.chrome-version }} - - name: "Print latest Chrome version" - shell: bash + - name: Print latest Chrome version if: ${{ inputs.chrome-version == 'latest' }} - run: google-chrome-stable --version - - name: "Setup Chrome with specific version" shell: bash + run: google-chrome-stable --version + - name: Setup Chrome with specific version if: ${{ inputs.chrome-version != 'latest' }} + shell: bash env: CHROME_VERSION: ${{ inputs.chrome-version }} run: | if [ -n "$CHROME_VERSION" ]; then - curl -L "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb" > /tmp/chrome.deb + curl -L "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb" > /tmp/chrome.deb sudo dpkg -i /tmp/chrome.deb unlink /tmp/chrome.deb google-chrome-stable --version else echo "Skip Chrome upgrade" fi - - name: "Setup Firefox" - id: setup-firefox - uses: browser-actions/setup-firefox@v1 - with: - firefox-version: ${{ inputs.firefox-version }} diff --git a/.github/workflows/devextreme_npm_tests.yml b/.github/workflows/devextreme_npm_tests.yml index 316cccd0c832..866ba9267d68 100644 --- a/.github/workflows/devextreme_npm_tests.yml +++ b/.github/workflows/devextreme_npm_tests.yml @@ -78,7 +78,10 @@ jobs: - name: Get sources uses: actions/checkout@v4 - - uses: ./.github/actions/pin-browsers + - name: Setup Chrome + uses: ./.github/actions/setup-chrome + with: + chrome-version: '116.0.5845.110' - name: Create directory link run: cd ../ && ln -s DevExtreme devextreme @@ -214,7 +217,10 @@ jobs: - name: Get sources uses: actions/checkout@v4 - - uses: ./.github/actions/pin-browsers + - name: Setup Chrome + uses: ./.github/actions/setup-chrome + with: + chrome-version: '116.0.5845.110' - name: Use Node.js uses: actions/setup-node@v3 diff --git a/.github/workflows/testcafe_tests.yml b/.github/workflows/testcafe_tests.yml index f07b5413e6b2..cfde13a9971d 100644 --- a/.github/workflows/testcafe_tests.yml +++ b/.github/workflows/testcafe_tests.yml @@ -88,7 +88,10 @@ jobs: - name: Get sources uses: actions/checkout@v4 - - uses: ./.github/actions/pin-browsers + - name: Setup Chrome + uses: ./.github/actions/setup-chrome + with: + chrome-version: '116.0.5845.110' - name: Use Node.js uses: actions/setup-node@v3