add allure to all tests #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| name: Check out repository | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest-cov | |
| pip install webdriver-manager | |
| - name: Install Allure | |
| run: | | |
| wget https://github.com/allure-framework/allure2/releases/download/2.25.0/allure-2.25.0.zip | |
| unzip allure-2.25.0.zip | |
| export PATH=$PATH:$(pwd)/allure-2.25.0/bin | |
| echo "PATH=$PATH" >> $GITHUB_ENV | |
| - name: Run tests with Allure | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| mkdir -p allure-results | |
| pytest test/ --alluredir=allure-results -v | |
| - name: Generate Allure report | |
| run: | | |
| allure generate allure-results -o allure-report --clean | |
| - name: Upload Allure report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: allure-report | |
| path: allure-report/ | |
| - name: Run tests with HTML | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| mkdir -p reports | |
| pytest test/ --html=reports/report.html --self-contained-html | |
| - name: Upload HTML test report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-report | |
| path: reports/report.html | |
| - name: Run tests with Coverage | |
| env: | |
| PYTHONPATH: . | |
| run: | | |
| pytest test/ --cov=pages --cov-report=xml:coverage.xml --cov-report=html:htmlcov -v | |
| - name: Upload Coverage HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html-report | |
| path: htmlcov/ | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| file: ./coverage.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true |