Skip to content

Commit

Permalink
Merge pull request #46 from matrunchyk/ci_build
Browse files Browse the repository at this point in the history
chore: Update CI/CD
  • Loading branch information
matrunchyk authored May 5, 2021
2 parents deb080c + a499cb2 commit 576950f
Show file tree
Hide file tree
Showing 12 changed files with 217 additions and 73 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"rules": {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": 0
},
"overrides": [
Expand Down
50 changes: 50 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
documentation:
- src/docs/*

graphql:
- src/graphql/**/*

models:
- src/models/**/*

repositories:
- src/repositories/**/*

core:
- src/*.ts

test:
- test/**/*

repo:
- .browserslistrc
- .czrc
- .editorconfig
- .eslint*
- .gitignore
- .graphqlconfig
- .npmrc
- .snyk
- .travis.yml
- _config.yml
- FUNDING.yml
- CHANGELOG.md
- commitlint.config.js
- conventionalcommit.json
- jest.config.json
- dangerfile.ts
- LICENSE
- SECURITY.md
- README.md
- babel.config.js
- nodemon.json
- tsconfig.json
- tsconfig.tsbuildinfo
- .github/**/*

deps:
- package.json
- package-lock.json

#test:
# - src/**/*.spec.js
22 changes: 22 additions & 0 deletions .github/workflows/continuous-deployment-create-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "CD: Tag"

on:
push:
branches: [ master ]

jobs:
create_tag:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Bump version and push tag
uses: mathieudutour/github-tag-action@v4.5
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
create_annotated_tag: true

59 changes: 59 additions & 0 deletions .github/workflows/continuous-deployment-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "CD: Publish"

on:
release:
types: [created]

jobs:
continuous-deployment-build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
with:
node-version: '12.x'
registry-url: 'https://npm.pkg.github.com'

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
npm ci
- name: Run tests
run: npm run lint

- name: Compile a packages
run: npm run build

# - name: Release the version
# uses: fnkr/github-action-ghr@v1
# if: startsWith(github.ref, 'refs/tags/')
# env:
# GHR_COMPRESS: xz
# GHR_PATH: lib/
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


publish-gpr:
needs: [continuous-deployment-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2.1.5
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
23 changes: 23 additions & 0 deletions .github/workflows/continuous-deployment-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "CD: Release"

on:
push:
tags:
- "v*"

jobs:
continuous-deployment-release:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Create a release
id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/continuous-integration-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Pull Request"

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "continuous-integration"
continuous-integration:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Create PR labels
uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Checkout sources
uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.5
with:
node-version: '12.x'

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
npm install
npm run lint
npm run build
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

11 changes: 0 additions & 11 deletions .release-it.json

This file was deleted.

25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

32 changes: 8 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-oop",
"version": "1.6.3",
"version": "1.6.4",
"description": "A library based on Model-Repository patterns for Vue components. Usable for GraphQL and REST APIs.",
"keywords": [
"collections",
Expand Down Expand Up @@ -41,10 +41,8 @@
"dev": "tsc -w",
"lint": "eslint '*/**/*.{ts,tsx}' --fix",
"publish-github": "npm publish --registry https://npm.pkg.github.com/@matrunchyk",
"release": "release-it",
"test": "jest --config jest.config.json",
"test:watch": "jest -w",
"prepublishOnly": "npm run build"
"test:watch": "jest -w"
},
"husky": {
"hooks": {
Expand All @@ -55,7 +53,6 @@
"apollo-boost": "^0.4.9",
"apollo-cache-inmemory": "^1.6.6",
"apollo-cache-instorage": "^0.2.5",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"apollo-link-context": "^1.0.20",
"apollo-link-http": "^1.5.17",
Expand Down Expand Up @@ -93,7 +90,6 @@
"eslint": "^7.1.0",
"husky": "^5.0.0",
"jest": "^26.0.1",
"release-it": "^13.6.8",
"ts-jest": "^26.0.0",
"ts-node": "^8.10.1",
"tslib": "^2.0.0",
Expand All @@ -102,26 +98,14 @@
},
"peerDependencies": {
"apollo-client": "^2.6.10",
"vue": "^2.6.11"
"vue": "^2.6.11 || >=3.0.0"
},
"peerDependenciesMeta": {
"apollo-client": {
"optional": true
}
},
"publishConfig": {
"access": "public"
},
"release-it": {
"npm": {
"publish": true
},
"github": {
"release": true
},
"git": {
"addUntrackedFiles": false
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md"
}
}
}
}
5 changes: 3 additions & 2 deletions src/models/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default abstract class Model extends EventEmitter {

public loading = false;

public createMutation?: string | CallableFunction | DocumentNode;
public createMutation?: string | CallableFunction | DocumentNode; // NOSONAR

public updateMutation?: string | CallableFunction | DocumentNode;

Expand Down Expand Up @@ -100,6 +100,7 @@ export default abstract class Model extends EventEmitter {
return new this.constructor(item);
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected getMethod(_opts: ResolvingRESTOptions) {
return null;
}
Expand Down Expand Up @@ -132,7 +133,7 @@ export default abstract class Model extends EventEmitter {
}

if (Array.isArray(value)) {
result[key] = await Promise.all(value.map(async model => ((model instanceof Model) ? await model.getUpdateVariables() : await model)));
result[key] = await Promise.all(value.map(async model => ((model instanceof Model) ? await model.getUpdateVariables() : await model))); // NOSONAR
continue;
}

Expand Down
Loading

0 comments on commit 576950f

Please sign in to comment.