Skip to content

Commit

Permalink
Merge pull request #23 from joergbrech/22-working-directory
Browse files Browse the repository at this point in the history
add working_directory option
  • Loading branch information
joergbrech authored May 11, 2021
2 parents 2422e7b + 518606f commit 22d9596
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ jobs:
uses: ./
with:
src: tests/src
test-with-working-directory:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Run unit tests
uses: ./
with:
working_directory: tests
src: src
test-with-ext-arg:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ To use your test data along with Octave packages, you can see [this example conf

## Arguments

All file and directory paths are interpreted as relative to the working directory, which defaults to the Github Workspace. Optionally, the working-directory can be changed with the argument `working_directory`, see below.

| Input | Description | Usage |
| - | - | - |
| `tests` | files or directories containing the MOxUnit test cases | *Optional*, defaults to the root directory of the repo. All subdirectories are added recursively. |
Expand All @@ -95,3 +97,4 @@ To use your test data along with Octave packages, you can see [this example conf
| `cover_html_dir` | store coverage HTML output in directory | *Optional* |
| `cover_junit_xml_file` | store test results in junit XML file | *Optional* |
| `cover_json_file` | store coverage report in json file for processing by coveralls.io | *Optional* |
| `working_directory` | relative path to a working directory under the github workspace, defaults to `.`. | *Optional* |
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ inputs:
description: 'list of Octave packages to load (image, io, optim, parallel, statistics, struct)'
ext:
description: 'other directories e.g. external dependencies'
working_directory:
description: 'relative path to an optional working directory under the github workspace'

runs:
using: 'docker'
Expand All @@ -43,6 +45,7 @@ runs:
- ${{ inputs.data }}
- ${{ inputs.pkg }}
- ${{ inputs.ext }}
- ${{ inputs.working_directory }}

branding:
icon: check-circle
Expand Down
19 changes: 17 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ COVER_JSON_FILE=$9
DATA=$10
PKG=$11
EXT=$12
WDIR=$13

####################
# Switch directory #
####################


if [ -z $WDIR ] ; then
WDIR="."
fi
cd $WDIR

###########################
# Prepare Octave commands #
###########################

# Create an Octave expression to set up the environment
SETUP=""
Expand Down Expand Up @@ -70,9 +85,9 @@ else
SETUP="$SETUP $PKG_LIST pkg list;"
fi

###########################
##################
# Run unit tests #
###########################
##################

# prepare test case argument
if [ -z $TESTS ] ; then
Expand Down

0 comments on commit 22d9596

Please sign in to comment.