Skip to content

Commit

Permalink
Updated GH actions OS versions, install Playwright in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantemss committed Oct 18, 2024
1 parent c915db9 commit 1e3bb33
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ on:
jobs:
assets:
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build assets
run: |
bundle install --jobs 4 --retry 3
bundle exec rake assets:precompile
run: bin/rails assets:precompile
4 changes: 2 additions & 2 deletions .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
jobs:
migrations:
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:11
image: postgres:14
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand Down
25 changes: 20 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ on:
jobs:
tests:
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:11
image: postgres:14
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand All @@ -35,10 +35,25 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Playwright
- run: yarn
- name: Ensure playwright gem and package.json versions match
run: |
yarn
yarn playwright install
ruby_playwright=$(bundle exec ruby -e 'require "playwright"; puts Playwright::COMPATIBLE_PLAYWRIGHT_VERSION.strip')
package_json_playwright=$(yarn list --pattern @playwright/test --json | jq '.data.trees[].name | .[17:]' -r)
[[ $ruby_playwright = $package_json_playwright ]]
# https://justin.searls.co/posts/running-rails-system-tests-with-playwright-instead-of-selenium/
- name: Cache Playwright Chromium browser
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Chromium browser (with deps)
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps chromium
- name: Install Playwright Chromium browser deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: yarn playwright install-deps chromium
- name: Test
env:
WORKERS: 4
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "OpenStax",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@playwright/test": "^1.48.1",
"@playwright/test": "1.48.1",
"@types/node": "^22.7.6"
},
"scripts": {}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# yarn lockfile v1


"@playwright/test@^1.48.1":
"@playwright/[email protected]":
version "1.48.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.48.1.tgz#343e710fcf2e559529e3ec8d7782e09f325b9396"
integrity sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==
Expand Down

0 comments on commit 1e3bb33

Please sign in to comment.