Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #16 from mena-devs/cd-pipeline
Browse files Browse the repository at this point in the history
Upgrade CI/CD pipelines
  • Loading branch information
Bassem Dghaidi authored May 24, 2020
2 parents b481313 + f401667 commit fa10629
Show file tree
Hide file tree
Showing 8 changed files with 3,686 additions and 105 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/build.yml

This file was deleted.

14 changes: 10 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish NPM
name: Publish to npm

on:
push:
tags:
- '[0-9].[0-9]+.[0-9]+'
release:
types: [published]

Expand All @@ -13,7 +16,10 @@ jobs:
with:
node-version: 10
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
- name: npm install and publish
run: |
ls -lha
npm ci
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run Tests

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:

# Removing the build job for now because it's useless
# and a time waster. If there's a need for it, we'll introduce
# it later
#
# build:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v2
# - name: npm install and build webpack
# run: |
# ls -lha
# npm ci
# npm run build --if-present
# - uses: actions/upload-artifact@master
# with:
# name: webpack artifacts
# path: dist/


test:
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, windows-2016]
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install and test
run: |
ls -lha
npm ci
npm test
env:
CI: true
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,61 @@ console.dir(result, {depth: null});
}
```

### 7. Using closures as wildcard (Success)

You can utilize closures to return an entire sub-object or sub-array from specific keys in a payload. This can be useful in cases where you want to return all values under a key without the need for further matching.

```javascript
const match = require('@menadevs/objectron');

const payload = {
request: {
status: 200,
headers: [
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3)"
},
{
"name": "Referer",
"value": "https://www.somethingabcxyz.kfc/"
}
]
}
}

const tester = {
request: {
status: 200,
headers: (val) => val
}
};

const result = match(payload, tester);

# Output
> {
match: true,
total: 2,
matches: {
request: {
status: 200,
headers: [
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3)"
},
{
"name": "Referer",
"value": "https://www.somethingabcxyz.kfc/"
}
]
}
},
groups: {}
}
```

## FAQs

### 1. What's the difference between Objectron and any other Schema Validator?
Expand Down
Loading

0 comments on commit fa10629

Please sign in to comment.