Skip to content

Commit 13a5718

Browse files
authored
#25: Basic PR testing stuff
* #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
1 parent 0b11ca4 commit 13a5718

15 files changed

+959
-478
lines changed

.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Declare files that will always have LF line endings on checkout.
5+
*.js text eol=lf
6+
*.sh text eol=lf
7+
*.conf text eol=lf
8+
*.cnf text eol=lf
9+
*.ini text eol=lf
10+
*.php text eol=lf
11+
*.vcl text eol=lf

.github/workflows/pr-basic-tests.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Basic Leia Tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
leia-tests:
8+
runs-on: ${{ matrix.os }}
9+
env:
10+
TERM: xterm
11+
strategy:
12+
matrix:
13+
os:
14+
- macos-10.15
15+
- ubuntu-20.04
16+
# - windows-2019
17+
node-version:
18+
- '14'
19+
leia-tests:
20+
- basics-example
21+
steps:
22+
23+
# Install deps and cache
24+
# Eventually it would be great if these steps could live in a separate YAML file
25+
# that could be included in line to avoid code duplication
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
- name: Install node ${{ matrix.node-version }}
29+
uses: actions/setup-node@v2
30+
with:
31+
node-version: ${{ matrix.node-version }}
32+
- name: Get Yarn cache directory
33+
id: yarn-cache-dir-path
34+
run: echo "::set-output name=dir::$(yarn cache dir)"
35+
- name: Use Yarn cache
36+
uses: actions/cache@v2
37+
id: yarn-cache
38+
with:
39+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
40+
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
41+
- name: Install Yarn dependencies
42+
run: yarn install --prefer-offline --frozen-lockfile
43+
44+
# Package and verify CLI
45+
- name: Package CLI
46+
shell: bash
47+
run: |
48+
yarn build
49+
ls -lsa dist/@lando
50+
- name: Replace source CLI with packaged one
51+
shell: bash
52+
run: |
53+
# Set os specific vars
54+
if [ "$RUNNER_OS" == "Windows" ]; then
55+
mv ./dist/@lando/hyperdrive.exe /usr/bin/hyperdrive.exe
56+
chmod +x /usr/bin/hyperdrive.exe
57+
else
58+
mv ./dist/@lando/hyperdrive /usr/local/bin/hyperdrive
59+
chmod +x /usr/local/bin/hyperdrive
60+
fi
61+
- name: Verify we can run the packaged CLI
62+
shell: bash
63+
run: |
64+
which hyperdrive
65+
hyperdrive version
66+
67+
# This block should eventually become use lando/actions-leia@v2
68+
- name: Generate tests
69+
run: yarn generate:leia-tests
70+
- name: Run ${{ matrix.leia-tests }} leia tests
71+
run: yarn mocha --timeout 900000 ./test/leia/${{ matrix.leia-tests }}.func.js

.github/workflows/pr-linter.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Lint Code
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
linter:
8+
runs-on: ${{ matrix.os }}
9+
env:
10+
TERM: xterm
11+
strategy:
12+
matrix:
13+
os:
14+
- ubuntu-20.04
15+
node-version:
16+
- '14'
17+
# @TODO: Use leia for functional testing
18+
# leia-tests:
19+
# - apache-example
20+
steps:
21+
# Install deps and cache
22+
# Eventually it would be great if these steps could live in a separate YAML file
23+
# that could be included in line to avoid code duplication
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
- name: Install node ${{ matrix.node-version }}
27+
uses: actions/setup-node@v2
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
- name: Get Yarn cache directory
31+
id: yarn-cache-dir-path
32+
run: echo "::set-output name=dir::$(yarn cache dir)"
33+
- name: Use Yarn cache
34+
uses: actions/cache@v2
35+
id: yarn-cache
36+
with:
37+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
38+
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
39+
- name: Install Yarn dependencies
40+
run: yarn install --prefer-offline --frozen-lockfile
41+
42+
# Lint Code
43+
- name: Lint code
44+
run: yarn test

.github/workflows/pr-unit-tests.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run Unit Tests
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
units:
8+
runs-on: ${{ matrix.os }}
9+
env:
10+
TERM: xterm
11+
strategy:
12+
matrix:
13+
os:
14+
- macos-10.15
15+
- ubuntu-20.04
16+
- windows-2019
17+
node-version:
18+
- '14'
19+
steps:
20+
# Install deps and cache
21+
# Eventually it would be great if these steps could live in a separate YAML file
22+
# that could be included in line to avoid code duplication
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
- name: Install node ${{ matrix.node-version }}
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
- name: Get Yarn cache directory
30+
id: yarn-cache-dir-path
31+
run: echo "::set-output name=dir::$(yarn cache dir)"
32+
- name: Use Yarn cache
33+
uses: actions/cache@v2
34+
id: yarn-cache
35+
with:
36+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
37+
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
38+
- name: Install Yarn dependencies
39+
run: yarn install --prefer-offline --frozen-lockfile
40+
41+
# Run unit tests
42+
- name: Run units tests
43+
run: yarn test

