Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
7b25d59
Rename workflow for translations.
kopepasah Nov 30, 2022
4ae2123
Try running php test.
kopepasah Nov 30, 2022
53dc546
Add JS tests.
kopepasah Nov 30, 2022
8ee1e47
Add accessibility test.
kopepasah Nov 30, 2022
e105581
Breakout install and build.
kopepasah Nov 30, 2022
150c530
Breakout tests.
kopepasah Nov 30, 2022
fcb35c7
Break out php unit tests.
kopepasah Nov 30, 2022
e79cfa4
Rename some workflows.
kopepasah Nov 30, 2022
8daac37
do not stack.
kopepasah Nov 30, 2022
d285da7
Add e2e test.
kopepasah Nov 30, 2022
2585707
Where are we?
kopepasah Nov 30, 2022
7203b54
How about now?
kopepasah Nov 30, 2022
b722a51
Show all.
kopepasah Nov 30, 2022
60ad451
Try here.
kopepasah Nov 30, 2022
fa6f614
Try here.
kopepasah Nov 30, 2022
d34e520
Breakout.
kopepasah Nov 30, 2022
299c541
One last try.
kopepasah Nov 30, 2022
557f874
Try test again.
kopepasah Nov 30, 2022
a5ab91b
Run without record.
kopepasah Nov 30, 2022
c7279aa
Try with this key.
kopepasah Nov 30, 2022
aba50af
Run without using cypress dashboard.
kopepasah Dec 1, 2022
15bea05
Run using key.
kopepasah Dec 1, 2022
d3094d7
Set as variable.
kopepasah Dec 1, 2022
b7d7697
Try from called workflow.
kopepasah Dec 2, 2022
bcebf78
Breakout steps.
kopepasah Dec 2, 2022
61a215d
Switch to secrets.
kopepasah Dec 2, 2022
4b22c42
Try one test.
kopepasah Dec 6, 2022
5ce30bb
Try alert
kopepasah Dec 6, 2022
e29b631
Try matrix.
kopepasah Dec 6, 2022
92ea96e
Try with before.
kopepasah Dec 6, 2022
8163597
Try run-name.
kopepasah Dec 6, 2022
b05902e
Simplify.
kopepasah Dec 6, 2022
c31d2be
Move run-name.
kopepasah Dec 6, 2022
f62a1d9
Remove run-name.
kopepasah Dec 6, 2022
35b7703
Try running outside.
kopepasah Dec 6, 2022
bc570cf
Try simplified names.
kopepasah Dec 6, 2022
70f1488
Remove disable.
kopepasah Dec 6, 2022
42972e3
Move additional code.
kopepasah Dec 6, 2022
f5b6559
Show the spec
kopepasah Dec 6, 2022
1eac487
Get spec.
kopepasah Dec 6, 2022
941867d
list the spec.
kopepasah Dec 6, 2022
7999603
Show more.
kopepasah Dec 6, 2022
eff7db1
Show me more.
kopepasah Dec 6, 2022
6283b14
Without src.
kopepasah Dec 6, 2022
ebca515
find
kopepasah Dec 6, 2022
53680f2
Use find.
kopepasah Dec 6, 2022
d0f1f0c
Revert "Move additional code."
kopepasah Dec 6, 2022
9a70706
Change testing url.
kopepasah Dec 6, 2022
85bf17e
Update readme.md.
kopepasah Dec 6, 2022
b4eb117
Try in beforeEach.
kopepasah Dec 6, 2022
8fca9b1
Try before with cypress.
kopepasah Dec 6, 2022
af7d2e3
Run a couple more cleans.
kopepasah Dec 6, 2022
3222d6f
Run helper again.
kopepasah Dec 6, 2022
c3f522a
record the failure
kopepasah Dec 6, 2022
b88e613
Update path.
kopepasah Dec 6, 2022
c789f2c
Try without foreach.
kopepasah Dec 6, 2022
e5dfb7b
Just author.
kopepasah Dec 6, 2022
5991215
Add some more jobs.
kopepasah Dec 6, 2022
a6beae9
Try remove after save.
kopepasah Dec 6, 2022
0e0b04e
Change fail video name.
kopepasah Dec 6, 2022
4411c74
Try this change.
kopepasah Dec 6, 2022
6a7fbda
Remove BeforeEach on alert.
kopepasah Dec 6, 2022
a8e2ed1
Try toggling on block clear.
kopepasah Dec 6, 2022
167c826
Change filename.
kopepasah Dec 6, 2022
ec4ccae
Readd before each.
kopepasah Dec 6, 2022
786b1c1
change
kopepasah Dec 6, 2022
0410c01
Change.
kopepasah Dec 6, 2022
1e7537c
1670311139
kopepasah Dec 6, 2022
9ac1c55
1670311867
kopepasah Dec 6, 2022
ca423e7
Add deploy release workflow.
kopepasah Dec 6, 2022
5ca3ed7
Remove run on push.
kopepasah Dec 6, 2022
4789933
Merge branch 'feature/github-actions-migration' into feature/github-a…
kopepasah Dec 6, 2022
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
6 changes: 4 additions & 2 deletions .dev/tests/cypress/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ export function savePage() {
*/

export function checkForBlockErrors( blockName ) {
disableGutenbergFeatures();

cy.get( '.block-editor-warning' ).should( 'not.exist' );

cy.get( 'body.php-error' ).should( 'not.exist' );
Expand Down Expand Up @@ -230,6 +228,10 @@ export function clearBlocks() {
safeWin.wp.data.dispatch( 'core/block-editor' ).removeBlocks(
safeWin.wp.data.select( 'core/block-editor' ).getBlocks().map( ( block ) => block.clientId )
);

if ( safeWin.wp.data.select( 'core/edit-post' ).isFeatureActive( 'welcomeGuide' ) ) {
safeWin.wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'welcomeGuide' );
}
} );
}

