Skip to content

Merge pull request #478 from CaptainFact/staging #675

Merge pull request #478 from CaptainFact/staging

Merge pull request #478 from CaptainFact/staging #675

Workflow file for this run

name: E2E/Integration tests
on: [push]
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
jobs:
cypress:
runs-on: ubuntu-20.04 # Remember to update this when changing Erlang version. See https://github.com/erlef/setup-beam
services:
db:
image: captainfact/dev-db:latest
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Checkout
- name: Checkout API
uses: actions/checkout@v3
with:
repository: CaptainFact/captain-fact-api
path: api
- name: Checkout Frontend
uses: actions/checkout@v2
with:
repository: CaptainFact/captain-fact-frontend
ref: refs/heads/staging
path: frontend
# Setup API
- name: Restore Elixir cache
uses: actions/cache@v3
with:
path: ./api/deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
- name: Restore Elixir build folder
uses: actions/cache@v1
with:
path: ./api/build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
- uses: erlef/setup-beam@v1
with:
version-file: ./api/.tool-versions
version-type: strict
- name: Install API's dependencies
working-directory: api
run: mix deps.get
- name: Compile dependencies
working-directory: api
run: mix deps.compile
- name: Compile project
working-directory: api
run: mix compile
- name: Prepare DB
working-directory: api
run: mix ecto.create && mix ecto.migrate
# Setup Frontend
- uses: actions/setup-node@v3
with:
node-version-file: "./frontend/.tool-versions"
cache-dependency-path: "./frontend/package-lock.json"
cache: "npm"
- name: Install Frontend's dependencies
working-directory: frontend
run: npm ci --prefer-offline --no-audit
# Run tests
- name: Start E2E tests
working-directory: api
run: ./scripts/run_e2e_ci.sh