Skip to content

Commit

Permalink
Merge pull request #270 from JarvusInnovations/develop
Browse files Browse the repository at this point in the history
Release: v1.16.0
  • Loading branch information
themightychris authored Jun 21, 2021
2 parents 4d10018 + b64ea03 commit 9d318aa
Show file tree
Hide file tree
Showing 38 changed files with 1,585 additions and 1,357 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,15 @@ on:
branches: ['releases/v*']
types: [closed]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
release-deploy:

if: github.event.pull_request.merged == true # only run on PR merge
runs-on: ubuntu-latest
steps:

- name: Grab PR Title
- name: Configure release
run: |
set -e
PR_TITLE=$(jq -r ".pull_request.title" $GITHUB_EVENT_PATH)
PR_BODY=$(jq -r ".pull_request.body" $GITHUB_EVENT_PATH)
RELEASE_TAG=$(echo "${PR_TITLE}" | grep -oP "(?<=^Release: )v\d+\.\d+\.\d+(-rc\.\d+)?$")
Expand All @@ -37,14 +32,12 @@ jobs:
echo "${PR_BODY}" >> $GITHUB_ENV
echo 'END_OF_PR_BODY' >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
uses: ncipollo/release-action@v1
with:
tag_name: '${{ env.RELEASE_TAG }}'
release_name: '${{ env.RELEASE_TAG }}'
token: ${{ secrets.GITHUB_TOKEN }}
commit: '${{ github.sha }}'
tag: '${{ env.RELEASE_TAG }}'
body: '${{ env.PR_BODY }}'
draft: false
prerelease: ${{ env.RELEASE_PRERELEASE }}
6 changes: 2 additions & 4 deletions .github/workflows/release-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Grab PR Title
- name: Validate PR title
run: |
set -e
PR_TITLE=$(jq -r ".pull_request.title" $GITHUB_EVENT_PATH)
# check title format and extract tag
Expand All @@ -30,7 +28,7 @@ jobs:
fi
# check that tag doesn't exist
if git ls-remote --exit-code origin "refs/tags/${RELEASE_TAG}"; then
if git ls-remote --exit-code "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}" "refs/tags/${RELEASE_TAG}"; then
echo "The PR title's version exists already"
exit 1
fi
111 changes: 111 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: 'Test: End-to-end'

on: pull_request

env:
HAB_LICENSE: accept-no-persist
HOLO_CACHE_TO: origin
HOLO_CACHE_FROM: origin

jobs:
test-e2e:

runs-on: ubuntu-latest
steps:

- 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@action/v1
env:
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: Waiting for MySQL
run: |
until nc -z localhost 3306; do
sleep 0.5
echo -n "."
done
- name: Waiting for Emergence runtime
run: |
until nc -z localhost 9123; do
sleep 0.5
echo -n "."
done
- name: Configure command-line client access
run: |
sudo chmod ugo+xr \
/hab/svc/mysql/config \
/hab/svc/mysql/config/client.cnf \
/hab/svc/php-runtime/config \
/hab/svc/php-runtime/config/fpm-exec
ln -sf /hab/svc/mysql/config/client.cnf ~/.my.cnf
- name: Load site projection into emergence runtime
env:
HOLO_CACHE_FROM: origin
HOLO_CACHE_TO: origin
run: |
SITE_TREE="$(hab pkg exec jarvus/hologit git-holo project emergence-site)"
[ -n "${SITE_TREE}" ] || exit 1
hab pkg exec emergence/php-runtime emergence-php-load "${SITE_TREE}"
- 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@v2
env:
GIT_DIR: ${{ github.workspace }}/.git
GIT_WORK_TREE: ${{ github.workspace }}
with:
env: STUDIO_CONTAINER=,STUDIO_SSH=
working-directory: ${{ github.workspace }}.cypress-workspace

- name: Upload supervisor log
uses: actions/upload-artifact@v1
if: always()
with:
name: supervisor-log
path: /hab/sup/default/sup.log

- name: Upload Cypress screenshots
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: ${{ github.workspace }}.cypress-workspace/cypress/screenshots

