Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch from circle ci to github actions #3783

Merged
merged 15 commits into from
Oct 23, 2023
428 changes: 0 additions & 428 deletions .circleci/config.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
BEST_FRONTEND_HOSTNAME: ${{secrets.BEST_FRONTEND_HOSTNAME}}
BEST_HUB_CLIENT_TOKEN: ${{secrets.BEST_HUB_CLIENT_TOKEN}}
BEST_HUB_HOSTNAME: ${{secrets.BEST_HUB_HOSTNAME}}
PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here

jobs:
run-best-performance-tests:
Expand All @@ -27,8 +28,7 @@ jobs:
cache: 'yarn'

- name: Install dependencies
# Puppeteer Chromium download is only needed for @best/runner-local, which is unused here
run: PUPPETEER_SKIP_DOWNLOAD=true yarn install --frozen-lockfile
run: yarn install --frozen-lockfile

- name: Build benchmarks
run: yarn build:performance
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run WebDriverIO integration tests

on:
push:
branches:
- master
- release
- 'spring*'
- 'summer*'
- 'winter*'
pull_request:
branches:
- master
- release
- 'spring*'
- 'summer*'
- 'winter*'

env:
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
SAUCE_TUNNEL_ID: github-action-tunnel-karma-${{github.run_id}}
PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here

jobs:
run-integration-tests:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./packages/@lwc/integration-tests
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.18.0"
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: ./

- uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}

- run: yarn sauce:prod --browsers chrome
- run: yarn sauce:dev --browsers chrome
65 changes: 65 additions & 0 deletions .github/workflows/karma.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Run Karma integration tests

on:
push:
branches:
- master
- release
- 'spring*'
- 'summer*'
- 'winter*'
pull_request:
branches:
- master
- release
- 'spring*'
- 'summer*'
- 'winter*'

env:
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
SAUCE_TUNNEL_ID: github-action-tunnel-integration-${{github.run_id}}
PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here
COVERAGE: "1"

jobs:
run-karma-tests:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./packages/@lwc/integration-karma
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.18.0"
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: ./

- uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelName: ${{ env.SAUCE_TUNNEL_ID }}

- run: yarn sauce:ci
- run: DISABLE_SYNTHETIC=1 yarn sauce:ci
- run: LEGACY_BROWSERS=1 yarn sauce:ci
- run: FORCE_NATIVE_SHADOW_MODE_FOR_TEST=1 yarn sauce:ci
- run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 yarn sauce:ci
- run: ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE=1 DISABLE_SYNTHETIC=1 yarn sauce:ci
- run: API_VERSION=58 yarn sauce:ci
- run: API_VERSION=58 DISABLE_SYNTHETIC=1 yarn sauce:ci
- run: DISABLE_ARIA_REFLECTION_POLYFILL=1 DISABLE_SYNTHETIC=1 yarn sauce:ci
- run: DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER=1 DISABLE_SYNTHETIC=1 yarn sauce:ci
- run: NODE_ENV_FOR_TEST=production yarn sauce:ci
- run: NODE_ENV_FOR_TEST=production DISABLE_SYNTHETIC=1 yarn sauce:ci
- run: yarn hydration:sauce:ci
- run: yarn coverage
55 changes: 55 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run unit tests

on:
push:
branches:
- master
- release
- 'spring*'
- 'summer*'
- 'winter*'
pull_request:
branches:
- master
- release
- 'spring*'
- 'summer*'
- 'winter*'

env:
PUPPETEER_SKIP_DOWNLOAD: "true" # only needed for @best/runner-local, unused here

jobs:
run-unit-tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18.18.0"
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile
Comment on lines +35 to +36
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It takes ~1 min to build to build the repo. Is it worth reusing the NX cache between runs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have run into numerous issues with NX caching recently (something about stale/invalid artifacts), so we actually disabled it in Nucleus runs.

I'm happy to re-enable it at some point, but saving ~60s is not super important to me right now.


- name: Check missing file headers
run: node ./scripts/tasks/check-license-headers.js
- name: Check package.json integrity
run: node ./scripts/tasks/check-and-rewrite-package-json.js --test
- name: Verify @lwc/shared is tree-shakable
run: node ./scripts/tasks/verify-treeshakable.js ./packages/@lwc/shared/dist/index.js
- name: Verify that dependencies are declared
run: node ./scripts/tasks/check-imports-are-declared-dependencies.js
- name: Check formatting
run: yarn prettier --check '{packages,scripts}/**/*.{js,ts,json,md}'
- name: Run linter
run: yarn lint
- name: Check the size of the LWC bundle
run: yarn bundlesize
- name: Run Jest tests
run: yarn test:ci
- name: Run benchmark smoke tests
run: BENCHMARK_SMOKE_TEST=1 yarn test:performance
2 changes: 2 additions & 0 deletions packages/@lwc/integration-karma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"hydration:start": "karma start ./scripts/karma-configs/hydration/local.js",
"hydration:test": "karma start ./scripts/karma-configs/hydration/local.js --single-run --browsers ChromeHeadless",
"hydration:sauce": "karma start ./scripts/karma-configs/hydration/sauce.js --single-run",
"hydration:sauce:ci": "../../../scripts/ci/retry.sh karma start ./scripts/karma-configs/hydration/sauce.js --single-run",
"sauce": "karma start ./scripts/karma-configs/test/sauce.js --single-run",
"sauce:ci": "../../../scripts/ci/retry.sh karma start ./scripts/karma-configs/test/sauce.js --single-run",
"coverage": "node ./scripts/merge-coverage.js"
},
"//": {
Expand Down
4 changes: 3 additions & 1 deletion packages/@lwc/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"local:prod": "yarn build:prod && MODE=prod wdio ./scripts/wdio.local.conf.js",
"sauce": "yarn sauce:prod",
"sauce:dev": "MODE=dev yarn build:dev && MODE=dev wdio ./scripts/wdio.sauce.conf.js",
"sauce:prod": "MODE=prod yarn build:prod && MODE=prod wdio ./scripts/wdio.sauce.conf.js"
"sauce:prod": "MODE=prod yarn build:prod && MODE=prod wdio ./scripts/wdio.sauce.conf.js",
"sauce:dev:ci": "MODE=dev yarn build:dev && MODE=dev ../../../scripts/ci/retry.sh wdio ./scripts/wdio.sauce.conf.js",
"sauce:prod:ci": "MODE=prod yarn build:prod && MODE=prod ../../../scripts/ci/retry.sh wdio ./scripts/wdio.sauce.conf.js"
},
"devDependencies": {
"@lwc/rollup-plugin": "3.6.0",
Expand Down
26 changes: 26 additions & 0 deletions scripts/ci/retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having a custom script to retry, what about using a GH action retry step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this, but I felt uncomfortable since it's not an officially supported Action.

#
# Copyright (c) 2023, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: MIT
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
#
# Retry a script multiple times before failing. Used for CI.
#

set -e

export PATH="${PATH}:./node_modules/.bin"

MAX_RETRY=3
n=0
until [ $n -ge $MAX_RETRY ]
do
echo "Try $[$n+1]/$MAX_RETRY..."
"$@" && break
n=$[$n+1]
done
if [ $n -ge $MAX_RETRY ]; then
echo "Failed: ${@}" >&2
exit 1
fi