CI #8
This file contains 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, pull_request ] | |
on: workflow_dispatch | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.12 | |
- name: Install Chrome | |
run: sudo apt-get install google-chrome-stable | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Run tests | |
run: | | |
pytest -s -vv --alluredir=allure-results | |
- name: Add allure information | |
working-directory: allure-results | |
if: always() | |
run: | | |
echo GIT_BRANCH=${{ github.head_ref || github.ref_name }} >> environment.properties | |
echo GIT_COMMIT_ID=${{ github.sha }} >> environment.properties | |
echo GIT_COMMIT_MESSAGE=$(git show -s --format=%s HEAD) >> environment.properties | |
echo GIT_COMMIT_AUTHOR_NAME=$(git show -s --format='%ae' HEAD) >> environment.properties | |
echo GIT_COMMIT_TIME=$(git show -s --format=%ci HEAD) >> environment.properties | |
echo CHROME_VERSION=$(google-chrome --product-version) >> environment.properties | |
- name: Checkout (copy) gh-pages repository to GitHub runner | |
uses: actions/checkout@v2 | |
if: always() | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Copy history from gh-pages to allure-results | |
if: always() | |
run: | | |
sudo mkdir -p allure-results/history gh-pages/history | |
sudo cp -R gh-pages/history/* allure-results/history/ | |
- name: Generate Allure report | |
if: always() | |
run: | | |
sudo docker-compose run regression /bin/sh -c "allure generate allure-results --clean -o allure-report" | |
# - name: Update Allure history | |
# if: always() | |
# run: | | |
# sudo cp -R allure-report/history/* gh-pages/history/ | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: always() | |
with: | |
token: ${{ secrets.CI_TOKEN }} | |
branch: gh-pages | |
folder: allure-report | |
# history dir: allure-history | |
#clean: true | |
# Make sure you have the previous report generated in the allure-report directory. | |
# Remove the allure-results directory. | |
# Run the tests. | |
# Copy the allure-report/history subdirectory to allure-results/history. | |
# Generate the new report. | |
# If you follow such a routine regularly, | |
# Allure will each time keep data from up to 20 latest reports in allure-results/history. | |
# This creates up to 20 history entries for each test and up to 20 columns in each graph. |