Skip to content

Commit

Permalink
build: sauce labs connect initial action (#4579)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxokorokov committed Oct 12, 2023
1 parent 245c873 commit 0e2d9ff
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 40 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
@@ -1,19 +1,25 @@
name: ci
on: [push, pull_request]

on:
push:
branches:
- master
- '[0-9]+_[0-9]+_x'
pull_request:
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
runs-on: ubuntu-latest
env:
SAUCE_USERNAME: pkozlowski
SAUCE_ACCESS_KEY: c5ea8b730bc9-378b-43e4-6e34-e66aa371
BROWSER_PROVIDER_READY_FILE: /tmp/sauce-connect-ready
LOGS_DIR: /tmp/logs
steps:
- uses: actions/checkout@v3
- run: mkdir -p $LOGS_DIR && ./scripts/sauce_connect_setup.sh
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
Expand All @@ -39,8 +45,3 @@ jobs:
name: test-reports
path: test-reports
if: ${{ always() }}
- run: cat $LOGS_DIR/*
- run: ./scripts/sauce_connect_block.sh
- run: yarn saucelabs
- run: ./scripts/sauce_connect_teardown.sh
if: ${{ always() }}
45 changes: 45 additions & 0 deletions .github/workflows/saucelabs.yml
@@ -0,0 +1,45 @@
name: SauceLabs

on:
push:
branches:
- master
pull_request_target:
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
saucelabs:
runs-on: ubuntu-latest
name: SauceLabs
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn --frozen-lockfile
- uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ env.SAUCE_USERNAME }}
accessKey: ${{ env.SAUCE_ACCESS_KEY }}
tunnelIdentifier: ${{ github.run_id }}
- run: yarn saucelabs
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: sauce-connect-log
path: /tmp/sauce-connect-action**/sauce-connect.log
28 changes: 1 addition & 27 deletions src/karma.sauce.conf.js
@@ -1,38 +1,12 @@
// Configuration used testing via Sauce Labs on GitHub CI

process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY.split('').reverse().join('');

const BROWSERS = {
CHROME: {
base: 'SauceLabs',
browserName: 'chrome',
browserVersion: 'latest',
platformName: 'Windows 11',
},
FIREFOX: {
base: 'SauceLabs',
browserName: 'firefox',
browserVersion: 'latest',
platformName: 'Windows 11',
},
EDGE: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
browserVersion: 'latest',
platformName: 'Windows 11',
},
SAFARI15: {
base: 'SauceLabs',
browserName: 'safari',
browserVersion: '15',
platformName: 'macOS 12',
},
SAFARI16: {
base: 'SauceLabs',
browserName: 'safari',
browserVersion: '16',
platformName: 'macOS 13',
},
};

module.exports = function (config) {
Expand Down Expand Up @@ -68,7 +42,7 @@ module.exports = function (config) {
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
browsers: ['CHROME', 'FIREFOX', 'EDGE', 'SAFARI15', 'SAFARI16'],
browsers: ['CHROME'],
autoWatch: false,
singleRun: true,
captureTimeout: 180000,
Expand Down

0 comments on commit 0e2d9ff

Please sign in to comment.