Skip to content

Commit

Permalink
Implement changesets (#521)
Browse files Browse the repository at this point in the history
* Implement changesets

* Update changesets config

* Release faust packages in lockstep

* changeset commands

* Create version:status command

* Create release packages action

* Update contributing guide

* Include changeset to kick off PR

* Remove old version script
  • Loading branch information
blakewilson authored Sep 30, 2021
1 parent aaad74c commit c4b205a
Show file tree
Hide file tree
Showing 11 changed files with 3,861 additions and 493 deletions.
12 changes: 12 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [
["@faustjs/core", "@faustjs/next", "@faustjs/react"]
],
"access": "public",
"baseBranch": "canary",
"updateInternalDependencies": "patch",
"ignore": ["next-headless-getting-started"]
}
7 changes: 7 additions & 0 deletions .changeset/two-bugs-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@faustjs/core': patch
'@faustjs/next': patch
'@faustjs/react': patch
---

Implemented `changesets` 🦋
43 changes: 43 additions & 0 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release Packages

on:
push:
branches:
- canary

jobs:
release_packages:
name: Release Packages
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 14.x
uses: actions/setup-node@master
with:
node-version: 14.x

- name: Install Dependencies
run: npm install

- name: Create .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48 changes: 25 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@
[Search the existing issues](https://github.com/wpengine/faustjs/search?type=Issues) before logging a new one.

Some search tips:
* *Don't* restrict your search to only open issues. An issue with a title similar to yours may have been closed as a duplicate of one with a less-findable title.
* Search for the title of the issue you're about to log. This sounds obvious but 80% of the time this is sufficient to find a duplicate when one exists.
* Read more than the first page of results. Many bugs here use the same words so relevancy sorting is not particularly strong.
* If you have a crash, search for the first few topmost function names shown in the call stack.

- _Don't_ restrict your search to only open issues. An issue with a title similar to yours may have been closed as a duplicate of one with a less-findable title.
- Search for the title of the issue you're about to log. This sounds obvious but 80% of the time this is sufficient to find a duplicate when one exists.
- Read more than the first page of results. Many bugs here use the same words so relevancy sorting is not particularly strong.
- If you have a crash, search for the first few topmost function names shown in the call stack.

## 2. Did You Find A Bug?

When logging a bug, please be sure to include the following:

* What version of the package/plugin are you using
* If at all possible, an *isolated* way to reproduce the behavior
* The behavior you expect to see, and the actual behavior
- What version of the package/plugin are you using
- If at all possible, an _isolated_ way to reproduce the behavior
- The behavior you expect to see, and the actual behavior

## 3. Do You Have A Suggestion?

We also accept suggestions in the issue tracker. Be sure to [search](https://github.com/wpengine/faustjs/search?type=Issues) first.


In general, things we find useful when reviewing suggestions are:
* A description of the problem you're trying to solve
* An overview of the suggested solution
* Examples of how the suggestion would work in various places
* Code examples showing e.g. "this would be an error, this wouldn't"
* Code examples showing usage (if possible)
* If relevant, precedent in other frameworks or libraries can be useful for establishing context and expected behavior

- A description of the problem you're trying to solve
- An overview of the suggested solution
- Examples of how the suggestion would work in various places
- Code examples showing e.g. "this would be an error, this wouldn't"
- Code examples showing usage (if possible)
- If relevant, precedent in other frameworks or libraries can be useful for establishing context and expected behavior

# Instructions For Contributing Code

Expand All @@ -38,19 +39,20 @@ In general, things we find useful when reviewing suggestions are:
0. [A bug or feature you want to work on](https://github.com/wpengine/faustjs/labels/help%20wanted)! If you have found a new bug or want to propose a feature, please [create an issue](https://github.com/wpengine/faustjs/issues/new/choose) before starting a pull request.
1. [A GitHub account](https://github.com/join).
2. A working copy of the code. See [DEVELOPMENT.md](/DEVELOPMENT.md).
3. A `changeset` that describes the changes you're making. You can create a `changeset` by running `npm run changeset` from the monorepo root.

## Housekeeping

Your pull request should:

* Include a description of what your change intends to do
* Reference any open issues that the PR addresses
* Be based on reasonably recent commit in the **canary** branch
* Include adequate tests
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
* Tests should include reasonable permutations of the target fix/change
* Include baseline changes with your change
* Contain proper [semantic commit messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716#gistcomment-3711094) as follows:
- Include a description of what your change intends to do
- Reference any open issues that the PR addresses
- Be based on reasonably recent commit in the **canary** branch
- Include adequate tests
- At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
- Tests should include reasonable permutations of the target fix/change
- Include baseline changes with your change
- Contain proper [semantic commit messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716#gistcomment-3711094) as follows:

```
<type>[<scope>]: (<issue #>) <short summary>
Expand All @@ -64,4 +66,4 @@ Your pull request should:
└─> Type: chore, docs, feat, fix, refactor, style, or test.
```

* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
- To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
52 changes: 29 additions & 23 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

There are many ways to [contribute](/CONTRIBUTING.md) to this project.

* [Discuss open issues](https://github.com/wpengine/faustjs/issues) to help define the future of the project.
* [Submit bugs](https://github.com/wpengine/faustjs/issues) and help us verify fixes as they are checked in.
* Review and discuss the [source code changes](https://github.com/wpengine/faustjs/pulls).
* [Contribute bug fixes](/CONTRIBUTING.md)
- [Discuss open issues](https://github.com/wpengine/faustjs/issues) to help define the future of the project.
- [Submit bugs](https://github.com/wpengine/faustjs/issues) and help us verify fixes as they are checked in.
- Review and discuss the [source code changes](https://github.com/wpengine/faustjs/pulls).
- [Contribute bug fixes](/CONTRIBUTING.md)

## Project Structure

Expand All @@ -28,8 +28,7 @@ When switching git branch, run `npm run clean` from the root and then re-run `np

As this is a monorepo, you will not be able to check out this repository into `wp-content/themes` or `wp-content/plugins`.

Instead, you can create symlinks to the themes/plugins in this repository. Best of all, this will also sync your work
across multiple local sites!
Instead, you can create symlinks to the themes/plugins in this repository. Best of all, this will also sync your work across multiple local sites!

#### WPE Headless Plugin

Expand All @@ -44,11 +43,13 @@ ln -s /path/to/faustjs/plugins/wpe-headless /path/to/wordpress/wp-content/plugin
[PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) is configured for the [WordPress code standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/).

Install the composer packages from within `wpe-headless` directory if you haven't already.

```
composer install
```

Run the syntax check.

```
composer phpcs
```
Expand All @@ -67,11 +68,13 @@ To run WordPress unit tests, set up the test framework:
```

If you connect to MySQL via a sock connection, you can run the following.

```
/bin/bash /path/to/faustjs/plugins/wpe-headless/tests/install-wp-tests.sh wpe_headless_tests db_name db_password localhost:/path/to/mysql/mysqld.sock
```

Install the composer packages from within `wpe-headless` directory if you haven't already.

```
composer install
```
Expand All @@ -95,33 +98,36 @@ Use [Codeception](https://codeception.com/) for running end-2-end tests in the b
### 1. Environment Setup

1. Install [Composer](https://getcomposer.org/).
- Within the `plugins/wpe-headless` directory, run `composer install`.
- Within the `plugins/wpe-headless` directory, run `composer install`.
1. Install [Google Chrome](https://www.google.com/chrome/).
1. Install [Chromedriver](https://chromedriver.chromium.org/downloads)
- The major version will need to match your Google Chrome [version](https://www.whatismybrowser.com/detect/what-version-of-chrome-do-i-have). See [Chromedriver Version Selection](https://chromedriver.chromium.org/downloads/version-selection).
- Unzip the chromedriver zip file and move `chromedriver` application into the `/usr/local/bin` directory.
`mv chromedriver /usr/local/bin`
- In shell, run `chromedriver --version`. _Note: If you are using OS X, it may prevent this program from opening. Open "Security & Privacy" and allow chromedriver_.
- Run `chromedriver --version` again. _Note: On OS X, you may be prompted for a final time, click "Open"_. When you can see the version, chromedriver is ready.
- The major version will need to match your Google Chrome [version](https://www.whatismybrowser.com/detect/what-version-of-chrome-do-i-have). See [Chromedriver Version Selection](https://chromedriver.chromium.org/downloads/version-selection).
- Unzip the chromedriver zip file and move `chromedriver` application into the `/usr/local/bin` directory.
`mv chromedriver /usr/local/bin`
- In shell, run `chromedriver --version`. _Note: If you are using OS X, it may prevent this program from opening. Open "Security & Privacy" and allow chromedriver_.
- Run `chromedriver --version` again. _Note: On OS X, you may be prompted for a final time, click "Open"_. When you can see the version, chromedriver is ready.

### 2. Headless Site Setup

1. From within the headless site `examples/getting-started` copy `.env.test.sample` to `.env.test`.
- If you are using the provided Docker build, you will not need to adjust any variables in the `.env.testing` file; else, you can adjust the environment variables as needed.
- If you are using the provided Docker build, you will not need to adjust any variables in the `.env.testing` file; else, you can adjust the environment variables as needed.

### 3. WPE Headless Setup

1. Move into the WPE Headless plugin directory `plugins/wpe-headless`.
1. Prepare a test WordPress site.
- We have provided a Docker build to reduce the setup needed. You are welcome to set up your own WordPress end-2-end testing site.
1. Install [Docker](https://www.docker.com/get-started).
1. Run `docker-compose up -d --build`. If building for the first time, it could take some time to download and build the images.
1. Run `docker-compose exec --workdir=/var/www/html/wp-content/plugins/wpe-headless --user=www-data wordpress wp plugin install wp-graphql --activate`
1. Run `docker-compose exec --workdir=/var/www/html/wp-content/plugins/wpe-headless --user=www-data wordpress wp db export tests/_data/dump.sql`
- We have provided a Docker build to reduce the setup needed. You are welcome to set up your own WordPress end-2-end testing site.
1. Install [Docker](https://www.docker.com/get-started).
1. Run `docker-compose up -d --build`. If building for the first time, it could take some time to download and build the images.
1. Run `docker-compose exec --workdir=/var/www/html/wp-content/plugins/wpe-headless --user=www-data wordpress wp plugin install wp-graphql --activate`
1. Run `docker-compose exec --workdir=/var/www/html/wp-content/plugins/wpe-headless --user=www-data wordpress wp db export tests/_data/dump.sql`
1. Copy `.env.testing.example` to `.env.testing`.
- If you are using the provided Docker build, you will not need to adjust any variables in the `.env.testing` file.
- If you are not using the provided Docker build, edit the `.env.testing` file with your test WordPress site information.
- If you are using the provided Docker build, you will not need to adjust any variables in the `.env.testing` file.
- If you are not using the provided Docker build, edit the `.env.testing` file with your test WordPress site information.
1. Run `vendor/bin/codecept run acceptance` to start the end-2-end tests.

### Browser testing documentation

- [Codeception Acceptance Tests](https://codeception.com/docs/03-AcceptanceTests)
- Base framework for browser testing in php.
- [WPBrowser](https://wpbrowser.wptestkit.dev/)
Expand Down Expand Up @@ -154,6 +160,6 @@ CircleCI will build and deploy the plugin zip. The latest version will be availa

Once deployed, the updated packages will be visible here:

* https://www.npmjs.com/package/@faustjs/core
* https://www.npmjs.com/package/@faustjs/react
* https://www.npmjs.com/package/@faustjs/next
- https://www.npmjs.com/package/@faustjs/core
- https://www.npmjs.com/package/@faustjs/react
- https://www.npmjs.com/package/@faustjs/next
Loading

0 comments on commit c4b205a

Please sign in to comment.