Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cypress testing #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Cypress Tests

on: pull_request

jobs:
cypress-tests:
runs-on: ubuntu-latest
steps:
- name: Initialize Chef Habitat artifacts cache directory
run: |
sudo mkdir -p /hab/cache/artifacts
sudo chown runner:docker -R /hab
- name: Cache Chef Habitat artifacts
uses: actions/cache@v1
with:
path: /hab/cache/artifacts
key: hab-cache-artifacts
- uses: actions/checkout@v2
# TODO: wrap the next three steps an an emergence-studio action
- name: 'Stop default mysql service'
run: sudo service mysql stop
- name: 'Initialize Chef Habitat environment'
uses: JarvusInnovations/habitat-action@master
env:
HAB_LICENSE: accept
HAB_NGINX: |
[http.listen]
port = 7080
HAB_MYSQL: |
app_username = 'appadmin'
app_password = 'appadmin'
bind = '0.0.0.0'
HAB_PHP_RUNTIME: |
[sites.default.holo]
gitDir = '${{ github.workspace }}/.git'
with:
deps: |
jarvus/hologit
supervisor: |
core/mysql
emergence/php-runtime --bind="database:mysql.default"
emergence/nginx --bind="backend:php-runtime.default"
- name: Load site projection into emergence runtime
env:
HOLO_CACHE_FROM: origin
HOLO_CACHE_TO: origin
run: |
until sudo test -f /hab/svc/php-runtime/config/fpm-exec; do sleep .1; done
SITE_TREE="$(hab pkg exec jarvus/hologit git-holo project emergence-site)"
[ -n "${SITE_TREE}" ] || exit 1
sudo hab pkg exec emergence/php-runtime emergence-php-load "${SITE_TREE}"
sudo chown runner:docker -R /hab/cache/artifacts
- name: Set up Cypress workspace
run: |
CYPRESS_TREE="$(hab pkg exec jarvus/hologit git-holo project cypress-workspace)"
[ -n "${CYPRESS_TREE}" ] || exit 1
mkdir "${GITHUB_WORKSPACE}.cypress-workspace"
git archive --format=tar "${CYPRESS_TREE}" | (cd "${GITHUB_WORKSPACE}.cypress-workspace" && tar xf -)
- name: Run Cypress tests
uses: cypress-io/github-action@v1
with:
env: STUDIO_CONTAINER=,STUDIO_SSH=
working-directory: ${{ github.workspace }}.cypress-workspace
- uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: ${{ github.workspace }}.cypress-workspace/cypress/screenshots
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: ${{ github.workspace }}.cypress-workspace/cypress/videos
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[holomapping]
files = "cypress/**"
after = "*"
11 changes: 11 additions & 0 deletions .holo/branches/cypress-workspace/_slate.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[holomapping]
files = [
"package.json",
"package-lock.json",
"cypress.json",
"cypress/**",

# ignore fixtures submodule
"!cypress/fixtures/database"
]
before = "*"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[holomapping]
holosource = "slate-fixtures"
files = "*.sql"
3 changes: 3 additions & 0 deletions .holo/sources/slate-fixtures.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[holosource]
url = "https://github.com/SlateFoundation/slate-fixtures.git"
ref = "refs/heads/cbl/demo"