Spaces:
Sleeping
Sleeping
name: Python application | |
on: | |
push: | |
branches: ["main", "develop"] | |
pull_request: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
- name: Configure Poetry | |
run: | | |
poetry config virtualenvs.in-project true | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Run black | |
run: | | |
poetry run black . | |
- name: Run isort | |
run: | | |
poetry run isort . | |
- name: Test with pytest | |
run: | | |
poetry run pytest work/tests/* | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Apply code formatting changes | |
file_pattern: '*.py' | |
- name: Push to Hugging Face Space | |
if: github.event_name == 'push' | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: | | |
git fetch --unshallow | |
git push --force https://test-almondo:[email protected]/spaces/test-almondo/test2 develop:main | |
git push --force https://test-almondo:[email protected]/spaces/test-almondo/test develop:main | |