|
| 1 | +# Copyright 2023 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +name: Test Auth |
| 16 | + |
| 17 | +on: pull_request |
| 18 | + |
| 19 | +env: |
| 20 | + # make chromedriver detect installed Chrome version and download the corresponding driver |
| 21 | + DETECT_CHROMEDRIVER_VERSION: true |
| 22 | + # The default behavior of chromedriver uses the older Chrome download URLs. We need to override |
| 23 | + # the behavior to use the new URLs. |
| 24 | + CHROMEDRIVER_CDNURL: https://googlechromelabs.github.io/ |
| 25 | + CHROMEDRIVER_CDNBINARIESURL: https://storage.googleapis.com/chrome-for-testing-public |
| 26 | + CHROME_VALIDATED_VERSION: linux-120.0.6099.71 |
| 27 | + # Bump Node memory limit |
| 28 | + NODE_OPTIONS: "--max_old_space_size=4096" |
| 29 | + |
| 30 | +jobs: |
| 31 | + test-chrome: |
| 32 | + name: Test Data Connect on Chrome and Node If Changed |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + # install Chrome first, so the correct version of webdriver can be installed by chromedriver |
| 36 | + # when setting up the repo |
| 37 | + # |
| 38 | + # Note: we only need to check the chrome version change in one job as the warning annotation |
| 39 | + # is appended to the entire workflow results, not just this job's results. |
| 40 | + - name: install Chrome stable |
| 41 | + env: |
| 42 | + CHROME_VERSION_MISMATCH_MESSAGE: "The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." |
| 43 | + run: | |
| 44 | + npx @puppeteer/browsers install chrome@stable |
| 45 | + chromeVersionString=$(ls chrome) |
| 46 | + if [ "$CHROME_VALIDATED_VERSION" != "$chromeVersionString" ]; then |
| 47 | + echo "::warning ::The Chrome version doesn't match the previously validated version. Consider updating CHROME_VALIDATED_VERSION in the GitHub workflow if tests pass." |
| 48 | + echo "::warning ::Previously validated version: ${CHROME_VALIDATED_VERSION} vs. Installed version: $chromeVersionString" |
| 49 | + echo "CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE" >> "$GITHUB_ENV" |
| 50 | + fi |
| 51 | + - name: Test Evn TEMP |
| 52 | + run: | |
| 53 | + echo $CHROME_VERSION_NOTES=$CHROME_VERSION_MISMATCH_MESSAGE |
| 54 | + - name: Checkout Repo |
| 55 | + uses: actions/checkout@v4 |
| 56 | + with: |
| 57 | + # This makes Actions fetch all Git history so run-changed script can diff properly. |
| 58 | + fetch-depth: 0 |
| 59 | + - name: Set up Node (20) |
| 60 | + uses: actions/setup-node@v4 |
| 61 | + with: |
| 62 | + node-version: 22.10.0 |
| 63 | + - name: Test setup and yarn install |
| 64 | + run: | |
| 65 | + cp config/ci.config.json config/project.json |
| 66 | + yarn |
| 67 | + - name: build |
| 68 | + run: yarn build:changed data-connect |
| 69 | + - name: Run tests on changed packages |
| 70 | + run: xvfb-run yarn test:changed data-connect |
| 71 | + test-firefox: |
| 72 | + name: Test Data Connect on Firefox If Changed |
| 73 | + |
| 74 | + runs-on: ubuntu-latest |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: install Firefox stable |
| 78 | + run: npx @puppeteer/browsers install firefox@stable |
| 79 | + - name: Checkout Repo |
| 80 | + uses: actions/checkout@v4 |
| 81 | + with: |
| 82 | + # This makes Actions fetch all Git history so run-changed script can diff properly. |
| 83 | + fetch-depth: 0 |
| 84 | + - name: Set up Node (20) |
| 85 | + uses: actions/setup-node@v4 |
| 86 | + with: |
| 87 | + node-version: 22.10.0 |
| 88 | + - name: Test setup and yarn install |
| 89 | + run: | |
| 90 | + cp config/ci.config.json config/project.json |
| 91 | + yarn |
| 92 | + - name: build |
| 93 | + run: yarn build:changed data-connect |
| 94 | + - name: Run tests on data-connect changed packages |
| 95 | + run: xvfb-run yarn test:changed data-connect |
| 96 | + env: |
| 97 | + BROWSERS: 'Firefox' |
| 98 | + |
| 99 | + test-webkit: |
| 100 | + name: Test Data Connect on Webkit if Changed |
| 101 | + runs-on: macos-latest |
| 102 | + |
| 103 | + steps: |
| 104 | + - name: Checkout Repo |
| 105 | + uses: actions/checkout@v4 |
| 106 | + with: |
| 107 | + fetch-depth: 0 |
| 108 | + - name: Set up Node (20) |
| 109 | + uses: actions/setup-node@v3 |
| 110 | + with: |
| 111 | + node-version: 22.10.0 |
| 112 | + - name: Test setup and yarn install |
| 113 | + run: | |
| 114 | + cp config/ci.config.json config/project.json |
| 115 | + yarn |
| 116 | + npx playwright install webkit |
| 117 | + - name: build |
| 118 | + run: yarn build:changed data-connect |
| 119 | + - name: Run tests on changed packages |
| 120 | + run: yarn test:changed data-connect |
| 121 | + env: |
| 122 | + BROWSERS: 'WebkitHeadless' |
0 commit comments