Skip to content

Commit 6b6f030

Browse files
committed
Add cache and integration test installation options
Mostly for integration testing.
1 parent 0117ee1 commit 6b6f030

File tree

4 files changed

+77
-15
lines changed

4 files changed

+77
-15
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
- uses: ./
2828
- run: autify --version
2929
- run: echo token | autify web auth login
30-
- run: autify connect client install
3130

3231
test-specific:
3332
strategy:
@@ -45,4 +44,36 @@ jobs:
4544
shell-installer-url: "https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/beta/install-cicd.bash"
4645
- run: autify --version | grep beta
4746
- run: echo token | autify web auth login
48-
- run: autify connect client install
47+
48+
test-integration-test:
49+
strategy:
50+
matrix:
51+
os:
52+
- ubuntu-latest
53+
- macos-latest
54+
- windows-latest
55+
fail-fast: false
56+
runs-on: ${{ matrix.os }}
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: ./
60+
with:
61+
install-cli-integration-test: 'true'
62+
- run: |
63+
echo token | autify web auth login
64+
echo token | autify mobile auth login
65+
autify connect client install
66+
env:
67+
AUTIFY_CONNECT_CLIENT_MODE: fake
68+
- run: autify-cli-integration-test
69+
70+
test-use-cache:
71+
runs-on: ubuntu-latest
72+
steps:
73+
- uses: actions/checkout@v3
74+
- uses: ./
75+
with:
76+
use-cache: 'true'
77+
- uses: ./
78+
with:
79+
use-cache: 'true'

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,31 @@ The installed directory will be added to `PATH` environment variable of your wor
1212

1313
```yaml
1414
- uses: autifyhq/actions-setup-cli@v2
15-
# Optionally specify the installer script which installs `autify` at `./autify/bin`.
16-
# If omitted, the default installer will be used. (Currently beta channel)
17-
shell-installer-url: "https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/beta/install-cicd.bash"
1815

1916
# Then, `autify` is available
2017
- run: autify --version
2118
```
2219
20+
### Options
21+
22+
Most of the case, no options are needed. When you need more customization, here is the list:
23+
24+
```yaml
25+
shell-installer-url:
26+
required: false
27+
description: "Shell installer URL"
28+
# TODO: Use stable
29+
default: "https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/beta/install-cicd.bash"
30+
use-cache:
31+
required: false
32+
description: "Use cached CLI installed by previous steps if existing."
33+
default: "false"
34+
install-cli-integration-test:
35+
required: false
36+
description: "Install autify-cli-integration-test package as well."
37+
default: "false"
38+
```
39+
2340
### v1
2441
2542
**NOTE: v1 is no longer maintained. Please migrate to v2.**

action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,25 @@ inputs:
88
description: 'Shell installer URL'
99
# TODO: Use stable
1010
default: "https://autify-cli-assets.s3.amazonaws.com/autify-cli/channels/beta/install-cicd.bash"
11+
use-cache:
12+
required: false
13+
description: 'Use cached CLI installed by previous steps if existing.'
14+
default: 'false'
15+
install-cli-integration-test:
16+
required: false
17+
description: 'Install autify-cli-integration-test package as well.'
18+
default: 'false'
1119

1220
runs:
1321
using: 'composite'
1422
steps:
23+
- if: ${{ inputs.install-cli-integration-test == 'true' }}
24+
uses: actions/setup-node@v3
1525
- run: $GITHUB_ACTION_PATH/script.bash
1626
shell: bash
1727
env:
1828
INPUT_SHELL_INSTALLER_URL: ${{ inputs.shell-installer-url }}
29+
INPUT_USE_CACHE: ${{ inputs.use-cache }}
30+
INPUT_INSTALL_CLI_INTEGRATION_TEST: ${{ inputs.install-cli-integration-test }}
31+
- run: autify --version
32+
shell: bash

script.bash

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
set -xe
33

44
: "${INPUT_SHELL_INSTALLER_URL:?"Provide the installer URL"}"
5+
: "${INPUT_USE_CACHE:?"Provide true or false"}"
6+
: "${INPUT_INSTALL_CLI_INTEGRATION_TEST:?"Provide true or false"}"
57

6-
TEMP_DIR=$(mktemp -d)
8+
if [ "$INPUT_USE_CACHE" == "true" ]; then
9+
export AUTIFY_CLI_INSTALL_USE_CACHE=1
10+
fi
11+
if [ "$INPUT_INSTALL_CLI_INTEGRATION_TEST" == "true" ]; then
12+
export AUTIFY_CLI_INTEGRATION_TEST_INSTALL=1
13+
fi
714

8-
cd "$TEMP_DIR"
15+
cd "$RUNNER_TEMP"
916
curl -L "$INPUT_SHELL_INSTALLER_URL" | bash -xe
1017

11-
BIN_DIR="$TEMP_DIR/autify/bin"
12-
"$BIN_DIR"/autify --version
13-
14-
if [ "$(command -v cygpath)" ]; then
15-
cygpath -w "$BIN_DIR" >> "$GITHUB_PATH"
16-
else
17-
echo "$BIN_DIR" >> "$GITHUB_PATH"
18-
fi
18+
cat "$RUNNER_TEMP/autify/path" >> "$GITHUB_PATH"

0 commit comments

Comments
 (0)