-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
67 lines (60 loc) · 1.84 KB
/
action.yml
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
name: 'Simple tox'
description: 'A simple action to run tox like you would on your own machine'
inputs:
python-version:
description: 'Python version to use'
required: true
default: '3.11'
tox-env:
description: 'Tox environment to run'
required: false
default: ''
max-attempts:
description: 'Maximum number of attempts to run the command until it succeeds'
required: false
default: 1
timeout-minutes:
description: 'Minutes to wait before an attempt times out'
required: false
default: 10
ignore-errors:
description: 'Whether to exit successfully even if the tox command fails or not'
required: false
default: false
warning-on-retry:
description: 'Whether to print a warning message when retrying the command'
required: false
default: false
runs:
using: "composite"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python-version }}
- name: Upgrade pip
shell: bash
run: python -m pip install --upgrade pip
- name: Install tox
shell: bash
run: pip install tox
- name: Generate tox arguments
shell: bash
id: generate-tox-args
run: |
env=""
if [[ ! -z "${{ inputs.tox-env }}" ]]; then
env+="-e ${{ inputs.tox-env }}"
fi
echo "args=$env" >> $GITHUB_OUTPUT
- name: Run unit tests
id: run-unit-tests
uses: nick-fields/retry@v2
with:
timeout_minutes: ${{ inputs.timeout-minutes }}
max_attempts: ${{ inputs.max-attempts }}
continue_on_error: ${{ inputs.ignore-errors }}
warning_on_retry: ${{ inputs.warning-on-retry }}
command: tox ${{ steps.generate-tox-args.outputs.args }}