Skip to content

Commit

Permalink
e2e tests (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbroeren authored Oct 17, 2024
1 parent 1938cca commit 7eae474
Show file tree
Hide file tree
Showing 41 changed files with 3,640 additions and 1,001 deletions.
File renamed without changes.
114 changes: 98 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ on:
paths-ignore:
- 'guides/**'


permissions:
contents: write

jobs:
test:
name: "test: OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | Phoenix ${{matrix.phoenix}} | LiveView ${{matrix.phoenix-live-view}} | PG ${{matrix.postgres}}"
name: "test: OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | Phoenix ${{matrix.phoenix}} | LV ${{matrix.phoenix-live-view}}"

strategy:
fail-fast: false
Expand All @@ -25,19 +24,19 @@ jobs:
# minimum required versions
- otp: "25.1"
elixir: "1.14.0"
phoenix-version: "1.7.0"
phoenix-live-view-version: "0.20.2"
phoenix: "1.7.0"
phoenix-live-view: "0.20.2"

# latest
- otp: "27"
elixir: "1.17"
phoenix-version: "~> 1.7"
phoenix-live-view-version: "~> 0.20"
phoenix: "~> 1.7"
phoenix-live-view: "~> 0.20"

env:
MIX_ENV: test
PHOENIX_VERSION: ${{matrix.phoenix-version}}
PHOENIX_LIVE_VIEW_VERSION: ${{matrix.phoenix-live-view-version}}
PHOENIX_VERSION: ${{matrix.phoenix}}
PHOENIX_LIVE_VIEW_VERSION: ${{matrix.phoenix-live-view}}

runs-on: ubuntu-20.04

Expand Down Expand Up @@ -73,9 +72,9 @@ jobs:
path: |
deps
_build
key: mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix-version }}-${{ matrix.phoenix-live-view-version }}-${{ hashFiles('**/mix.lock') }}
key: mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix }}-${{ matrix.phoenix-live-view }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix-version }}-${{ matrix.phoenix-live-view-version }}-${{ hashFiles('**/mix.lock') }}
mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix }}-${{ matrix.phoenix-live-view }}-${{ hashFiles('**/mix.lock') }}
- run: mix deps.get

Expand All @@ -88,8 +87,91 @@ jobs:
epmd -daemon
mix test
e2e-test:
name: "e2e-test: OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | Phoenix ${{matrix.phoenix}} | LV ${{matrix.phoenix-live-view}}"

strategy:
fail-fast: false
matrix:
include:
# latest
- otp: "27"
elixir: "1.17"
phoenix: "~> 1.7"
phoenix-live-view: "~> 0.20"

env:
MIX_ENV: e2e
PHOENIX_VERSION: ${{matrix.phoenix}}
PHOENIX_LIVE_VIEW_VERSION: ${{matrix.phoenix-live-view}}

runs-on: ubuntu-20.04
timeout-minutes: 60

services:
postgres:
image: postgres:13.1
env:
POSTGRES_DB: beacon_live_admin_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install OS packages
uses: ConorMacBride/install-package@v1
with:
apt: unzip openssl

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}

- name: Cache mix deps
uses: actions/cache@v4
id: cache-deps
with:
path: |
deps
_build
key: mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix }}-${{ matrix.phoenix-live-view }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix }}-${{ matrix.phoenix-live-view }}-${{ hashFiles('**/mix.lock') }}
- name: Restore npm cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm run setup

- run: npm run e2e:setup

- name: Run e2e tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:${{job.services.postgres.ports[5432]}}/beacon_live_admin_test
run: npm run e2e:test

quality:
name: "quality: OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | Phoenix ${{matrix.phoenix-version}} | LiveView ${{matrix.phoenix-live-view-version}}"
name: "quality: OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | Phoenix ${{matrix.phoenix}} | LiveView ${{matrix.phoenix-live-view}}"

strategy:
fail-fast: false
Expand All @@ -98,8 +180,8 @@ jobs:
# latest
- otp: "27"
elixir: "1.17"
phoenix-version: "~> 1.7"
phoenix-live-view-version: "~> 0.20"
phoenix: "~> 1.7"
phoenix-live-view: "~> 0.20"

env:
MIX_ENV: dev
Expand All @@ -114,8 +196,8 @@ jobs:
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}

- name: Cache mix deps
uses: actions/cache@v4
Expand All @@ -124,9 +206,9 @@ jobs:
path: |
deps
_build
key: mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix-version }}-${{ matrix.phoenix-live-view-version }}-${{ hashFiles('**/mix.lock') }}
key: mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix }}-${{ matrix.phoenix-live-view }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix-version }}-${{ matrix.phoenix-live-view-version }}-${{ hashFiles('**/mix.lock') }}
mix-${{ env.MIX_ENV }}-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ matrix.phoenix }}-${{ matrix.phoenix-live-view }}-${{ hashFiles('**/mix.lock') }}
- run: mix deps.get

Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ beacon_live_admin-*.tar

# In case you use Node.js/npm, you want to ignore these.
npm-debug.log
node_modules/
/assets/node_modules/

# Dialyzer PTLs
Expand All @@ -59,3 +60,11 @@ npm-debug.log

# `direnv` local environment config
.envrc

node_modules

# e2e test
/test/e2e/test-results/
/blob-report/
/playwright-report/
/playwright/.cache/
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
css/app.css
/assets/vendor/
package-lock.json
/guides/
/priv/static/
*.md
*.yml
File renamed without changes.
3 changes: 0 additions & 3 deletions assets/.prettierignore

This file was deleted.

Loading

0 comments on commit 7eae474

Please sign in to comment.