Skip to content

[Don't merge]playwright導入テスト #1637

[Don't merge]playwright導入テスト

[Don't merge]playwright導入テスト #1637

Workflow file for this run

name: actions
on:
push:
branches:
- main
pull_request:
branches:
- "*"
# Allows you to run this workflow manually from the Actions tab
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
DATABASE_HOST: localhost
DATABASE_USER: postgres
DATABASE_PASSWORD: password
DATABASE_PORT: 5432
TZ: Asia/Tokyo
services:
db:
image: postgres:10.4-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
steps:
- name: ☑️ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: 💎 Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: 📦 Setup Playwright
run: |
# Setup Playwright driver
APP_ROOT=${GITHUB_WORKSPACE}
PLAYWRIGHT_VERSION=$(bundle exec ruby -e 'require "playwright"; puts Playwright::COMPATIBLE_PLAYWRIGHT_VERSION.strip')
DRIVER_URL="https://playwright.azureedge.net/builds/driver/playwright-$PLAYWRIGHT_VERSION-linux.zip"
DRIVER_DIR="$APP_ROOT/playwright-drivers"
mkdir -p "$DRIVER_DIR"
cd "$DRIVER_DIR"
wget -q "$DRIVER_URL" -O playwright.zip
unzip -o playwright.zip
rm playwright.zip
# Install Playwright globally
npm install -g playwright
# Install Playwright Chromium browser with dependencies
playwright install --with-deps chromium
- name: 🧪 Prepare DB
run: |
bundle exec rails db:create
bundle exec rails db:setup
- name: 🔧 Test
run: bundle exec rspec spec
env:
PLAYWRIGHT_DRIVER_PATH: ${{ github.workspace }}/playwright-drivers/package/cli.js
deploy:
needs: test
if: github.ref == 'refs/heads/main'
# TODO: This workflows depend on Ubuntu version.
# https://github.com/AkhileshNS/heroku-deploy/issues/186
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}