-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (84 loc) · 3.13 KB
/
test-twilio-flex-plugin.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: "Test Twilio Flex Plugin"
on:
workflow_call:
inputs:
PLUGIN_DIRECTORY:
type: string
required: true
description: The path to the Flex Plugin base directory (where package.json is located)
TEST_COMMAND:
type: string
required: true
description: The test command
TEST_COMMAND_DIRECTORY:
type: string
required: false
description: (Optional) defaults to install directory
INSTALL_DIRECTORY:
type: string
required: false
default: .
description: (Optional) The path to the directory to call yarn install in. Defaults to root
INSTALL_FLAGS:
type: string
required: false
description: (Optional) Override yarn install flags
default: "--immutable --immutable-cache"
COVERAGE_LCOV_FILE:
type: string
required: false
description: (Optional) Add path to lcov-file to output test coverage on PR
NODE_VERSION:
type: string
required: false
description: (Optional) Override Node Version (Default 18)
default: 18.x
jobs:
plugin_test:
runs-on: ubuntu-22.04
steps:
- name: Checkout ${{ github.repository }}@${{ github.ref_name }}
uses: actions/checkout@v4
with:
path: main
- name: Checkout zingdevlimited/actions-helpers@v3
uses: actions/checkout@v4
with:
repository: zingdevlimited/actions-helpers
path: helpers
ref: v3
- name: Resolve Cache Dependency Path
run: |
if [ "${{ inputs.INSTALL_DIRECTORY }}" == "." ]; then
echo "CACHE_DEPENDENCY_PATH=main/yarn.lock" >> "$GITHUB_ENV"
else
echo "CACHE_DEPENDENCY_PATH=main/${{ inputs.INSTALL_DIRECTORY }}/yarn.lock" >> "$GITHUB_ENV"
fi
- name: Set up Node ${{ inputs.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.NODE_VERSION }}
cache: yarn
cache-dependency-path: ${{ env.CACHE_DEPENDENCY_PATH }}
- name: Setup Flex CLI
uses: ./helpers/setup-flex-cli
id: flexCli
with:
PLUGIN_DIRECTORY: main/${{ inputs.PLUGIN_DIRECTORY }}
- name: Install Dependencies
working-directory: main/${{ inputs.INSTALL_DIRECTORY }}
run: yarn install ${{ inputs.INSTALL_FLAGS }}
- name: Test ${{ steps.flexCli.outputs.PLUGIN_NAME }}
working-directory: main/${{ inputs.TEST_COMMAND_DIRECTORY != '' && inputs.TEST_COMMAND_DIRECTORY || inputs.INSTALL_DIRECTORY }}
run: ${{ inputs.TEST_COMMAND }}
env:
TWILIO_ACCOUNT_SID: ACX # Dummy credentials for CLI. Not needed to test
TWILIO_AUTH_TOKEN: X
- name: Output plugin coverage
if: github.event_name == 'pull_request' && inputs.COVERAGE_LCOV_FILE != ''
uses: romeovs/lcov-reporter-action@dda1c9b1fa1622b225e9acd87a248751dbcc6ada # v0.3.1
with:
title: Plugin Coverage
lcov-file: ${{ inputs.COVERAGE_LCOV_FILE }}
github-token: ${{ secrets.GITHUB_TOKEN }}
delete-old-comments: true