Skip to content

Commit

Permalink
Merge branch 'master' into nrf/add-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-fields authored Sep 26, 2023
2 parents cc15f2f + 1467290 commit 634988c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: CI/CD
on:
# only on PRs into and merge to default branch
pull_request:
branches:
- master
push:
branches:
- master

jobs:
# runs on branch pushes only
ci_unit:
name: Run Unit Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -26,7 +30,6 @@ jobs:

ci_integration:
name: Run Integration Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -137,7 +140,6 @@ jobs:

ci_integration_envvar:
name: Run Integration Env Var Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -159,7 +161,6 @@ jobs:

ci_integration_large_output:
name: Run Integration Large Output Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -191,7 +192,6 @@ jobs:

ci_integration_retry_on_exit_code:
name: Run Integration retry_on_exit_code Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -240,7 +240,6 @@ jobs:

ci_integration_continue_on_error:
name: Run Integration continue_on_error Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -288,7 +287,6 @@ jobs:

ci_integration_retry_wait_seconds:
name: Run Integration Tests (retry_wait_seconds)
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -325,7 +323,6 @@ jobs:

ci_integration_on_retry_cmd:
name: Run Integration Tests (on_retry_command)
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -369,7 +366,6 @@ jobs:
# timeout tests take longer to run so run in parallel
ci_integration_timeout_seconds:
name: Run Integration Timeout Tests (seconds)
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -400,7 +396,6 @@ jobs:

ci_integration_timeout_retry_on_timeout:
name: Run Integration Timeout Tests (retry_on timeout)
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -432,7 +427,6 @@ jobs:

ci_integration_timeout_retry_on_error:
name: Run Integration Timeout Tests (retry_on error)
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -468,7 +462,6 @@ jobs:

ci_integration_timeout_minutes:
name: Run Integration Timeout Tests (minutes)
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -499,7 +492,6 @@ jobs:

ci_windows:
name: Run Windows Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: windows-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -571,7 +563,7 @@ jobs:
steps:
- run: echo "If this is hit, all tests successfully passed"

# runs on push to master only
# runs on merge to default only
cd:
name: Publish Action
needs: [ci_all_tests_passed]
Expand All @@ -588,7 +580,7 @@ jobs:
run: npm ci
- name: Release
id: semantic
uses: cycjimmy/semantic-release-action@v2
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tag
Expand Down
11 changes: 6 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,8 @@ function getExecutable(inputs) {
return OS === 'win32' ? 'powershell' : 'bash';
}
var executable;
switch (inputs.shell) {
var shellName = inputs.shell.split(' ')[0];
switch (shellName) {
case 'bash':
case 'python':
case 'pwsh': {
Expand All @@ -983,21 +984,21 @@ function getExecutable(inputs) {
}
case 'sh': {
if (OS === 'win32') {
throw new Error("Shell ".concat(inputs.shell, " not allowed on OS ").concat(OS));
throw new Error("Shell ".concat(shellName, " not allowed on OS ").concat(OS));
}
executable = inputs.shell;
break;
}
case 'cmd':
case 'powershell': {
if (OS !== 'win32') {
throw new Error("Shell ".concat(inputs.shell, " not allowed on OS ").concat(OS));
throw new Error("Shell ".concat(shellName, " not allowed on OS ").concat(OS));
}
executable = inputs.shell + '.exe';
executable = shellName + '.exe' + inputs.shell.replace(shellName, '');
break;
}
default: {
throw new Error("Shell ".concat(inputs.shell, " not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells"));
throw new Error("Shell ".concat(shellName, " not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells"));
}
}
return executable;
Expand Down
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ function getExecutable(inputs: Inputs): string {
}

let executable: string;
switch (inputs.shell) {
const shellName = inputs.shell.split(' ')[0];

switch (shellName) {
case 'bash':
case 'python':
case 'pwsh': {
Expand All @@ -36,22 +38,22 @@ function getExecutable(inputs: Inputs): string {
}
case 'sh': {
if (OS === 'win32') {
throw new Error(`Shell ${inputs.shell} not allowed on OS ${OS}`);
throw new Error(`Shell ${shellName} not allowed on OS ${OS}`);
}
executable = inputs.shell;
break;
}
case 'cmd':
case 'powershell': {
if (OS !== 'win32') {
throw new Error(`Shell ${inputs.shell} not allowed on OS ${OS}`);
throw new Error(`Shell ${shellName} not allowed on OS ${OS}`);
}
executable = inputs.shell + '.exe';
executable = shellName + '.exe' + inputs.shell.replace(shellName, '');
break;
}
default: {
throw new Error(
`Shell ${inputs.shell} not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells`
`Shell ${shellName} not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells`
);
}
}
Expand Down

0 comments on commit 634988c

Please sign in to comment.