- name: Upload Cypress videos
uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: ${{ github.workspace }}.cypress-workspace/cypress/videos
7 changes: 7 additions & 0 deletions .holo/branches/cypress-workspace/_skeleton-v1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[holomapping]
files = [
"cypress/**",
"cypress.json",
"package.json",
"package-lock.json",
]
1 change: 0 additions & 1 deletion .holo/lenses/emergence-cms-editor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ files = [
"EmergenceContentEditor/**",
"packages/emr-skeleton-theme/**",
"packages/emergence-cms/**",
"packages/emergence-cms-summaries/**",
"packages/emergence-apikit/**",
"packages/jarvus-apikit/**",
"packages/jarvus-fileupload/**",
Expand Down
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"baseUrl": "http://localhost:7080",
"env": {
"STUDIO_SSH": null,
"STUDIO_CONTAINER": "emergence-studio"
"STUDIO_CONTAINER": "skeleton-studio"
},
"viewportWidth": 1200,
"viewportHeight": 660
Expand Down
110 changes: 110 additions & 0 deletions cypress/integration/blog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
describe('Blogging', () => {

// reset database before tests
before(() => {
cy.resetDatabase();
});

it('Create post', () => {
cy.loginAs('user', 'user');

cy.visit('/blog');

cy.contains('Create a Post').click();

cy.get('.x-panel.emergence-cms-editor .x-btn[id^=emergence-cms-toolbar-][id$=-menu-trigger]')
.click();

cy.contains('.x-menu-item-text[id^=menuitem-]', 'Publish on save')
.click();

cy.contains('.x-menu-item-text[id^=menucheckitem-]', 'Publish on save')
.click();

cy.get('input[id^=datefield-]')
.type('{selectall}01/02/2030');

cy.get('input[id^=timefield-]')
.type('{selectall}4:05 pm{enter}');

cy.get('.x-component.emergence-cms-preview time[data-ref="timeEl"]')
.should('contain', 'Wednesday, January 2, 2030 at 4:05 pm')
.click();

cy.get('.x-panel.emergence-cms-editor .x-btn[id^=emergence-cms-toolbar-][id$=-menu-trigger]')
.click();

cy.contains('.x-menu-item-text[id^=menuitem-]', '1/2/2030 4:05 pm');

cy.get('.x-field.field-title input')
.type('Hello world!')
.tab();

cy.focused()
.should('contain', 'Save')
.tab();

cy.focused()
.wait(500)
.type('tag1{enter}tag2');

cy.get('.x-panel-body .x-field textarea')
.type('## Header 2{enter}{enter}### Header 3{enter}{enter}- point 1{enter}- point2{enter}');

cy.contains('.x-btn.save-btn', 'Save')
.click();

cy.location('pathname').should('eq', '/blog/hello_world/edit');
cy.location('search').should('be.empty');

cy.get('.x-component.emergence-cms-preview').within(() => {

cy.get('time[data-ref="timeEl"]')
.should('contain', 'Wednesday, January 2, 2030 at 4:05 pm');

cy.get('[data-ref=tagsCt] a')
.should('have.length', 2)
.first()
.should('have.attr', 'href', '/tags/tag1')
.should('have.text', 'tag1')
.next()
.should('have.attr', 'href', '/tags/tag2')
.should('have.text', 'tag2');
});
});

it('Edit post', () => {
cy.loginAs('user', 'user');

cy.visit('/drafts');

cy.contains('Hello world!')
.should('have.attr', 'href', '/blog/hello_world')
.click();

cy.contains('Edit')
.should('have.attr', 'href', '/blog/hello_world/edit')
.click();

cy.get('.x-panel.emergence-cms-editor .x-btn[id^=emergence-cms-toolbar-][id$=-menu-trigger]')
.click();

cy.contains('.x-menu-item-text[id^=menuitem-]', '1/2/2030 4:05 pm')
.click();

cy.get('input[id^=timefield-]')
.type('{selectall}6:07 pm{enter}');

cy.get('.x-component.emergence-cms-preview time[data-ref="timeEl"]')
.should('contain', 'Wednesday, January 2, 2030 at 6:07 pm')
.click();

cy.contains('.x-btn.save-btn', 'Save')
.click();

cy.reload();

cy.get('.x-component.emergence-cms-preview time[data-ref="timeEl"]')
.should('contain', 'Wednesday, January 2, 2030 at 6:07 pm');
});
});
Loading

0 comments on commit 9d318aa

Please sign in to comment.