Skip to content

Commit

Permalink
Dial fully for lando update (#36)
Browse files Browse the repository at this point in the history
* Dial fully for `lando update`

* Update to node 18

* Fix some script-generated issues.

* isolate riff 1

* isolate riff 2

* remove extraneous test line

---------

Co-authored-by: Mike Pirog <mike@lando.dev>
  • Loading branch information
reynoldsalec and pirog authored Dec 8, 2023
1 parent 740b215 commit b4d6bee
Show file tree
Hide file tree
Showing 23 changed files with 9,266 additions and 4,559 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/pr-docs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -20,12 +20,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Run tests
- name: Run linter
run: yarn docs:lint
run: npm run docs:lint
- name: Test build
run: yarn docs:build
run: npm run docs:build
10 changes: 5 additions & 5 deletions .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -20,10 +20,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Run the linter
- name: Run code linter
run: yarn lint
run: npm run lint
23 changes: 13 additions & 10 deletions .github/workflows/pr-mysql-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
lando-version:
- 3-dev
- 3-dev-slim
leia-test:
- examples/5.7
- examples/8.0
Expand All @@ -29,20 +29,23 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile
- name: Bundle Deps
uses: lando/prepare-release-action@v3
with:
lando-plugin: true
version: dev
sync: false
- name: Setup lando ${{ matrix.lando-version }}
uses: lando/setup-lando@v2
with:
lando-version: ${{ matrix.lando-version }}
config: |
plugins.@lando/mysql=/home/runner/work/mysql/mysql
setup.skipCommonPlugins=true
setup.plugins.@lando/mysql=/home/runner/work/mysql/mysql
telemetry: false
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep mysql | grep /home/runner/work/mysql/mysql || (echo "::error:: Not dogfooding this plugin correctly!" && exit 1)
- name: Run Leia Tests
uses: lando/run-leia-action@v2
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- ubuntu-22.04
- macos-12
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -22,10 +22,10 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Run unit tests
- name: Run unit tests
run: yarn test:unit
run: npm run test:unit
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
os:
- ubuntu-22.04
node-version:
- '16'
- '18'
steps:
# Install deps and cache
- name: Checkout code
Expand All @@ -27,19 +27,19 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile
cache: npm
- name: Install dependencies
run: npm clean-install --prefer-offline --frozen-lockfile

# Let's do tests rq just to make sure we dont push something that is fundamentally broken
- name: Lint code
run: yarn lint
run: npm run lint
- name: Run unit tests
run: yarn test:unit
run: npm run test:unit

# Prepare release.
- name: Prepare release
uses: lando/prepare-release-action@v2
uses: lando/prepare-release-action@v3
with:
lando-plugin: true

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@ coverage/
_site
docs/.vuepress/.cache
docs/.vuepress/.temp
docs/.vuepress/dist
docs/.vuepress/dist

# YARN
yarn.lock
6 changes: 3 additions & 3 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: lando-mysql-plugin
services:
node:
type: node:14
type: node:18
build:
- yarn install
- npm install
scanner: false
ssl: false
sslExpose: false
tooling:
node:
service: node
yarn:
npm:
service: node
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.github
.nyc_output
coverage
docs
examples
guides
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 16
nodejs 18
18 changes: 11 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
## v1.0.0 - [December 7, 2023](https://github.com/lando/mysql/releases/tag/v1.0.0)

* Dialed fully for `lando update`

## v0.9.0 - [Oct 20, 2023](https://github.com/lando/mysql/releases/tag/v0.9.0)

* Added a new healthcheck that better assesses service readiness. [#33](https://github.com/lando/mysql/pull/33)
* Restructured to use builders/mysql.js.


## v0.8.0 - [July 3, 2023](https://github.com/lando/mysql/releases/tag/v0.8.0)
* Removed bundle-dependencies and version-bump-prompt from plugin.
* Updated package to use prepare-release-action.
* Updated documentation to reflect new release process.

* Removed bundle-dependencies and version-bump-prompt from plugin.
* Updated package to use prepare-release-action.
* Updated documentation to reflect new release process.

## v0.7.0 - [December 12, 2022](https://github.com/lando/mysql/releases/tag/v0.7.0)
* Added bundle-dependencies to release process.
* Fixed bug in plugin dogfooding test.

## v0.6.0 - [September 7, 2022](https://github.com/lando/mysql/releases/tag/v0.6.0)
* Added bundle-dependencies to release process.
* Fixed bug in plugin dogfooding test.

## v0.5.1 - [April 21, 2022](https://github.com/lando/mysql/releases/tag/v0.5.1)

Expand Down
5 changes: 2 additions & 3 deletions builders/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ module.exports = {
constructor(id, options = {}) {
options = _.merge({}, config, options);
// Force the auth plugin to be mysql_native_password on 5.7
if (_.startsWith(options.version, '5.7')) {
options.authentication = 'mysql_native_password';
}
if (_.startsWith(options.version, '5.7')) options.authentication = 'mysql_native_password';

// set a default health check if we dont already have one
if (!options.healthcheck) options.healthcheck = require('../utils/get-default-healthcheck')(options);

// Ensure the non-root backup perm sweep runs
Expand Down
File renamed without changes.
30 changes: 14 additions & 16 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ At the very least you will need to have the following installed:
* [Lando 3.5.0+](https://docs.lando.dev/basics/installation.html), preferably installed [from source](https://docs.lando.dev/basics/installation.html#from-source).
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)

While not a hard requirement it's also probably a good idea to install both `node` 14 and `yarn`

* [Node 14](https://nodejs.org/dist/latest-v14.x/)
* [Yarn](https://classic.yarnpkg.com/lang/en/docs/install)
While not a hard requirement it's also probably a good idea to install `node` 18
* [Node 18](https://nodejs.org/dist/latest-v18.x/)

## Installation

Expand All @@ -28,8 +26,8 @@ git clone https://github.com/lando/mysql.git && cd mysql
# Install dependencies with lando
lando start

# Or install them with yarn
yarn
# Or install them with npm
npm install
```

## Working
Expand Down Expand Up @@ -60,10 +58,10 @@ If you want to help with contributing documentation here are some useful command

```bash
# launch local docs site
yarn docs:dev
npm run docs:dev
# build docs locally
yarn docs:build
npm run docs:build
```

If you are more interested in the internals of the docs they use [VuePress2](https://v2.vuepress.vuejs.org/) and our [Special theme](https://vuepress-theme-default-plus.lando.dev).
Expand All @@ -88,7 +86,7 @@ And then you can run the tests with the below.

```bash
# Run unit tests
yarn test:unit
npm run test:unit
```

### Leia Tests
Expand All @@ -115,21 +113,21 @@ Destroy tests
lando destroy -y
```

Note that the headers here are important and are defined in our `yarn generate:tests` script. The _Start up tests_ header specifies things that should run before the main series of tests. _Verification commands_ is the main body of tests and is required. _Destroy tests_ specifies any needed clean up commands to run.
Note that the headers here are important and are defined in our `npm run generate:tests` script. The _Start up tests_ header specifies things that should run before the main series of tests. _Verification commands_ is the main body of tests and is required. _Destroy tests_ specifies any needed clean up commands to run.

If you check out the various READMEs in our [examples](https://github.com/lando/mysql/tree/main/examples) you will notice that they are all Leia tests.

Before running all or some of the tests you will need to generate them.

```bash
# Generate tests
yarn generate:tests
npm run generate:tests
# Run ALL the tests, this will likely take a long time
yarn test:leia
npm run test:leia
# Run the tests for a single example
yarn leia examples/mariadb-10.2/README.md -c 'Destroy tests'
npm run leia examples/mariadb-10.2/README.md -c 'Destroy tests'
```

If you've created new testable examples then you will also need to let GitHub Actions know so they can run on pull requests.
Expand All @@ -145,7 +143,7 @@ jobs:
matrix:
leia-tests:
# This should be the filename, without .leia.js extension in the test directory
# NOTE that you will need to run yarn generate:tests to see these
# NOTE that you will need to run npm run generate:tests to see these
- test: platform-sh-maria-db-10-1-example
# This should be the directory that the test was generated from
source: examples/mariadb-10.2
Expand All @@ -165,9 +163,9 @@ Also note that if you create a "pre-release" it will tag the `npm` package with

```bash
# Will pull the most recent GitHub release
yarn add @lando/mysql
npm install @lando/mysql
# Will pull the most recent GitHub pre-release
yarn add @lando/mysql@edge
npm install @lando/mysql@edge
```

## Contribution
Expand Down
30 changes: 18 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,37 @@ This plugin is included with Lando by default. That means if you have Lando vers
However if you would like to manually install the plugin, update it to the bleeding edge or install a particular version then use the below. Note that this installation method requires Lando `3.5.0+`.

:::: code-group
::: code-group-item LANDO 3.21+
```bash:no-line-numbers
lando plugin-add @lando/mysql
```
:::
::: code-group-item HYPERDRIVE
```bash:no-line-numbers
# @TODO
# @NOTE: This doesn't actaully work yet
hyperdrive install @lando/mysql
```
:::
::: code-group-item DOCKER
```bash:no-line-numbers
# Ensure you have a global plugins directory
mkdir -p ~/.lando/plugins
# Install plugin
# NOTE: Modify the "yarn add @lando/mysql" line to install a particular version eg
# yarn add @lando/mysql@0.5.2
docker run --rm -it -v ${HOME}/.lando/plugins:/plugins -w /tmp node:14-alpine sh -c \
"yarn init -y \
&& yarn add @lando/mysql --production --flat --no-default-rc --no-lockfile --link-duplicates \
&& yarn install --production --cwd /tmp/node_modules/@lando/mysql \
# NOTE: Modify the "npm install @lando/mysql" line to install a particular version eg
# npm install @lando/mysql@0.5.2
docker run --rm -it -v ${HOME}/.lando/plugins:/plugins -w /tmp node:18-alpine sh -c \
"npm init -y \
&& npm install @lando/mysql --production --flat --no-default-rc --no-lockfile --link-duplicates \
&& npm install --production --cwd /tmp/node_modules/@lando/mysql \
&& mkdir -p /plugins/@lando \
&& mv --force /tmp/node_modules/@lando/mysql /plugins/@lando/mysql"
# Rebuild the plugin cache
lando --clear
```
:::
::: code-group-item HYPERDRIVE
```bash:no-line-numbers
# @TODO
# @NOTE: This doesn't actaully work yet
hyperdrive install @lando/mysql
```
::::

You should be able to verify the plugin is installed by running `lando config --path plugins` and checking for `@lando/mysql`. This command will also show you _where_ the plugin is being loaded from.
2 changes: 1 addition & 1 deletion examples/5.7/.lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ services:
# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/mysql": ./../../
"@lando/mysql": ../..
1 change: 0 additions & 1 deletion examples/5.7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ lando ssh -s defaults -c "mysql -umysql -pmysql database -e quit"

# Should still be running even after a restart
lando restart
lando ssh -s defaults -c "mysql -umysql -pmysql database -e quit"
```

Destroy tests
Expand Down
Loading

0 comments on commit b4d6bee

Please sign in to comment.