diff --git a/.github/workflows/test-python-code.yaml b/.github/workflows/test-python-code.yaml index 3da2ba40..78b97683 100644 --- a/.github/workflows/test-python-code.yaml +++ b/.github/workflows/test-python-code.yaml @@ -23,15 +23,17 @@ on: type: boolean required: true default: true - pyproject-toml: - description: "The path to the pyproject.toml file." + pyproject-toml-directory: + description: "The directory where pyproject.toml is located." type: string required: true - default: "pyproject.toml" + default: "." jobs: test-py-code: runs-on: ubuntu-latest + env: + PYPROJECT_TOML: ${{ inputs.pyproject-toml-directory }}/pyproject.toml steps: - name: ๐Ÿ Set up Python ${{ inputs.python-version }} Environment uses: ocadotechnology/codeforlife-workspace/.github/actions/python/setup-environment@main @@ -42,19 +44,19 @@ jobs: - name: ๐Ÿ”Ž Check Import Sort working-directory: ${{ inputs.working-directory }} - run: pipenv run isort --settings-file=${{ inputs.pyproject-toml }} --check ${{ inputs.source-path }} + run: pipenv run isort --settings-file=${{ env.PYPROJECT_TOML }} --check ${{ inputs.source-path }} - name: ๐Ÿ”Ž Check Code Format working-directory: ${{ inputs.working-directory }} - run: if ! pipenv run black --config=${{ inputs.pyproject-toml }} --check ${{ inputs.source-path }}; then exit 1; fi + run: if ! pipenv run black --config=${{ env.PYPROJECT_TOML }} --check ${{ inputs.source-path }}; then exit 1; fi - name: ๐Ÿ”Ž Check Static Type Hints working-directory: ${{ inputs.working-directory }} - run: pipenv run mypy --config-file=${{ inputs.pyproject-toml }} ${{ inputs.source-path }} + run: pipenv run mypy --config-file=${{ env.PYPROJECT_TOML }} ${{ inputs.source-path }} - name: ๐Ÿ”Ž Check Static Code working-directory: ${{ inputs.working-directory }} - run: pipenv run pylint --rcfile=${{ inputs.pyproject-toml }} ${{ inputs.source-path }} + run: pipenv run pylint --rcfile=${{ env.PYPROJECT_TOML }} ${{ inputs.source-path }} - name: ๐Ÿ”Ž Check Django Migrations if: inputs.check-django-migrations @@ -63,6 +65,6 @@ jobs: - name: ๐Ÿงช Test Code Units working-directory: ${{ inputs.working-directory }} - run: pipenv run pytest -n=auto -c=${{ inputs.pyproject-toml }} ${{ inputs.source-path }} + run: pipenv run pytest -n=auto -c=${{ env.PYPROJECT_TOML }} ${{ inputs.source-path }} # TODO: assert code coverage target.