Skip to content

Commit

Permalink
#25: Basic PR testing stuff
Browse files Browse the repository at this point in the history
* #25: Lint and unit tests on GitHub Actions

* #25: Basic x64 packaging and leia-test setup

* #25: Basic x64 packaging and leia-test setup part 2

* #25: Basic x64 packaging and leia-test setup part 3

* #25: Basic x64 packaging and leia-test setup part 4

* #25: Basic x64 packaging and leia-test setup part 5

* #25: PoC for multi-platform leia tests

* #25: PoC for multi-platform leia tests part 2

* #25: PoC for multi-platform leia tests part 3

* #25: Remove Windows leia tests for now
  • Loading branch information
pirog committed Aug 13, 2021
1 parent 0b11ca4 commit 13a5718
Show file tree
Hide file tree
Showing 15 changed files with 959 additions and 478 deletions.
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Declare files that will always have LF line endings on checkout.
*.js text eol=lf
*.sh text eol=lf
*.conf text eol=lf
*.cnf text eol=lf
*.ini text eol=lf
*.php text eol=lf
*.vcl text eol=lf
71 changes: 71 additions & 0 deletions .github/workflows/pr-basic-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Basic Leia Tests

on:
pull_request:

jobs:
leia-tests:
runs-on: ${{ matrix.os }}
env:
TERM: xterm
strategy:
matrix:
os:
- macos-10.15
- ubuntu-20.04
# - windows-2019
node-version:
- '14'
leia-tests:
- basics-example
steps:

# Install deps and cache
# Eventually it would be great if these steps could live in a separate YAML file
# that could be included in line to avoid code duplication
- name: Checkout code
uses: actions/checkout@v2
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile

# Package and verify CLI
- name: Package CLI
shell: bash
run: |
yarn build
ls -lsa dist/@lando
- name: Replace source CLI with packaged one
shell: bash
run: |
# Set os specific vars
if [ "$RUNNER_OS" == "Windows" ]; then
mv ./dist/@lando/hyperdrive.exe /usr/bin/hyperdrive.exe
chmod +x /usr/bin/hyperdrive.exe
else
mv ./dist/@lando/hyperdrive /usr/local/bin/hyperdrive
chmod +x /usr/local/bin/hyperdrive
fi
- name: Verify we can run the packaged CLI
shell: bash
run: |
which hyperdrive
hyperdrive version
# This block should eventually become use lando/actions-leia@v2
- name: Generate tests
run: yarn generate:leia-tests
- name: Run ${{ matrix.leia-tests }} leia tests
run: yarn mocha --timeout 900000 ./test/leia/${{ matrix.leia-tests }}.func.js
44 changes: 44 additions & 0 deletions .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Lint Code

on:
pull_request:

jobs:
linter:
runs-on: ${{ matrix.os }}
env:
TERM: xterm
strategy:
matrix:
os:
- ubuntu-20.04
node-version:
- '14'
# @TODO: Use leia for functional testing
# leia-tests:
# - apache-example
steps:
# Install deps and cache
# Eventually it would be great if these steps could live in a separate YAML file
# that could be included in line to avoid code duplication
- name: Checkout code
uses: actions/checkout@v2
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile

# Lint Code
- name: Lint code
run: yarn test
43 changes: 43 additions & 0 deletions .github/workflows/pr-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run Unit Tests

on:
pull_request:

jobs:
units:
runs-on: ${{ matrix.os }}
env:
TERM: xterm
strategy:
matrix:
os:
- macos-10.15
- ubuntu-20.04
- windows-2019
node-version:
- '14'
steps:
# Install deps and cache
# Eventually it would be great if these steps could live in a separate YAML file
# that could be included in line to avoid code duplication
- name: Checkout code
uses: actions/checkout@v2
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile

# Run unit tests
- name: Run units tests
run: yarn test
37 changes: 31 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
*-debug.log
*-error.log
/.nyc_output
/dist
/package-lock.json
/tmp
# Common sys files
.*.swp
._*
.git
.hg
.sign
.lock-wscript
.svn
.wafpickle-*
.DS_Store
.idea/
*.tar
*.jxp
*.sublime-*

# Logs
*.log
logs