Expand Down
2 changes: 1 addition & 1 deletion .dev/tests/cypress/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Welcome to our end-to-end testing suite for CoBlocks blocks! There are a number
### Add your local test credentials
```bash
$ echo '{
"testURL": "https://coblocks.test",
"testURL": "https://localhost:8889",
"wpUsername": "admin",
"wpPassword": "password",
}' > cypress.env.json
Expand Down
14 changes: 0 additions & 14 deletions .dev/tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
import { disableGutenbergFeatures, isNotWPLocalEnv, loginToSite } from '../helpers';

before( function() {
loginToSite().then( () => {
if ( isNotWPLocalEnv() ) {
// Waiting to see if the Welcome Guide will show up. Could probably be improved, but
// for the moment, it seems hard to tie the wait to something else
cy.wait( 10000 );
}

disableGutenbergFeatures();
} );
} );

// Maintain WordPress logged in state
Cypress.Cookies.defaults( {
preserve: /wordpress_.*/,
Expand Down
103 changes: 100 additions & 3 deletions .github/workflows/deploy-create-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: 'Deploy / Create Release'

on:
pull_request:
branches:
- master
milestone:
types: [ closed ]

Expand All @@ -12,6 +9,106 @@ env:
ARTIFACT_ZIP: 'coblocks.zip'

jobs:
update:
name: Update version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Setup git user
uses: godaddy-wordpress/setup-godaddy-git-user@v1

# Yarn is still required on this project, so we need to make sure it is
# installed globally.
- name: Install yarn
run: npm i -g yarn

- name: Set version
run: |
echo "NEW_TAG_VERSION=${{ github.event.milestone.title }}" >> $GITHUB_ENV

- name: Validate tag version
run: |
MATCH='^([0-9]+\.){2}(\*|[0-9]+)(-.*)?$'
if ! [[ $NEW_TAG_VERSION =~ $MATCH ]]; then
echo "::error::Milestone title does not match semver format: '$NEW_TAG_VERSION'"
exit 1
fi

- name: Install dependencies
run: |
yarn install --immutable

- name: Run version update
run: yarn version --new-version $NEW_TAG_VERSION

- name: Push changes
run: |
git add .
git commit -m "Updating to version $NEW_TAG_VERSION" --no-verify
git push

build:
name: Build
uses: ./.github/workflows/deploy-create-artifact.yml
needs: update

tag:
runs-on: ubuntu-latest
name: Tag new version
needs: update
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup git user
uses: godaddy-wordpress/setup-godaddy-git-user@v1

- name: Set version
run: |
echo "NEW_TAG_VERSION=${{ github.event.milestone.title }}" >> $GITHUB_ENV

- name: Publish new tag
run: |
git tag $NEW_TAG_VERSION
git push origin $NEW_TAG_VERSION

release:
runs-on: ubuntu-latest
name: Create new release
needs: [ build, tag ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.repository.default_branch }}

- name: Set release version
run: |
echo "RELEASE_VERSION=${{ github.event.milestone.title }}" >> $GITHUB_ENV

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create $RELEASE_VERSION -n "${{ github.event.milestone.description }}" -t "$RELEASE_VERSION"

- name: Download theme
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}

- name: Upload asset to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload $RELEASE_VERSION ${{ env.ARTIFACT_ZIP }}
53 changes: 53 additions & 0 deletions .github/workflows/test-accessibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: WIP Test / Accessibility

on:
pull_request:
branches:
- master

jobs:
pa11y:
name: Pa11y
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
with:
core: 'WordPress/WordPress#6.1'
phpVersion: '7.4'
plugins: '[".","https://downloads.wordpress.org/plugin/woocommerce.zip"]'
themes: '["https://downloads.wordpress.org/theme/go.zip"]'

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1

- name: Install dependencies
run: |
npm i -g yarn
composer install
yarn install --immutable

- name: Build plugin
run: |
yarn build

- name: Prepare tests
run: |
wp-env run cli "wp db import wp-content/plugins/coblocks/.dev/tests/a11y/coblocks_pa11y.sql"

- name: Run tests
run: |
A11Y=$(yarn test:a11y)
echo "$A11Y"
if [[ $A11Y != *"All accessibility tests have passed"* ]]; then
exit 1
fi
97 changes: 97 additions & 0 deletions .github/workflows/test-e2e-cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: WIP Test / E2E

on:
workflow_call:
inputs:
browser:
required: false
type: string
default: chrome
theme:
required: false
type: string
default: go
wpVersion:
required: false
type: string
default: ""
phpVersion:
required: false
type: string
default: "8.1"
secrets:
record-key:
description: 'Record key for Cypress Dashboard'
required: true

jobs:
test_cypress_e2e:
name: E2E Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
spec:
- alert.cypress.js
- author.cypress.js

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
with:
core: ${{ inputs.wpVersion }}
phpVersion: ${{ inputs.phpVersion }}
plugins: '["."]'
themes: '["https://downloads.wordpress.org/theme/go.zip"]'

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Setup WP-CLI
uses: godaddy-wordpress/setup-wp-cli@1

- name: Install dependencies
run: |
composer install --prefer-dist --optimize-autoloader &
yarn install --immutable

- name: Build plugin
run: |
yarn build

- name: Prepare Go
if: ${{ inputs.theme == 'go' }}
run: |
cd $(wp-env install-path)/go
mkdir -p coblocks/icons
echo '<svg height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><circle class="inner-circle" cx="20" cy="20" r="8" stroke-width="8" stroke-dasharray="50.2655 50.2655" stroke-dashoffset="0"></circle></svg>' >> coblocks/icons/custom.svg

- name: Prepare tests
run: |
WP_CORE_VERSION=$(wp-env run cli "wp core version")
echo "WP_CORE_VERSION=${WP_CORE_VERSION}" >> $GITHUB_ENV
wp-env run cli "wp post generate --count=5"
wp-env run cli "wp theme activate ${{ inputs.theme }}"
wp-env run cli "wp option update permalink_structure '/%postname%'"

- name: Run tests
run: |
CYPRESS_SPEC=$(find ./src/* -name ${{ matrix.spec }} -type f)
echo '{"wpUsername":"admin","wpPassword":"password","testURL":"http://localhost:8889"}' | jq . > cypress.env.json
./node_modules/.bin/cypress verify
./node_modules/.bin/cypress run --browser ${{ inputs.browser }} --spec $CYPRESS_SPEC

- name: Upload failure video
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.spec }}-fail.mp4
path: ./.dev/tests/cypress/videos/${{ matrix.spec }}.mp4
retention-days: 1

19 changes: 19 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: WIP Test / E2E

on:
pull_request:
branches:
- master

jobs:
chrome_e2e:
name: Chrome
uses: ./.github/workflows/test-e2e-cypress.yml
secrets:
record-key: ${{ secrets.CYPRESS_RECORD_KEY }}

# firefox_e2e:
# name: Firefox
# uses: ./.github/workflows/test-e2e-cypress.yml
# with:
# browser: firefox
27 changes: 27 additions & 0 deletions .github/workflows/test-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: WIP Test / JS

on:
pull_request:
branches:
- master

jobs:

js_unit:
name: Unit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Install dependencies
run: yarn install --immutable

- name: Run tests
run: yarn run test:js
Loading