Skip to content

add ТС_005.001.017 - ТС_005.001.020 and refactor all test #70

add ТС_005.001.017 - ТС_005.001.020 and refactor all test

add ТС_005.001.017 - ТС_005.001.020 and refactor all test #70

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
download-history:
name: Download history
runs-on: ubuntu-latest
steps:
- name: setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Get previous run artifact
run: >
ARTIFACT_ID=$(curl -L
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
"https://api.github.com/repos/py-AQA/LumaProjectPython_2024_spring/actions/artifacts?name=allure-results"
| python -c "import sys, json; print(json.load(sys.stdin)['artifacts'][0]['id']);")
&&
curl -L
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer ${{ secrets.TOKEN }}"
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/repos/py-AQA/LumaProjectPython_2024_spring/actions/artifacts/$ARTIFACT_ID/zip
-o artifacts.zip &&
REPORT_ID=$(curl -L
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
"https://api.github.com/repos/py-AQA/LumaProjectPython_2024_spring/actions/artifacts?name=github-pages"
| python -c "import sys, json; print(json.load(sys.stdin)['artifacts'][0]['id']);")
&&
curl -L
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer ${{ secrets.TOKEN }}"
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/repos/py-AQA/LumaProjectPython_2024_spring/actions/artifacts/$REPORT_ID/zip
-o pages.zip
continue-on-error: true
- run: mkdir allure-results && unzip artifacts.zip -d allure-results
continue-on-error: true
- run: mkdir old_pages pages_history && unzip pages.zip -d old_pages && tar -xvf old_pages/artifact.tar -C pages_history
continue-on-error: true
- run: cp pages_history/history/* allure-results && cp -r pages_history/history allure-results
continue-on-error: true
- name: Store allure history
uses: actions/upload-artifact@v3
with:
name: allure-results
path:
allure-results
retention-days: 1
run-test:
name: 'Run tests'
needs: download-history
runs-on: ubuntu-latest
steps:
- name: Git clone
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install requirements
run: |
pip install -r requirements.txt
- name: Run tests
run: |
pytest -n2
env:
CI_RUN: true
PYTHONDONTWRITEBYTECODE: 1
PYTHONUNBUFFERED: 1
continue-on-error: true
- name: Store allure results
uses: actions/upload-artifact@v3
with:
name: allure-results
path:
allure-results
retention-days: 1
generate-report:
runs-on: ubuntu-latest
needs: run-test
name: Generate report
steps:
- name: Install JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: Install allure
run: |
sudo wget https://github.com/allure-framework/allure2/releases/download/2.29.0/allure-2.29.0.tgz && sudo tar -zxvf allure-2.29.0.tgz -C /opt/ && sudo ln -s /opt/allure-2.29.0/bin/allure /usr/bin/allure
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Run allure generate
run: |
allure generate -c allure-results -o _site
- name: Store generated report
uses: actions/upload-artifact@v3
with:
name: _site
path:
_site
retention-days: 1
publish-report:
runs-on: ubuntu-latest
needs: generate-report
name: Report publication
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
- name: Deploy to gitHub Pages
id: deployment
uses: actions/deploy-pages@v1.2.9