Skip to content

Issues with Poetry Installation and Backend Build in GitHub Actions Workflow #1493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
ErholAB opened this issue Feb 16, 2025 · 1 comment
Open
1 task done

Comments

@ErholAB
Copy link

ErholAB commented Feb 16, 2025

Privileged issue

  • I'm @tiangolo or he asked me directly to create an issue here.

Issue Content

Hello,

I am experiencing issues with my GitHub Actions workflow for my repository ErholAB/full-stack-fastapi-template. The repository is a full-stack, modern web application template using FastAPI, React, SQLModel, PostgreSQL, Docker, and GitHub Actions.

We are using the cloud with the help of Azure Static Web Apps, GitHub, and a full-stack FastAPI template.

Operating System
Windows

Operating System Details
We are using Azure portal to create a Static Web App and GitHub with a full-stack FastAPI template repository.

Python Version
Python 3.8.20

Additional Context
I am seeking assistance to:

Resolve the Poetry installation issue in the build and deploy job.
Ensure that Oryx recognizes the installed Poetry and can use it for the backend build process.
Identify any potential misconfigurations in the workflow file that might be causing these issues.
Any guidance or suggestions to fix these issues would be greatly appreciated.

Thank you for your help!

Best regards, Erhol

@mohamedachrefhacheni
Copy link

Hi Erhol 👋,

Thanks for sharing the details!

It looks like the issue is related to the Poetry installation and Oryx not recognizing it during the Azure Static Web Apps deployment via GitHub Actions. I've worked through similar setups, and here’s what you can do to fix it:
-Manually install Poetry in your GitHub Actions workflow to ensure it's available before the build step.
Install Poetry.
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH.
-Install dependencies using Poetry before the backend build:
Install Python dependencies
cd backend
poetry install --no-root
GitHub Actions workflow is correctly structured
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- main

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

  - name: Set up Python
    uses: actions/setup-python@v4
    with:
      python-version: '3.8'

  - name: Install Poetry
    run: |
      curl -sSL https://install.python-poetry.org | python3 -
      echo "$HOME/.local/bin" >> $GITHUB_PATH

  - name: Install dependencies
    run: |
      cd backend
      poetry install --no-root

  - name: Build frontend
    run: |
      cd frontend
      npm install
      npm run build

  - name: Deploy to Azure Static Web Apps
    uses: Azure/static-web-apps-deploy@v1
    with:
      app_location: "frontend"
      api_location: "backend"
      output_location: "dist"
      azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}

Let me know if you'd like help reviewing your workflow file—happy to assist further!

Best,

Achref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants