diff --git a/.github/workflows/test-target.yml b/.github/workflows/test-target.yml index 5d098900471a2..e2faeec0db0dd 100644 --- a/.github/workflows/test-target.yml +++ b/.github/workflows/test-target.yml @@ -94,6 +94,11 @@ on: required: false type: string default: "{}" + run-fips: + description: "If false, FIPS tests will be skipped." + required: false + type: boolean + default: false defaults: run: @@ -142,6 +147,14 @@ jobs: done echo "E2E_ENV_VARS=$E2E_ENV_VARS" >> $GITHUB_ENV + - name: Dynamically adjust pytest-args + run: | + PYTEST_ARGS="${{ inputs.pytest-args }}" + if [ "${{ inputs.run-fips }}" = "false" ]; then + PYTEST_ARGS+=" -k 'not fips'" + fi + echo "PYTEST_ARGS=$PYTEST_ARGS" >> $GITHUB_ENV + - name: Set up Windows if: runner.os == 'Windows' run: |- @@ -243,7 +256,7 @@ jobs: run: | if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then set +e # Disable immediate exit - ddev test --cov --junit ${{ inputs.target }} -- ${{ inputs.pytest-args }} + ddev test --cov --junit ${{ inputs.target }} -- ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -253,7 +266,7 @@ jobs: exit $exit_code fi else - ddev test --cov --junit ${{ inputs.target }} ${{ inputs.pytest-args != '' && format('-- {0}', inputs.pytest-args) || '' }} + ddev test --cov --junit ${{ inputs.target }} ${{ env.PYTEST_ARGS != '' && format('-- {0} -k "not fips"', env.PYTEST_ARGS) || '-k "not fips"' }} fi - name: Run Unit & Integration tests with minimum version of base package @@ -261,7 +274,7 @@ jobs: run: | if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then set +e # Disable immediate exit - ddev test --compat --recreate --junit ${{ inputs.target }} -- ${{ inputs.pytest-args }} + ddev test --compat --recreate --junit ${{ inputs.target }} -- ${{ env.PYTEST_ARGS }} -k "not fips" exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -271,7 +284,7 @@ jobs: exit $exit_code fi else - ddev test --compat --recreate --junit ${{ inputs.target }} ${{ inputs.pytest-args != '' && format('-- {0}', inputs.pytest-args) || '' }} + ddev test --compat --recreate --junit ${{ inputs.target }} ${{ env.PYTEST_ARGS != '' && format('-- {0} -k "not fips"', env.PYTEST_ARGS) || '-k "not fips"' }} fi - name: Run E2E tests with latest base package @@ -288,7 +301,7 @@ jobs: # by default if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then set +e # Disable immediate exit - ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }} -- all ${{ inputs.pytest-args }} + ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }} -- all ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -299,7 +312,7 @@ jobs: fi elif [ '${{ inputs.pytest-args }}' = '-m "not flaky"' ]; then set +e # Disable immediate exit - ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }} -- all ${{ inputs.pytest-args }} + ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }} -- all ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -309,7 +322,7 @@ jobs: exit $exit_code fi else - ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }} ${{ inputs.pytest-args != '' && format('-- all {0}', inputs.pytest-args) || '' }} + ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }} ${{ env.PYTEST_ARGS != '' && format('-- all {0}', env.PYTEST_ARGS) || '' }} fi - name: Run E2E tests @@ -326,7 +339,7 @@ jobs: # by default if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then set +e # Disable immediate exit - ddev env test ${{ env.E2E_ENV_VARS }} --new-env --junit ${{ inputs.target }} -- all ${{ inputs.pytest-args }} + ddev env test ${{ env.E2E_ENV_VARS }} --new-env --junit ${{ inputs.target }} -- all ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -337,7 +350,7 @@ jobs: fi elif [ '${{ inputs.pytest-args }}' = '-m "not flaky"' ]; then set +e # Disable immediate exit - ddev env test ${{ env.E2E_ENV_VARS }} --new-env --junit ${{ inputs.target }} -- all ${{ inputs.pytest-args }} + ddev env test ${{ env.E2E_ENV_VARS }} --new-env --junit ${{ inputs.target }} -- all ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -347,7 +360,7 @@ jobs: exit $exit_code fi else - ddev env test ${{ env.E2E_ENV_VARS }} --new-env --junit ${{ inputs.target }} ${{ inputs.pytest-args != '' && format('-- all {0}', inputs.pytest-args) || '' }} + ddev env test ${{ env.E2E_ENV_VARS }} --new-env --junit ${{ inputs.target }} ${{ env.PYTEST_ARGS != '' && format('-- all {0}', env.PYTEST_ARGS) || '' }} fi - name: Run benchmarks @@ -373,7 +386,7 @@ jobs: # by default if [ '${{ inputs.pytest-args }}' = '-m flaky' ]; then set +e # Disable immediate exit - ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }}:latest -- all ${{ inputs.pytest-args }} + ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }}:latest -- all ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -384,7 +397,7 @@ jobs: fi elif [ '${{ inputs.pytest-args }}' = '-m "not flaky"' ]; then set +e # Disable immediate exit - ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }}:latest -- all ${{ inputs.pytest-args }} + ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }}:latest -- all ${{ env.PYTEST_ARGS }} exit_code=$? if [ $exit_code -eq 5 ]; then # Flaky test count can be zero, this is done to avoid pipeline failure @@ -394,7 +407,7 @@ jobs: exit $exit_code fi else - ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }}:latest ${{ inputs.pytest-args != '' && format('-- all {0}', inputs.pytest-args) || '' }} + ddev env test ${{ env.E2E_ENV_VARS }} --base --new-env --junit ${{ inputs.target }}:latest ${{ env.PYTEST_ARGS != '' && format('-- all {0}', env.PYTEST_ARGS) || '' }} fi - name: View trace log