.gitignore

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1-
*-debug.log
2-
*-error.log
3-
/.nyc_output
4-
/dist
5-
/package-lock.json
6-
/tmp
1+
# Common sys files
2+
.*.swp
3+
._*
4+
.git
5+
.hg
6+
.sign
7+
.lock-wscript
8+
.svn
9+
.wafpickle-*
10+
.DS_Store
11+
.idea/
12+
*.tar
13+
*.jxp
14+
*.sublime-*
15+
16+
# Logs
17+
*.log
18+
logs
19+
20+
# NPM files
721
node_modules
22+
23+
# Build dirs
24+
build
25+
dist
26+
27+
# Tests
28+
test/split-file.txt
29+
test/*.func.js
30+
.nyc_output
31+
coverage/
32+
test/leia

CHANGELOG.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
v0.7.0-alpha.1 [August 6, 2021](https://github.com/lando/hyperdrive/releases/tag/v0.7.0-alpha.1)
2-
---------------------
1+
v0.7.0-alpha.1
2+
--------------
33

44
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.
55

66
* Expanded scope and clarified purpose of `hyperdrive`
7-
* Rebased in `oclif` framework
7+
* Rebased on `oclif` framework
88
* Setup basic DevOps flow for future dev
99

1010
v0.6.2 [May 10, 2021](https://github.com/lando/hyperdrive/releases/tag/v0.6.2)

CONTRIBUTING.md

-9
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Hyperdrive
55

66
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:
77

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

bin/hyperdrive

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env node
2+
3+
require('@oclif/command')
4+
.run()
5+
.then(require('@oclif/command/flush'))
6+
.catch(require('@oclif/errors/handle'));

bin/run.cmd bin/hyperdrive.cmd

File renamed without changes.

bin/run

-5
This file was deleted.

build.sh

-43
This file was deleted.

examples/basics/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Basics Example
2+
==============
3+
4+
This example exists primarily to test the following documentation:
5+
6+
**Basics**
7+
8+
**CLI**
9+
10+
Start up tests
11+
--------------
12+
13+
```bash
14+
# Should print the version
15+
hyperdrive version
16+
```
17+
18+
Verification commands
19+
---------------------
20+
21+
Run the following commands to verify things work as expected
22+
23+
```bash
24+
# Should print the version
25+
hyperdrive version
26+
```
27+
28+
Destroy tests
29+
-------------
30+
31+
```bash
32+
# Should print the version
33+
hyperdrive version
34+
```

package.json

+22-8
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,29 @@
1313
"@oclif/plugin-help": "^3"
1414
},
1515
"devDependencies": {
16-
"@oclif/dev-cli": "^1",
1716
"@oclif/test": "^1",
1817
"chai": "^4",
18+
"command-line-test": "^1.0.10",
1919
"eslint": "^5.13",
2020
"eslint-config-oclif": "^3.1",
2121
"globby": "^10",
22+
"leia-parser": "^0.4.0",
2223
"mocha": "^5",
23-
"nyc": "^14"
24+
"nyc": "^14",
25+
"pkg": "^5.3.1",
26+
"rimraf": "^3.0.2"
2427
},
2528
"engines": {
26-
"node": ">=8.0.0"
29+
"node": ">=14.0.0"
2730
},
2831
"files": [
2932
"/bin",
3033
"/npm-shrinkwrap.json",
31-
"/oclif.manifest.json",
3234
"/src"
3335
],
3436
"homepage": "https://github.com/lando/hyperdrive",
3537
"keywords": [
38+
"lando",
3639
"oclif"
3740
],
3841
"license": "GPL-3.0",
@@ -44,12 +47,23 @@
4447
"@oclif/plugin-help"
4548
]
4649
},
50+
"pkg": {
51+
"outputPath": "dist",
52+
"scripts": [
53+
"bin/*.js",
54+
"src/**/*.js"
55+
],
56+
"assets": [
57+
"package.json",
58+
"yarn.lock"
59+
]
60+
},
4761
"repository": "lando/hyperdrive",
4862
"scripts": {
49-
"postpack": "rm -f oclif.manifest.json",
63+
"build": "yarn clean && yarn pkg -c package.json -t node14 bin/hyperdrive",
64+
"clean": "rimraf dist",
65+
"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",
5066
"lint": "eslint .",
51-
"prepack": "oclif-dev manifest && oclif-dev readme",
52-
"test": "nyc mocha --forbid-only \"test/**/*.test.js\"",
53-
"version": "oclif-dev readme && git add README.md"
67+
"test": "nyc mocha --forbid-only \"test/**/*.test.js\""
5468
}
5569
}

0 commit comments

Comments
 (0)