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 96a7884
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 16 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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() }}
42 changes: 42 additions & 0 deletions .github/workflows/saucelabs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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
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: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelName: ng-bootstrap
- run: yarn saucelabs
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: sauce-connect-log
path: ${{ env.SAUCE_CONNECT_DIR_IN_HOST }}/sauce-connect.log
4 changes: 1 addition & 3 deletions src/karma.sauce.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// 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',
Expand Down Expand Up @@ -50,7 +48,7 @@ module.exports = function (config) {
},
sauceLabs: {
build: `GitHub run #${process.env.GITHUB_RUN_ID}`,
tunnelIdentifier: process.env.GITHUB_RUN_ID,
tunnelName: `ng-bootstrap`,
testName: 'ng-bootstrap',
retryLimit: 3,
startConnect: false,
Expand Down

0 comments on commit 96a7884

Please sign in to comment.