test: trigger CI workflow #22
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 - Code Testing Workflow | |
| on: | |
| pull_request: | |
| branches: | |
| - develop | |
| - main | |
| - "feature/*" | |
| - "hotfix/*" | |
| paths: | |
| - "src/**" | |
| - "tests/**" | |
| - ".github/workflows/**" | |
| jobs: | |
| test: | |
| name: Run Tests and Post Coverage | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| checks: write | |
| pages: write # added for publishing | |
| id-token: write # needed by some actions | |
| env: | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| API_KEY: ${{ secrets.API_KEY }} | |
| WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.9" | |
| - name: Install dependencies | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| pip install --upgrade pip | |
| pip install pytest pytest-cov allure-pytest | |
| pip install -r requirements.txt | |
| - name: Run tests with coverage + allure results | |
| run: | | |
| source venv/bin/activate | |
| pytest --cov=src --cov-report=xml --cov-report=term \ | |
| --alluredir=allure-results > coverage.txt | |
| pytest --junitxml=pytest.xml | |
| - name: Generate Allure Report | |
| if: always() | |
| run: | | |
| source venv/bin/activate | |
| pip install allure-behave | |
| allure generate allure-results -o allure-report --clean | |
| - name: Pytest coverage comment | |
| uses: MishaKav/pytest-coverage-comment@main | |
| with: | |
| pytest-coverage-path: ./coverage.txt | |
| junitxml-path: ./pytest.xml | |
| - name: Publish Allure Report | |
| uses: afiore/action-allure-report-publish@v0.5.0 | |
| if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' | |
| with: | |
| allure_results: allure-results | |
| allure_report: allure-report | |
| allure_history: allure-history | |
| gh_pages: true | |
| gh_pages_branch: gh-pages |