'Github Actions workflow : can't change working directory - Error: An error occurred trying to start process '/usr/bin/bash' with working directory

I want to create a Github workflow to run the tests of my Flask application at each merge request. This is the first time I'm writing one so I'll take any advice.

Here are the content of .github/workflows/test.yml :

name: CI
on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]
  workflow_dispatch:
jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python 3.8
      uses: actions/setup-python@v2
      with:
        python-version: 3.8
    - name: Install dependencies
      working-directory: fizzbuzz
      run: |
        pwd 
        ls -al
        python -m pip install --upgrade pip
        pip install -r requirements.txt; 
    - name: Test with pytest
      working-directory: fizzbuzz
      run: |
        python -m pytest

However when pip install -r requirements.txt, I have : Error: An error occurred trying to start process '/usr/bin/bash' with working directory '/home/runner/work/fizzbuzz-project/fizzbuzz-project/fizzbuzz'. No such file or directory

My project is organized this way:

├── docker-compose.yml
├── fizzbuzz
│   ├── api
│   │   ├── app.py
│   │   ├── database.py
│   │   ├── __init__.py
│   │   ├── models.py
│   │   ├── static
│   │   │   └── swagger.yml
│   │   ├── utils.py
│   │   └── views.py
│   ├── Dockerfile
│   ├── pyproject.toml
│   ├── requirements.txt
│   └── tests
│       ├── test_api.py
│       └── test_utils.py
├── README.md

requirements.txt is in a subfolder so I tried to specify a working directory but it doesn't seem to work. I find it strange that in the error message /fizzbuzz-project is written twice in a row : '/home/runner/work/fizzbuzz-project/fizzbuzz-project/fizzbuzz'

pwd and ls -al don't seem to be displayed : Screenshot of the test job

If I don't specify a working directory then I get the error : ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

Do you know where the mistake was in what I did? Thank you very much in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source