Skip to content

.github/workflows/scrapers_runner.yml #361

.github/workflows/scrapers_runner.yml

.github/workflows/scrapers_runner.yml #361

on:
schedule:
- cron: '00 05 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Add Python Path
run: echo "PYTHONPATH=${{ github.workspace }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements.txt
sudo apt-get install curl
- name: Set up Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Download and install Allure Commandline 2.25.0
run: |
curl -o allure-commandline.zip -Ls https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.25.0/allure-commandline-2.25.0.zip
unzip allure-commandline.zip -d allure
rm allure-commandline.zip
chmod +x allure/allure-2.25.0/bin/allure
- name: Run pytest with Allure reporting
continue-on-error: true
env:
API_KEY: ${{ secrets.API_KEY }}
run: |
pytest tests/ --alluredir=docs/allure-results
- name: Keep previous run history
continue-on-error: true
run: |
allure/allure-2.25.0/bin/allure generate --clean docs/allure-results
rm -rf docs/allure-results/history
mv -f allure-report/history docs/allure-results
mv -f docs/environment.properties docs/allure-results
- name: Generate Executor JSON
run: |
echo '{
"name": "GitHub Actions",
"type": "github",
"url": "https://github.com/peviitor-ro/RaresTestHub/actions/runs/'"${GITHUB_RUN_ID}"'",
"buildName": "'"${GITHUB_RUN_NUMBER}"'",
"buildUrl": "https://github.com/peviitor-ro/RaresTestHub/actions/runs/'"${GITHUB_RUN_ID}"'",
"reportName": "Allure Report",
"reportUrl": "https://github.com/peviitor-ro/RaresTestHub/actions/runs/'"${GITHUB_RUN_ID}"'"
}' > docs/allure-results/executor.json
- name: Generate Allure report
run: |
allure/allure-2.25.0/bin/allure generate --single-file --clean docs/allure-results
- name: Move Allure results to docs folder
run: |
rm -rf docs/api_test_report.html
mv -f allure-report/index.html docs/api_test_report.html
- name: Commit and push Allure report
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add docs/api_test_report.html docs/allure-results
git commit -m "Add Allure test report"
git push origin main