File tree Expand file tree Collapse file tree 3 files changed +46
-6
lines changed
Expand file tree Collapse file tree 3 files changed +46
-6
lines changed Original file line number Diff line number Diff line change 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 }}"'
Original file line number Diff line number Diff 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` ` `
Original file line number Diff line number Diff 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,30 @@ runs:
5053 fi
5154 shell: bash
5255 - run : |
53- schemathesis run \
54- ${{ inputs.schema }} \
55- --generation-database=:memory: \
56- --max-examples=${{ inputs.max-examples }} \
57- --checks=${{ inputs.checks }} \
58- ${{ inputs.args }} \
56+ set -euo pipefail
57+
58+ SCHEMA='${{ inputs.schema }}'
59+ CHECKS='${{ inputs.checks }}'
60+ MAX_EXAMPLES='${{ inputs.max-examples }}'
61+ CONFIG_FILE='${{ inputs.config-file }}'
62+
63+ read -r -a ARGS_ARRAY <<< '${{ inputs.args }}'
64+
65+ CMD=(schemathesis)
66+ if [[ -n "$CONFIG_FILE" ]]; then
67+ CMD+=(--config-file="$CONFIG_FILE")
68+ fi
69+
70+ CMD+=(run
71+ "$SCHEMA"
72+ --generation-database=":memory:"
73+ --max-examples="$MAX_EXAMPLES"
74+ --checks="$CHECKS"
75+ )
76+
77+ CMD+=("${ARGS_ARRAY[@]}")
78+
79+ "${CMD[@]}"
5980 shell: bash
6081 env:
6182 SCHEMATHESIS_BASE_URL: ${{ inputs.base-url }}
You can’t perform that action at this time.
0 commit comments