Merge branch 'main' of github.com:correlation-one/expert-e2e into main #158
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: Playwright Tests | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 14 * * *' # Fixed cron syntax | |
jobs: | |
run-tests: | |
name: Run Playwright Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 # Updated to v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Create .env file from secrets | |
run: | | |
echo "EMAIL=${{ secrets.EMAIL }}" > .env | |
echo "PASSWORD=${{ secrets.PASS }}" >> .env | |
- name: Install Dependencies | |
run: npm ci # Use ci instead of install for more reliable builds | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Install Allure Command-Line Tool | |
run: npm install -g allure-commandline | |
- name: Manage Historical Reports | |
run: | | |
if [ -d "allure-results" ]; then | |
find "allure-results" -type f -name "*.json" -delete | |
fi | |
REPORTS_DIR="allure-results/history" | |
mkdir -p "$REPORTS_DIR" | |
if [ -d ".github/history" ]; then | |
cp -R ".github/history"/* "$REPORTS_DIR/" | |
fi | |
- name: Run Playwright Tests | |
run: npx playwright test | |
env: | |
EMAIL: ${{ secrets.EMAIL }} | |
PASSWORD: ${{ secrets.PASS }} | |
- name: Generate Allure Report | |
if: always() | |
run: allure generate allure-results --clean -o allure-report | |
- name: Save historical data | |
if: always() | |
run: | | |
if [ -d "allure-report/history" ]; then | |
mkdir -p .github/history | |
cp -R "allure-report/history"/* ".github/history/" | |
fi | |
- name: Commit and Push Allure Results and Reports | |
if: always() | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
git add .github/history | |
git commit -m "Update historical Data Allure" || echo "No changes to commit" | |
git push origin main | |
- name: Deploy to GitHub Pages | |
if: always() | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./allure-report | |
- name: Upload Artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |