Skip to content

Commit

Permalink
feat: add cypress testing
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed May 6, 2020
1 parent be2c473 commit 95a851d
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 0 deletions.
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"

0 comments on commit 95a851d

Please sign in to comment.