Skip to content

Commit

Permalink
chore: github worlflow
Browse files Browse the repository at this point in the history
  • Loading branch information
voznik committed Oct 16, 2023
1 parent 71c4824 commit aa8375c
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 192 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# strategy:
# matrix:
# node-version: [12.x, 14.x]
Expand Down Expand Up @@ -76,16 +80,30 @@ jobs:
path:
dist/packages
# !dist/**/*.md
# Build if release published
- name: Build Demo
# if: github.event.release.published
run: npm run build:demo && npm run compodoc
###
# - name: Setup Pages for demo
# uses: actions/configure-pages@v3
###
- name: Upload demo artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'dist/demo'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action

publish:
# if: github.event.pull_request.merged
# if: github.event.release.published
if: github.event.pull_request.merged || github.event.release.published
needs: build
runs-on: ubuntu-latest
steps:
# - uses: actions/checkout@v2
# - name: Download all workflow run artifacts
- uses: actions/cache@v2
# - uses: actions/cache@v2
- uses: actions/download-artifact@v2
- name: Version and publish
run: |
Expand All @@ -97,7 +115,7 @@ jobs:
git push gh-origin HEAD:master --tags
- uses: actions/setup-node@v2
with:
node-version: 12
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: |
npm run packages:publish:dev
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/dist
/docs
/documentation
/public
/tmp
/out-tsc
**/builds
Expand Down
36 changes: 30 additions & 6 deletions examples/demo/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/demo",
"index": "examples/demo/src/index.html",
"main": "examples/demo/src/main.ts",
"polyfills": ["zone.js"],
"polyfills": [
"zone.js"
],
"tsConfig": "examples/demo/tsconfig.app.json",
"assets": ["examples/demo/src/favicon.ico", "examples/demo/src/assets"],
"assets": [
"examples/demo/src/favicon.ico",
"examples/demo/src/assets"
],
"styles": [
"node_modules/todomvc-common/base.css",
"node_modules/todomvc-app-css/index.css"
Expand Down Expand Up @@ -69,14 +76,21 @@
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": ["examples/demo/**/*.ts", "examples/demo/**/*.html"]
"lintFilePatterns": [
"examples/demo/**/*.ts",
"examples/demo/**/*.html"
]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"options": {
"jestConfig": "examples/demo/jest.config.ts",
"passWithNoTests": true
Expand All @@ -87,6 +101,16 @@
"codeCoverage": true
}
}
},
"file-server": {
"executor": "@nrwl/web:file-server",
"options": {
"buildTarget": "demo:build:production",
"port": 4201,
"host": "0.0.0.0",
"proxyUrl": "http://localhost:4201?",
"watch": true
}
}
}
}
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { Config } from 'jest';

const config: Config = {
projects: getJestProjects(),
globalSetup: 'jest-preset-angular/global-setup',
};

export default config;
28 changes: 27 additions & 1 deletion jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
const CI = process.env.CI === 'true' || true;

/** @type {import('jest').Config} */
const config = {
...nxPreset,
collectCoverage: CI,
coverageReporters: [
'html',
'text-summary',
'json',
['lcov', { file: 'rxdb-coverage.lcov' }],
['json-summary', { file: 'rxdb-coverage-summary.json' }],
],
collectCoverageFrom: [
'**/*.{ts,tsx}',
'!**/*.{stories,worker}.ts',
'!**/index.ts',
'!**/node_modules/**',
],
bail: true,
verbose: true,
// resetModules: true,
// clearMocks: true,
passWithNoTests: true,
};

module.exports = config;
139 changes: 8 additions & 131 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"_postinstall": "node ./decorate-angular-cli.js && npm run ngcc",
"ngcc": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
"start": "nx run demo:serve",
"build:prod": "npm run ng-high-memory -- build --prod",
"build:demo": "nx run demo:build",
"build:sourcemaps": "npm run ng-high-memory -- build --prod --sourceMap=true --statsJson",
"packages:test": "npm run nx -- run-many --target=test --projects=rxdb,kinto --ci --run-in-band --parallel --pass-with-no-tests && npm run packages:test:merge",
"packages:test:merge": "./node_modules/.bin/lcov-result-merger 'coverage/packages/*.lcov' coverage/lcov.info",
Expand All @@ -58,7 +58,6 @@
"packages:publish:dev": "ts-node tools/scripts/publish-dev-builds.ts",
"test": "nx test",
"test:hook": "npm run affected:test -- --reporters='jest-junit' --parallel --pass-with-no-tests --base=master --head=HEAD",
"lint": "nx workspace-lint && ng lint",
"lint:hook": "npm run affected:lint -- --parallel --base=master --head=HEAD",
"lint:uncommitted": "npm run affected:lint -- --parallel --fix --uncommitted",
"e2e": "ng e2e",
Expand Down Expand Up @@ -130,7 +129,7 @@
"@nx/linter": "16.8.1",
"@nx/workspace": "16.8.1",
"@schematics/angular": "~16.2.0",
"@twittwer/compodoc": "1.5.1",
"@twittwer/compodoc": "1.10.0",
"@types/dotenv": "8.2.0",
"@types/fs-extra": "^11.0.2",
"@types/jest": "^29.4.0",
Expand Down
Loading

0 comments on commit aa8375c

Please sign in to comment.