From 044f1588f56b7b094dfbe7e939b151281e73be8b Mon Sep 17 00:00:00 2001 From: Alex Plischke Date: Thu, 9 Feb 2023 09:38:56 -0800 Subject: [PATCH] Remove obsolete flags (#24) * Remove deprecated flags * Update README --- README.md | 176 ++++++++++++++++----------------------------- action.yml | 29 +++----- dist/main/index.js | 33 +++------ src/config.js | 14 ++-- src/run.js | 19 ++--- tests/run.spec.js | 13 +--- 6 files changed, 88 insertions(+), 196 deletions(-) diff --git a/README.md b/README.md index 339167b..7196d59 100644 --- a/README.md +++ b/README.md @@ -3,120 +3,64 @@ This action installs [saucectl](https://github.com/saucelabs/saucectl/) and launches tests. \ You can use it to run your tests on Sauce Labs ! -## Example - -### Basic - -``` -jobs: - test: - runs-on: ubuntu-latest - name: Action Test - steps: - # ... - - uses: saucelabs/saucectl-run-action@v2 - env: - GITHUB_TOKEN: ${{ github.token }} - # ... -``` - -:warning: To avoid reaching `API rate limit exceeded` due to unauthenticated requests, be sure to provide `GITHUB_TOKEN` through `env` field. - -### Advanced - -``` -jobs: - test: - runs-on: ubuntu-latest - name: Action Test - steps: - - uses: saucelabs/saucectl-run-action@v2 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - sauce-username: ${{ secrets.SAUCE_USERNAME }} - sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} - saucectl-version: v0.109.0 - working-directory: ./testrunner-toolkit/cypress/ - testing-environment: sauce -``` - -## Inputs - -## saucectl-version - -Version of saucectl to use. \ -Default: latest - -## sauce-username - -Sauce Labs user name. - -## sauce-access-key - -Sauce Labs Access Key. - -## working-directory - -Folder in-which saucectl will be run.\ -Default: `.` - -## config-file - -Configuration file to use with saucectl.\ -Default: `.sauce/config.yml` - -> This value is relative to `working-directory`. - - -## region - -Region flag to pass to saucectl. - -> Similar to `--region ` parameter available in saucectl. - -## skip-run - -Skip execution of saucectl (only install binary). - -## select-suite - -Select the suite to run. - -> Similar to `--select-suite ` parameter available in saucectl. - -## concurrency - -Concurency to use. - -> Similar to `--ccy ` parameter available in saucectl. - -## env - -Environement variables to add. - -> Similar to `-e` parameter available in saucectl. - -Due to github actions limitation, environement variables needs to be passed as a string. \ -Example: -``` - - uses: saucelabs/saucectl-run-action@v2 - with: - sauce-username: ${{ secrets.SAUCE_USERNAME }} - sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} - env: | - MY_FIRST_VAR=VALUE - MY_SECOND_VAR=VALUE +## Usage + +:warning: Avoid being throttled by GitHub. Be sure to provide `GITHUB_TOKEN` through +the `env` field, or you may face an `API rate limit exceeded` error. + +```yaml +- uses: saucelabs/saucectl-run-action@v3 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + # Which version of saucectl. + # Default: latest + saucectl-version: v0.123.0 + + # Sauce Labs Credentials. + sauce-username: ${{ secrets.SAUCE_USERNAME }} + sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }} + + # Install saucectl, but don't run it. + # Default: false + skip-run: false + + # Relative path under $GITHUB_WORKSPACE to use as the new working directory. + working-directory: "" + + # An environment variable key-value pair that may be referenced in the tests executed by this command. + # Currently not supported by espresso/xcuitest. + env: | + MY_FIRST_VAR=VALUE + MY_SECOND_VAR=VALUE + + # Specify an alternative configuration file for this execution. + # Default: .sauce/config.yml + config-file: .sauce/myconfig.yml + + # Specifies the Sauce Labs data center through which tests will run. + # Valid values are us-west-1 or eu-central-1. + # Default: us-west-1 + region: us-west-1 + + # Controls how many suites run in parallel. + # Default: 1 + concurrency: 1 + + # Global timeout that limits how long saucectl can run in total. + # Supports duration values like '10s', '30m' etc. + timeout: 5m + + # Identifies an active Sauce Connect tunnel to use for secure connectivity to the Sauce Labs cloud. + tunnel-name: "" + + # Identifies the Sauce Labs user who created the specified tunnel, which is required if the user running the tests did not create the tunnel. + tunnel-owner: "" + + # Specifies a test suite to execute by name rather than all suites defined in the config file. + select-suite: "" + + # Includes the contents of the suite's console.log in the output of the command regardless of the test results. By default, the console log contents are shown for failed test suites only. + # Default: false + show-console-log: false ``` - -## show-console-log - -Display console.log when tests succeed. Set to `true` to enable. - -> Similar to `--show-console-log` parameter available in saucectl. - -## logDir - -Path where to store logs. - -> Similar to `--logDir ` parameter available in saucectl. diff --git a/action.yml b/action.yml index 0ee819a..58e8dbd 100644 --- a/action.yml +++ b/action.yml @@ -16,18 +16,15 @@ inputs: description: Sauce Labs API Key. required: false working-directory: - description: Folder in-which saucectl will be run. + description: Folder in which saucectl will be run. default: . required: false config-file: - description: Configuration file to use with saucectl + description: Specify an alternative configuration file to the default .sauce/config.yml for this execution. default: .sauce/config.yml required: false region: - description: The Sauce Labs region. - required: false - testing-environment: - description: "[deprecated] Testing Environment" + description: Specifies the Sauce Labs data center through which tests will run. Valid values are us-west-1 (default) or eu-central-1. required: false concurrency: description: Controls how many suites run in parallel. @@ -36,23 +33,20 @@ inputs: description: Specifies the path to the .sauceignore file required: false timeout: - description: test timeout in seconds + description: Global timeout that limits how long saucectl can run in total. required: false - tunnel-id: - description: Sets the sauce-connect tunnel ID to be used for the run + tunnel-name: + description: Identifies an active Sauce Connect tunnel to use for secure connectivity to the Sauce Labs cloud. required: false - tunnel-parent: - description: Sets the sauce-connect tunnel parent to be used for the run + tunnel-owner: + description: Identifies the Sauce Labs user who created the specified tunnel, which is required if the user running the tests did not create the tunnel. required: false skip-run: - description: Skip execution of saucectl (only install binary) + description: Skip execution of saucectl (only install binary). default: "false" required: false - suite: - description: "[deprecated] Suite to be tested" - required: false select-suite: - description: Suite to be tested + description: Specifies a test suite to execute by name rather than all suites defined in the config file. required: false env: description: Environment variables to pass to saucectl @@ -61,9 +55,6 @@ inputs: description: Display console.log when tests succeed required: false default: "false" - logDir: - description: Path where to store logs - required: false runs: using: 'node16' main: 'dist/main/index.js' diff --git a/dist/main/index.js b/dist/main/index.js index b33776f..8a85724 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -16208,17 +16208,14 @@ const defaultConfig = { workingDirectory: ".", configurationFile: undefined, runRegion: undefined, - runEnvironment: undefined, concurrency: undefined, timeout: undefined, sauceignore: undefined, skipRun: false, - suite: undefined, selectSuite: undefined, - tunnelId: undefined, - tunnelParent: undefined, + tunnelName: undefined, + tunnelOwner: undefined, showConsoleLog: false, - logDir: undefined, env: [], }; @@ -16256,18 +16253,15 @@ const get = function() { workingDirectory: getSettingString(['working-directory'], defaultConfig.workingDirectory), configurationFile: getSettingString(['config-file', 'configuration-file'], defaultConfig.configurationFile), runRegion: getSettingString(['region'], defaultConfig.runRegion), - runEnvironment: getSettingString(['testing-environment', 'test-environment', 'environment'], defaultConfig.runEnvironment), concurrency: getSettingString(['concurrency'], defaultConfig.concurrency), timeout: getSettingString(['timeout'], defaultConfig.timeout), sauceignore: getSettingString(['sauceignore'], defaultConfig.sauceignore), skipRun: getSettingBool(['skip-run'], defaultConfig.skipRun), - suite: getSettingString(['suite'], defaultConfig.suite), selectSuite: getSettingString(['select-suite'], defaultConfig.selectSuite), - tunnelId: getSettingString(['tunnel-id'], defaultConfig.tunnelId), - tunnelParent: getSettingString(['tunnel-parent'], defaultConfig.tunnelParent), + tunnelName: getSettingString(['tunnel-name'], defaultConfig.tunnelName), + tunnelOwner: getSettingString(['tunnel-owner'], defaultConfig.tunnelOwner), env: getEnvVariables(['env']), showConsoleLog: getSettingBool(['show-console-log'], defaultConfig.showConsoleLog), - logDir: getSettingString(['logDir'], defaultConfig.logDir), }; if (sauceConfig.saucectlVersion != "latest") { @@ -16440,28 +16434,20 @@ function buildSaucectlArgs(opts) { if (opts.runRegion) { args.push('--region', opts.runRegion); } - if (opts.runEnvironment) { - core.warning(`testing-environment is deprecated. It won't worke with saucectl v0.53.0 and above.`); - args.push('--test-env', opts.runEnvironment); - } if (opts.concurrency) { args.push('--ccy', opts.concurrency); } - if (opts.suite) { - core.warning(`suite is deprecated. It won't work with saucectl v0.53.0 and above. You should use select-suite parameter.`); - args.push('--suite', opts.suite); - } if (opts.selectSuite) { args.push('--select-suite', opts.selectSuite); } if (opts.timeout) { args.push('--timeout', opts.timeout); } - if (opts.tunnelId) { - args.push('--tunnel-id', opts.tunnelId); + if (opts.tunnelName) { + args.push('--tunnel-name', opts.tunnelName); } - if (opts.tunnelParent) { - args.push('--tunnel-parent', opts.tunnelParent); + if (opts.tunnelOwner) { + args.push('--tunnel-owner', opts.tunnelOwner); } if (opts.sauceignore) { args.push('--sauceignore', opts.sauceignore); @@ -16469,9 +16455,6 @@ function buildSaucectlArgs(opts) { if (opts.showConsoleLog) { args.push('--show-console-log'); } - if (opts.logDir) { - args.push('--logDir', opts.logDir) - } for (const env of opts.env || []) { args.push('-e', env); } diff --git a/src/config.js b/src/config.js index e733027..c0a984e 100644 --- a/src/config.js +++ b/src/config.js @@ -8,17 +8,14 @@ const defaultConfig = { workingDirectory: ".", configurationFile: undefined, runRegion: undefined, - runEnvironment: undefined, concurrency: undefined, timeout: undefined, sauceignore: undefined, skipRun: false, - suite: undefined, selectSuite: undefined, - tunnelId: undefined, - tunnelParent: undefined, + tunnelName: undefined, + tunnelOwner: undefined, showConsoleLog: false, - logDir: undefined, env: [], }; @@ -56,18 +53,15 @@ const get = function() { workingDirectory: getSettingString(['working-directory'], defaultConfig.workingDirectory), configurationFile: getSettingString(['config-file', 'configuration-file'], defaultConfig.configurationFile), runRegion: getSettingString(['region'], defaultConfig.runRegion), - runEnvironment: getSettingString(['testing-environment', 'test-environment', 'environment'], defaultConfig.runEnvironment), concurrency: getSettingString(['concurrency'], defaultConfig.concurrency), timeout: getSettingString(['timeout'], defaultConfig.timeout), sauceignore: getSettingString(['sauceignore'], defaultConfig.sauceignore), skipRun: getSettingBool(['skip-run'], defaultConfig.skipRun), - suite: getSettingString(['suite'], defaultConfig.suite), selectSuite: getSettingString(['select-suite'], defaultConfig.selectSuite), - tunnelId: getSettingString(['tunnel-id'], defaultConfig.tunnelId), - tunnelParent: getSettingString(['tunnel-parent'], defaultConfig.tunnelParent), + tunnelName: getSettingString(['tunnel-name'], defaultConfig.tunnelName), + tunnelOwner: getSettingString(['tunnel-owner'], defaultConfig.tunnelOwner), env: getEnvVariables(['env']), showConsoleLog: getSettingBool(['show-console-log'], defaultConfig.showConsoleLog), - logDir: getSettingString(['logDir'], defaultConfig.logDir), }; if (sauceConfig.saucectlVersion != "latest") { diff --git a/src/run.js b/src/run.js index bfa09d7..0cb54ac 100644 --- a/src/run.js +++ b/src/run.js @@ -14,28 +14,20 @@ function buildSaucectlArgs(opts) { if (opts.runRegion) { args.push('--region', opts.runRegion); } - if (opts.runEnvironment) { - core.warning(`testing-environment is deprecated. It won't worke with saucectl v0.53.0 and above.`); - args.push('--test-env', opts.runEnvironment); - } if (opts.concurrency) { args.push('--ccy', opts.concurrency); } - if (opts.suite) { - core.warning(`suite is deprecated. It won't work with saucectl v0.53.0 and above. You should use select-suite parameter.`); - args.push('--suite', opts.suite); - } if (opts.selectSuite) { args.push('--select-suite', opts.selectSuite); } if (opts.timeout) { args.push('--timeout', opts.timeout); } - if (opts.tunnelId) { - args.push('--tunnel-id', opts.tunnelId); + if (opts.tunnelName) { + args.push('--tunnel-name', opts.tunnelName); } - if (opts.tunnelParent) { - args.push('--tunnel-parent', opts.tunnelParent); + if (opts.tunnelOwner) { + args.push('--tunnel-owner', opts.tunnelOwner); } if (opts.sauceignore) { args.push('--sauceignore', opts.sauceignore); @@ -43,9 +35,6 @@ function buildSaucectlArgs(opts) { if (opts.showConsoleLog) { args.push('--show-console-log'); } - if (opts.logDir) { - args.push('--logDir', opts.logDir) - } for (const env of opts.env || []) { args.push('-e', env); } diff --git a/tests/run.spec.js b/tests/run.spec.js index 3fd6b73..10f8c49 100644 --- a/tests/run.spec.js +++ b/tests/run.spec.js @@ -17,18 +17,12 @@ it("Argument builds", async () => { }, { input: { ...config.defaultConfig, runRegion: 'eu-central-1' }, expected: ['run', '--region', 'eu-central-1'] - }, { - input: { ...config.defaultConfig, runEnvironment: 'sauce' }, - expected: ['run', '--test-env', 'sauce'] - }, { - input: { ...config.defaultConfig, suite: 'mySuiteName' }, - expected: ['run', '--suite', 'mySuiteName'] }, { input: { ...config.defaultConfig, selectSuite: 'mySuiteName' }, expected: ['run', '--select-suite', 'mySuiteName'] }, { - input: { ...config.defaultConfig, tunnelId: 'my-tunnel-id', tunnelParent: 'my-tunnel-parent' }, - expected: ['run', '--tunnel-id', 'my-tunnel-id', '--tunnel-parent', 'my-tunnel-parent'] + input: { ...config.defaultConfig, tunnelName: 'my-tunnel-name', tunnelOwner: 'my-tunnel-owner' }, + expected: ['run', '--tunnel-name', 'my-tunnel-name', '--tunnel-owner', 'my-tunnel-owner'] }, { input: { ...config.defaultConfig, concurrency: 3 }, expected: ['run', '--ccy', 3] @@ -41,9 +35,6 @@ it("Argument builds", async () => { }, { input: { ...config.defaultConfig, showConsoleLog: true }, expected: ['run', '--show-console-log'] - }, { - input: { ...config.defaultConfig, logDir: 'path/to/logs' }, - expected: ['run', '--logDir', 'path/to/logs'] }, { input: { ...config.defaultConfig, env: ['key1=val1', 'key2=val2']}, expected: ['run', '-e', 'key1=val1', '-e', 'key2=val2']