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

feat: support custom "working-directory" #7

Merged
merged 4 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ jobs:
exit 1
fi

# Supports custom working directory.
- name: Prepare custom directory
run: |-
mkdir ./my-dir
cp ./test.yml ./my-dir/cwd.yml
- name: Custom working directoery
uses: ./
with:
command: run ./cwd.yml
working-directory: ./my-dir

release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ The Artillery CLI command to run. You can use all the available commands:

> Learn more about [Writing test scripts with Artillery](https://www.artillery.io/docs/get-started/first-test).

### `working-directory`

- _Optional_

Path to a directory to use as the current working directory when running Artillery commands.

```yml
- name: Load tests
uses: artilleryio/action-cli@v1
with:
command: run ./test.yml
working-directory: ./packages/app/load-tests
```

## Outputs

This action does not set any outputs.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ inputs:
command:
required: true
description: "Artillery CLI command to execute"
working-directory:
description: "Custom working directory for Artillery commands"

runs:
using: "docker"
image: "Dockerfile"
env:
CWD: ${{ inputs.working-directory }}
args:
- ${{ inputs.command }}

Expand Down
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/sh

# Respect custom "working-directory" input.
if [ -n "${CWD}" ]; then
cd "${CWD}"
fi

# Run the tests.
/home/node/artillery/bin/run $1
Loading