Skip to content

Commit

Permalink
Merge pull request #41 from basics/feature/test
Browse files Browse the repository at this point in the history
Feature/test
  • Loading branch information
StephanGerbeth authored Sep 17, 2024
2 parents 2784b95 + 1e18e75 commit 2e73518
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 65 deletions.
57 changes: 40 additions & 17 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,33 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: checkout repo
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: 'package-lock.json'

- name: Install Dependencies
- name: cache node_modules
uses: actions/cache@v4
id: cache
with:
path: |
node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: install dependencies (no cache available)
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Lint
- name: lint
run: npm run lint

- name: Vitest - Test & Coverage
- name: vitest - Test & Coverage
run: npm run coverage

- name: Archive vitest code coverage results
- name: archive vitest code coverage results
uses: actions/upload-artifact@v4
with:
name: vitest-code-coverage-report
Expand All @@ -54,14 +64,26 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: checkout repo
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: 'package-lock.json'

- name: Versioning

- name: cache node_modules
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: install dependencies (no cache available)
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: release versioning
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -80,17 +102,18 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Download vitest code coverage results
- name: download vitest code coverage results
uses: actions/download-artifact@v4
with:
name: vitest-code-coverage-report
path: ./coverage/

- name: SonarCloud Scan
- name: SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,33 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: checkout repo
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Install Dependencies
- name: cache node_modules
uses: actions/cache@v4
id: cache
with:
path: |
node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: install dependencies (no cache available)
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Lint
- name: lint
run: npm run lint

- name: Vitest - Test & Coverage
- name: vitest - test & coverage
run: npm run coverage

- name: Archive vitest code coverage results
- name: archive vitest code coverage results
uses: actions/upload-artifact@v4
with:
name: vitest-code-coverage-report
Expand All @@ -54,17 +64,18 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Download vitest code coverage results
- name: download vitest code coverage results
uses: actions/download-artifact@v4
with:
name: vitest-code-coverage-report
path: ./coverage/

- name: SonarCloud Scan
- name: SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
88 changes: 72 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/setup-node@v4
- name: checkout repo
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Checkout Repo
uses: actions/checkout@v4

- name: cache node_modules
uses: actions/cache@v4
id: cache
Expand All @@ -36,17 +37,17 @@ jobs:
node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Install Dependencies
- name: install dependencies (no cache available)
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Lint
- name: lint
run: npm run lint

- name: Vitest - Test & Coverage
- name: vitest - Test & Coverage
run: npm run coverage

- name: Archive vitest code coverage results
- name: archive vitest code coverage results
uses: actions/upload-artifact@v4
with:
name: vitest-code-coverage-report
Expand All @@ -63,21 +64,26 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/setup-node@v4
- name: checkout repo
uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Checkout Repo
uses: actions/checkout@v4

- name: cache node_modules
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}

- name: Versioning
- name: install dependencies (no cache available)
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: release versioning
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -96,18 +102,68 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- name: checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Download vitest code coverage results
- name: download vitest code coverage results
uses: actions/download-artifact@v4
with:
name: vitest-code-coverage-report
path: ./coverage/

- name: SonarCloud Scan
- name: SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

deploy-ghpages:
name: Deploy (GH-Pages)
needs: semantic-version
strategy:
matrix:
os: [ubuntu-latest]
node: [20]

runs-on: ${{ matrix.os }}

steps:
- name: download vitest code coverage results
uses: actions/download-artifact@v4
with:
name: vitest-code-coverage-report
path: ./coverage/
- name: deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: coverage

merge-back-to-beta:
name: Update beta branch
needs: semantic-version
strategy:
matrix:
os: [ubuntu-latest]
node: [20]

runs-on: ${{ matrix.os }}

steps:
- name: checkout repo
uses: actions/checkout@v4

- name: set git config
run: |
git config --local user.email "actions@github.com"
git config --local user.name "Github Actions"
- name: merge main back to beta
run: |
git fetch --unshallow
git checkout beta
git pull
git merge --no-ff main -m "Auto-merge main back to beta"
git push
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,43 @@
[![Renovate - Status][renovate-status-src]][renovate-status-href]
[![License][license-src]][license-href]

[![Coverage Report][vitest-coverage-src]][vitest-coverage-href]

---

## ToDo
- evaluation
- [ ] BranchNameLint alternative (https://www.npmjs.com/package/branch-name-lint)
- [ ] SonarLint (https://docs.sonarsource.com/sonarcloud/improving/sonarlint/)
- [ ] ...
- [ ] BranchNameLint alternative (https://www.npmjs.com/package/branch-name-lint)
- [ ] SonarLint (https://docs.sonarsource.com/sonarcloud/improving/sonarlint/)
- [ ] ...
- observables + test
- [ ] default fetch
- [ ] window dom (resize, scroll)?
- [ ] ...
- [ ] default fetch
- [ ] window dom (resize, scroll)?
- [ ] ...
- operators + test
- [ ] finalize network retry
- [ ] request paginator (full, lazy)
- [ ] ...
- git actions
- [ ] implemented merge strategy
- only beta-branch can be merged into main
- only feature-branches can be merged into beta
- hotfixes can be merged directly into main, but beta will also be updated
- [ ] ...
- [ ] finalize network retry
- [ ] request paginator (full, lazy)
- [ ] ...
<!-- - git actions
- [ ] implemented merge strategy
- only beta-branch can be merged into main
- only feature-branches can be merged into beta
- hotfixes can be merged directly into main, but beta will also be updated
- [ ] ... -->
- git rules
- [ ] main branch can be updated only by pull request from
- [ ] beta branch
- [ ] hotfix branch
- [ ] beta branch can be updated only by pull request from
- [ ] feature branch
- [ ] hotfix branch
- sonarcloud
- [ ] finalized config
- [ ] ...
- [ ] finalized config
- [ ] ...
- additional git action services
- [ ] evaluate pr agent
- [ ] ...
- [ ] ...
- [ ] evaluate pr agent
- [ ] ...
- [ ] ...


[renovate-status-src]: <https://img.shields.io/badge/renovate-enabled-brightgreen>
Expand All @@ -59,3 +68,6 @@

[npm-downloads-src]: https://img.shields.io/npm/dt/nuxt-booster.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/nuxt-booster

[vitest-coverage-src]: https://img.shields.io/badge/Coverage_Report-2ea44f?logo=vitest&logoColor=%23fff
[vitest-coverage-href]: https://basics.github.io/rxjs-collection/
2 changes: 1 addition & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'lcov'],
reporter: ['text', 'json', 'lcov', 'html'],
reportsDirectory: './coverage',
exclude: [
...configDefaults.exclude,
Expand Down

0 comments on commit 2e73518

Please sign in to comment.