# NPM files
node_modules

# Build dirs
build
dist

# Tests
test/split-file.txt
test/*.func.js
.nyc_output
coverage/
test/leia
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
v0.7.0-alpha.1 [August 6, 2021](https://github.com/lando/hyperdrive/releases/tag/v0.7.0-alpha.1)
---------------------
v0.7.0-alpha.1
--------------

As of this release `hyperdrive` is expanding in scope to be a proper package and dependency management tool for `lando`. Check out the [README](https://github.com/lando/hyperdrive/blob/main/README.md) for details on `hyperdrives` new mission and purpose.

* Expanded scope and clarified purpose of `hyperdrive`
* Rebased in `oclif` framework
* Rebased on `oclif` framework
* Setup basic DevOps flow for future dev

v0.6.2 [May 10, 2021](https://github.com/lando/hyperdrive/releases/tag/v0.6.2)
Expand Down
9 changes: 0 additions & 9 deletions CONTRIBUTING.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Hyperdrive

Hyperdrive is the `npm` of Lando. Its purpose is to consolidate dependency and plugin management logic that exists across the Lando ecosystem into a single library that can be invoked directly through `require` or via the `hyperdrive` cli. With Hyperdrive you should be able to:

* Install, remove and correctly configure Lando dependencies like Docker
* Install remove and correctly configure Lando dependencies like Docker
* Install and remove Lando components like the Lando Desktop, Lando CLI and Lando Server
* Install and remove core, contrib and third-part Lando plugins

Expand Down
6 changes: 6 additions & 0 deletions bin/hyperdrive
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node

require('@oclif/command')
.run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'));
File renamed without changes.
5 changes: 0 additions & 5 deletions bin/run

This file was deleted.

43 changes: 0 additions & 43 deletions build.sh

This file was deleted.

34 changes: 34 additions & 0 deletions examples/basics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Basics Example
==============

This example exists primarily to test the following documentation:

**Basics**

**CLI**

Start up tests
--------------

```bash
# Should print the version
hyperdrive version
```

Verification commands
---------------------

Run the following commands to verify things work as expected

```bash
# Should print the version
hyperdrive version
```

Destroy tests
-------------

```bash
# Should print the version
hyperdrive version
```
30 changes: 22 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,29 @@
"@oclif/plugin-help": "^3"
},
"devDependencies": {
"@oclif/dev-cli": "^1",
"@oclif/test": "^1",
"chai": "^4",
"command-line-test": "^1.0.10",
"eslint": "^5.13",
"eslint-config-oclif": "^3.1",
"globby": "^10",
"leia-parser": "^0.4.0",
"mocha": "^5",
"nyc": "^14"
"nyc": "^14",
"pkg": "^5.3.1",
"rimraf": "^3.0.2"
},
"engines": {
"node": ">=8.0.0"
"node": ">=14.0.0"
},
"files": [
"/bin",
"/npm-shrinkwrap.json",
"/oclif.manifest.json",
"/src"
],
"homepage": "https://github.com/lando/hyperdrive",
"keywords": [
"lando",
"oclif"
],
"license": "GPL-3.0",
Expand All @@ -44,12 +47,23 @@
"@oclif/plugin-help"
]
},
"pkg": {
"outputPath": "dist",
"scripts": [
"bin/*.js",
"src/**/*.js"
],
"assets": [
"package.json",
"yarn.lock"
]
},
"repository": "lando/hyperdrive",
"scripts": {
"postpack": "rm -f oclif.manifest.json",
"build": "yarn clean && yarn pkg -c package.json -t node14 bin/hyperdrive",
"clean": "rimraf dist",
"generate:leia-tests": "leia \"examples/**/README.md\" test/leia -r 2 -s 'Start up tests' -t 'Verification commands' -c 'Destroy tests' --split-file --spawn --stdin",
"lint": "eslint .",
"prepack": "oclif-dev manifest && oclif-dev readme",
"test": "nyc mocha --forbid-only \"test/**/*.test.js\"",
"version": "oclif-dev readme && git add README.md"
"test": "nyc mocha --forbid-only \"test/**/*.test.js\""
}
}
Loading

0 comments on commit 13a5718

Please sign in to comment.