mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-10 00:26:55 +00:00
fix tests and add caching
This commit is contained in:
parent
16e4be0a47
commit
664ab03930
4 changed files with 52 additions and 33 deletions
71
.github/workflows/build.yml
vendored
71
.github/workflows/build.yml
vendored
|
|
@ -1,44 +1,40 @@
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration-basic:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
|
||||||
vault:
|
|
||||||
image: vault:1.2.3
|
|
||||||
ports:
|
|
||||||
- 8200/tcp
|
|
||||||
env:
|
|
||||||
VAULT_DEV_ROOT_TOKEN_ID: testtoken
|
|
||||||
options: --cap-add=IPC_LOCK
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Use Node.js 10.x
|
- name: Use Node.js 10.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
- name: setup npm cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: npm build
|
- name: npm build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: npm run test
|
- name: npm run test
|
||||||
run: npm run test
|
run: npm run test
|
||||||
env:
|
|
||||||
CI: true
|
|
||||||
- name: npm run test:integration:basic
|
|
||||||
run: npm run test:integration:basic
|
|
||||||
env:
|
|
||||||
VAULT_HOST: localhost
|
|
||||||
VAULT_PORT: ${{ job.services.vault.ports[8200] }}
|
|
||||||
CI: true
|
|
||||||
|
|
||||||
integration-enterprise:
|
integration:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
vault:
|
vaultBasic:
|
||||||
|
image: vault:1.2.3
|
||||||
|
ports:
|
||||||
|
- 8200/tcp
|
||||||
|
env:
|
||||||
|
VAULT_DEV_ROOT_TOKEN_ID: testtoken
|
||||||
|
options: --cap-add=IPC_LOCK
|
||||||
|
vaultEnterprise:
|
||||||
image: hashicorp/vault-enterprise:1.3.0_ent
|
image: hashicorp/vault-enterprise:1.3.0_ent
|
||||||
ports:
|
ports:
|
||||||
- 8200/tcp
|
- 8200/tcp
|
||||||
|
|
@ -52,19 +48,28 @@ jobs:
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
- name: setup npm cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: npm build
|
- name: npm build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: npm run test
|
- name: npm run test:integration:basic
|
||||||
run: npm run test
|
run: npm run test:integration:basic
|
||||||
env:
|
env:
|
||||||
|
VAULT_HOST: localhost
|
||||||
|
VAULT_PORT: ${{ job.services.vaultBasic.ports[8200] }}
|
||||||
CI: true
|
CI: true
|
||||||
- name: npm run test:integration:enterprise
|
- name: npm run test:integration:enterprise
|
||||||
run: npm run test:integration:enterprise
|
run: npm run test:integration:enterprise
|
||||||
env:
|
env:
|
||||||
VAULT_HOST: localhost
|
VAULT_HOST: localhost
|
||||||
VAULT_PORT: ${{ job.services.vault.ports[8200] }}
|
VAULT_PORT: ${{ job.services.vaultEnterprise.ports[8200] }}
|
||||||
CI: true
|
CI: true
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
|
|
@ -85,12 +90,19 @@ jobs:
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
- name: setup npm cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: npm build
|
- name: npm build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: setup vault
|
- name: setup vault
|
||||||
run: node ./e2e/setup.js
|
run: node ./integrationTests/e2e/setup.js
|
||||||
env:
|
env:
|
||||||
VAULT_HOST: localhost
|
VAULT_HOST: localhost
|
||||||
VAULT_PORT: ${{ job.services.vault.ports[8200] }}
|
VAULT_PORT: ${{ job.services.vault.ports[8200] }}
|
||||||
|
|
@ -108,13 +120,20 @@ jobs:
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [integration-basic, integration-enterprise, e2e]
|
needs: [build, integration, e2e]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Use Node.js 10.x
|
- name: Use Node.js 10.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 10.x
|
node-version: 10.x
|
||||||
|
- name: setup npm cache
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: release
|
- name: release
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
jest.mock('@actions/core');
|
jest.mock('@actions/core');
|
||||||
jest.mock('@actions/core/lib/command');
|
jest.mock('@actions/core/lib/command');
|
||||||
const core = require('./@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const got = require('./got');
|
const got = require('got');
|
||||||
const { when } = require('./jest-when');
|
const { when } = require('jest-when');
|
||||||
|
|
||||||
const { exportSecrets } = require('../../action');
|
const { exportSecrets } = require('../../action');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const got = require('./got');
|
const got = require('got');
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
jest.mock('@actions/core');
|
jest.mock('@actions/core');
|
||||||
jest.mock('@actions/core/lib/command');
|
jest.mock('@actions/core/lib/command');
|
||||||
const core = require('./@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const got = require('./got');
|
const got = require('got');
|
||||||
const { when } = require('./jest-when');
|
const { when } = require('jest-when');
|
||||||
|
|
||||||
const { exportSecrets } = require('../../action');
|
const { exportSecrets } = require('../../action');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue