-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (53 loc) · 1.67 KB
/
ci-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: CI Build & Test
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
name: CI Test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
- name: Install Vault
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update
sudo apt-get install vault jq -y
- name: Install Dependencies
run: npm install
- name: Run Tests (pull_request)
uses: mattallty/jest-github-action@v1
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run Tests (push)
if: ${{ github.event_name == 'push' }}
run: npm test
- name: Pack Build Artifacts
if: ${{ github.event_name == 'push' }}
run: |
npm pack
echo "PKG_NAME=$(jq -r ".name" package.json)-$(jq -r ".version" package.json).tgz" >> $GITHUB_ENV
- name: Share Build Artifact
uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'push' }}
with:
path: ${{ env.PKG_NAME }}
if-no-files-found: error
services:
vault:
image: hashicorp/vault:latest
ports:
- 8200:8200
env:
VAULT_DEV_ROOT_TOKEN_ID: vaultGHCITestToken
VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
options: --cap-add=IPC_LOCK