From cae571b67a64686673284d2900510a5ad931195a Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Fri, 26 Jan 2024 11:03:10 +0100 Subject: [PATCH] try out GHA --- .../checkoutAndInstallLibs.steps.yml | 10 +++ .../checkoutAndInstallLibs.web.steps.yml | 13 ++++ .github/commonSteps/playwright.steps.yml | 10 +++ .github/workflows/appiumV2.yml | 32 +++++++++ .github/workflows/appiumV2_Android.yml | 58 ----------------- .github/workflows/appiumV2_iOS.yml | 58 ----------------- .github/workflows/doc-generation.yml | 14 +--- .github/workflows/dtslint.yml | 17 ++--- .github/workflows/expectHelper.yml | 15 ++--- .github/workflows/playwright.yml | 65 ++++++++++--------- .github/workflows/puppeteer.yml | 2 +- .github/workflows/testcafe.yml | 2 +- .github/workflows/webdriver.yml | 2 +- 13 files changed, 115 insertions(+), 183 deletions(-) create mode 100644 .github/commonSteps/checkoutAndInstallLibs.steps.yml create mode 100644 .github/commonSteps/checkoutAndInstallLibs.web.steps.yml create mode 100644 .github/commonSteps/playwright.steps.yml create mode 100644 .github/workflows/appiumV2.yml delete mode 100644 .github/workflows/appiumV2_Android.yml delete mode 100644 .github/workflows/appiumV2_iOS.yml diff --git a/.github/commonSteps/checkoutAndInstallLibs.steps.yml b/.github/commonSteps/checkoutAndInstallLibs.steps.yml new file mode 100644 index 000000000..72df7a401 --- /dev/null +++ b/.github/commonSteps/checkoutAndInstallLibs.steps.yml @@ -0,0 +1,10 @@ +steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install --legacy-peer-deps + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true diff --git a/.github/commonSteps/checkoutAndInstallLibs.web.steps.yml b/.github/commonSteps/checkoutAndInstallLibs.web.steps.yml new file mode 100644 index 000000000..5da48ef76 --- /dev/null +++ b/.github/commonSteps/checkoutAndInstallLibs.web.steps.yml @@ -0,0 +1,13 @@ +steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + - run: npm install --legacy-peer-deps + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true diff --git a/.github/commonSteps/playwright.steps.yml b/.github/commonSteps/playwright.steps.yml new file mode 100644 index 000000000..b27065272 --- /dev/null +++ b/.github/commonSteps/playwright.steps.yml @@ -0,0 +1,10 @@ +steps: + - name: npm install + run: | + npm install --legacy-peer-deps + env: + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + - name: Install browsers and deps + run: npx playwright install && npx playwright install-deps + - name: start a server + run: "php -S 127.0.0.1:8000 -t test/data/app &" diff --git a/.github/workflows/appiumV2.yml b/.github/workflows/appiumV2.yml new file mode 100644 index 000000000..282616c25 --- /dev/null +++ b/.github/workflows/appiumV2.yml @@ -0,0 +1,32 @@ +name: Appium V2 Tests + +on: + push: + branches: + - 3.x + - consolidate-test-env-in-gha + +env: + CI: true + # Force terminal colors. @see https://www.npmjs.com/package/colors + FORCE_COLOR: 1 + NODE_VERSION: 20.x + PLATFORM: ubuntu-22.04 + SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} + SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} + +jobs: + AppiumTests: + runs-on: $PLATFORM + + strategy: + matrix: + node-version: [$NODE_VERSION] + test-suite: ['appium-quick', 'appium-other', 'ios:appium-quick', 'ios:appium-other'] + + steps: + - name: Appium common steps + uses: ./.github/commonSteps/checkoutAndInstallLibs.steps.yml + + - name: Run Appium Tests + run: npm run test:${{ matrix.test-suite }} diff --git a/.github/workflows/appiumV2_Android.yml b/.github/workflows/appiumV2_Android.yml deleted file mode 100644 index 2fa1098c4..000000000 --- a/.github/workflows/appiumV2_Android.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Appium V2 Tests - Android - -on: - push: - branches: - - 3.x - -env: - CI: true - # Force terminal colors. @see https://www.npmjs.com/package/colors - FORCE_COLOR: 1 - -jobs: - appium1: - runs-on: ubuntu-22.04 - - strategy: - matrix: - node-version: [18.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm install --legacy-peer-deps - env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - - run: 'npm run test:appium-quick' - env: # Or as an environment variable - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} - - - appium2: - - runs-on: ubuntu-22.04 - - strategy: - matrix: - node-version: [18.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm install --legacy-peer-deps - env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - - run: 'npm run test:appium-other' - env: # Or as an environment variable - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} diff --git a/.github/workflows/appiumV2_iOS.yml b/.github/workflows/appiumV2_iOS.yml deleted file mode 100644 index 6c9f46549..000000000 --- a/.github/workflows/appiumV2_iOS.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Appium V2 Tests - iOS - -on: - push: - branches: - - 3.x - -env: - CI: true - # Force terminal colors. @see https://www.npmjs.com/package/colors - FORCE_COLOR: 1 - -jobs: - appium1: - runs-on: ubuntu-22.04 - - strategy: - matrix: - node-version: [18.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm install --legacy-peer-deps - env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - - run: 'npm run test:ios:appium-quick' - env: # Or as an environment variable - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} - - - appium2: - - runs-on: ubuntu-22.04 - - strategy: - matrix: - node-version: [18.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm install --legacy-peer-deps - env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - - run: 'npm run test:ios:appium-other' - env: # Or as an environment variable - SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} - SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} diff --git a/.github/workflows/doc-generation.yml b/.github/workflows/doc-generation.yml index 9558129a2..bae727cf9 100644 --- a/.github/workflows/doc-generation.yml +++ b/.github/workflows/doc-generation.yml @@ -11,19 +11,11 @@ jobs: strategy: matrix: - node-version: [ 18.x ] + node-version: [ 20.x ] steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Install Dependencies - run: npm install --legacy-peer-deps + - name: Checkout and install dependencies steps + uses: ./.github/commonSteps/checkoutAndInstallLibs.steps.yml - name: Configure git user run: | diff --git a/.github/workflows/dtslint.yml b/.github/workflows/dtslint.yml index a865211a6..7ecee227b 100644 --- a/.github/workflows/dtslint.yml +++ b/.github/workflows/dtslint.yml @@ -13,16 +13,9 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - node-version: [18.x] + node-version: [20.x] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm install --legacy-peer-deps - env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - - run: npm run def - - run: npm run dtslint + - name: Checkout and install dependencies steps + uses: ./.github/commonSteps/checkoutAndInstallLibs.steps.yml + + - run: npm run def && npm run dtslint diff --git a/.github/workflows/expectHelper.yml b/.github/workflows/expectHelper.yml index 6a28a69f7..225980174 100644 --- a/.github/workflows/expectHelper.yml +++ b/.github/workflows/expectHelper.yml @@ -14,21 +14,16 @@ env: FORCE_COLOR: 1 jobs: - build: - + expect-helper-test: runs-on: ubuntu-22.04 strategy: matrix: - node-version: [18.x] + node-version: [20.x] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: npm install - run: npm i --legacy-peer-deps + - name: Checkout and install dependencies steps + uses: ./.github/commonSteps/checkoutAndInstallLibs.steps.yml + - name: run unit tests run: ./node_modules/.bin/mocha test/helper/Expect_test.js --timeout 5000 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ed5aa4c47..c0d52efd7 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -12,43 +12,46 @@ env: CI: true # Force terminal colors. @see https://www.npmjs.com/package/colors FORCE_COLOR: 1 + NODE_VERSION: 20.x + PLATFORM: ubuntu-22.04 jobs: - build: - - runs-on: ubuntu-22.04 + run-unit-tests: + runs-on: $PLATFORM strategy: matrix: - node-version: [18.x, 20.x] + node-version: [$NODE_VERSION] + browser-restart: ['browser', 'session'] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - - name: npm install - run: | - npm install --legacy-peer-deps - env: - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true - - name: Install browsers and deps - run: npx playwright install && npx playwright install-deps - - name: start a server - run: "php -S 127.0.0.1:8000 -t test/data/app &" - - name: run chromium tests - run: "./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug" - - name: run chromium with restart==browser tests - run: "BROWSER_RESTART=browser ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug" - - name: run chromium with restart==session tests - run: "BROWSER_RESTART=session ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug" - - name: run firefox tests - run: "BROWSER=firefox node ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug" - - name: run webkit tests - run: "BROWSER=webkit node ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug" + - name: Checkout and install dependencies steps + uses: ./.github/commonSteps/checkoutAndInstallLibs.steps.yml + + - name: Playwright common steps + uses: ./.github/commonSteps/playwright.steps.yml + - name: run chromium unit tests run: ./node_modules/.bin/mocha test/helper/Playwright_test.js --timeout 5000 + + run-acceptance-tests: + runs-on: $PLATFORM + + strategy: + matrix: + node-version: [ $NODE_VERSION ] + browser-restart: [ 'browser', 'session' ] + browser: [ 'chromium', 'firefox', 'webkit' ] + + steps: + - name: Checkout and install dependencies steps + uses: ./.github/commonSteps/checkoutAndInstallLibs.steps.yml + + - name: Playwright common steps + uses: ./.github/commonSteps/playwright.steps.yml + + - name: run ${{ matrix.browser }} tests + run: BROWSER=${{ matrix.browser }} node ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug + - name: run chromium with restart==${{ browser-restart }} tests + run: BROWSER_RESTART=${{ browser-restart }} ./bin/codecept.js run -c test/acceptance/codecept.Playwright.js --grep @Playwright --debug + diff --git a/.github/workflows/puppeteer.yml b/.github/workflows/puppeteer.yml index 025d4fafc..1b6e2cfea 100644 --- a/.github/workflows/puppeteer.yml +++ b/.github/workflows/puppeteer.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - node-version: [18.x] + node-version: [20.x] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/testcafe.yml b/.github/workflows/testcafe.yml index ddeab9ace..b8d958f7b 100644 --- a/.github/workflows/testcafe.yml +++ b/.github/workflows/testcafe.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x] + node-version: [20.x] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/webdriver.yml b/.github/workflows/webdriver.yml index bf7cf31fd..1d06bcb78 100644 --- a/.github/workflows/webdriver.yml +++ b/.github/workflows/webdriver.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node-version: [18.x, 20.x] + node-version: [20.x] steps: - run: docker run -d --net=host --shm-size=2g selenium/standalone-chrome:3.141.0