Skip to content

Commit cda8379

Browse files
committed
feat: Support config-file
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent 71f06c5 commit cda8379

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.github/workflows/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,20 @@ jobs:
3636
version: 'latest'
3737
hooks: 'apps.python.hooks'
3838
args: '-c custom_check --include-name-regex success -H "Authorization: Bearer ${{ env.ACCESS_TOKEN }}"'
39+
40+
- name: Write a Schemathesis config file
41+
run: |
42+
mkdir -p .github/schemathesis
43+
cat <<EOF > .github/schemathesis/schemathesis.toml
44+
[[operations]]
45+
include-name-regex = "success"
46+
enabled = false
47+
EOF
48+
49+
- name: With config file
50+
uses: ./
51+
with:
52+
schema: 'http://127.0.0.1:5001/openapi.json'
53+
version: 'latest'
54+
config-file: '.github/schemathesis/schemathesis.toml'
55+
args: '-H "Authorization: Bearer ${{ env.ACCESS_TOKEN }}"'

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ GitHub Action for running [Schemathesis](https://github.com/schemathesis/schemat
2828
version: 'latest'
2929
# Python module path for hooks
3030
hooks: 'tests.hooks'
31+
# Path to a `schemathesis.toml` configuration file
32+
config-file: 'tests/schemathesis-config.yaml'
3133
# Additional CLI arguments
3234
args: '--report-junit-path=/tmp/junit.xml'
3335
```

action.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ inputs:
3030
hooks:
3131
description: 'Python module path for hooks'
3232
required: false
33+
config-file:
34+
description: 'Path to a `schemathesis.toml` configuration file'
35+
required: false
3336
args:
3437
description: 'Additional CLI arguments'
3538
required: false
@@ -50,12 +53,16 @@ runs:
5053
fi
5154
shell: bash
5255
- run: |
53-
schemathesis run \
56+
CMD="schemathesis"
57+
if [ -n "${{ inputs.config-file }}" ]; then
58+
CMD="$CMD --config-file=${{ inputs.config-file }}"
59+
fi
60+
eval "$CMD run \
5461
${{ inputs.schema }} \
5562
--generation-database=:memory: \
5663
--max-examples=${{ inputs.max-examples }} \
5764
--checks=${{ inputs.checks }} \
58-
${{ inputs.args }} \
65+
${{ inputs.args }}"
5966
shell: bash
6067
env:
6168
SCHEMATHESIS_BASE_URL: ${{ inputs.base-url }}

0 commit comments

Comments
 (0)