Skip to content

Commit

Permalink
[add] improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalitov committed Dec 1, 2024
1 parent 882e69c commit 85f28b5
Show file tree
Hide file tree
Showing 19 changed files with 6,780 additions and 4,862 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ updates:
schedule:
interval: "weekly"
ignore:
# No need to update the UIKit I guess
# No need to update the UIKit, I guess
- dependency-name: "uikit"
4 changes: 2 additions & 2 deletions .github/workflows/attachements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Validate screenshot
run: npm run screenshot:test
- name: Upload files
uses: gavv/pull-request-artifacts@v1.0.0
uses: gavv/pull-request-artifacts@v2
with:
commit: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codacy-coverage-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Use Node.js 18.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 23.x
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Run test coverage
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
Expand All @@ -11,7 +6,7 @@
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.

name: Codacy Security Scan
name: Codacy

on:
push:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
base_branch_cov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- name: Use Node.js 23.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 23.x

- name: Install dependencies
run: npm ci
Expand All @@ -41,14 +41,14 @@ jobs:
runs-on: ubuntu-latest
needs: base_branch_cov
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 238.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 23.x

- name: Download code coverage report from base branch
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ref-lcov.info

Expand All @@ -58,14 +58,14 @@ jobs:
- name: Run test coverage
run: npm run coverage

# Compares two code coverage files and generates report as a comment
# Compares two code coverage files and generates a report as a comment
- name: Generate Code Coverage report
id: code-coverage
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./coverage/lcov.info"
base-lcov-file: "lcov.info"
minimum-ratio: 0 # Fails Github action once code coverage is decreasing
minimum-ratio: 0 # Fails GitHub action once code coverage is decreasing
send-summary-comment: true
show-annotations: "warning" # Possible options warning|error
4 changes: 2 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
uses: actions/dependency-review-action@v4
50 changes: 0 additions & 50 deletions .github/workflows/eslint.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: Deploy Hugo site to Pages
name: Deploy

on:
# Runs on pushes targeting the default branch
Expand Down Expand Up @@ -40,12 +40,12 @@ jobs:
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
Expand All @@ -59,7 +59,7 @@ jobs:
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: ./src/public

Expand All @@ -73,4 +73,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
10 changes: 6 additions & 4 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
Expand All @@ -55,7 +55,7 @@ jobs:
- run: sleep 15
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts
- name: Lighthouse
uses: foo-software/lighthouse-check-action@master
uses: foo-software/lighthouse-check-action@v12
id: lighthouseCheck
with:
device: 'all'
Expand All @@ -66,7 +66,9 @@ jobs:
gitBranch: ${{ github.ref }}
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: ${{ github.workspace }}/tmp/artifacts
configFile: ./lighthouse-config.js
# see https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md
# and https://github.com/GoogleChrome/lighthouse/blob/main/core/config/default-config.js
overridesJsonFile: ./lighthouse-overrides.json
sha: ${{ github.sha }}
urls: 'http://localhost:1313/'
- name: Upload artifacts
Expand All @@ -75,7 +77,7 @@ jobs:
name: Lighthouse reports
path: ${{ github.workspace }}/tmp/artifacts
- name: Verify Lighthouse Check results
uses: foo-software/lighthouse-check-status-action@master
uses: foo-software/lighthouse-check-status-action@v3
with:
lighthouseCheckResults: ${{ steps.lighthouseCheck.outputs.lighthouseCheckResults }}
minAccessibilityScore: "80"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Own Tests
name: Tests

on:
pull_request:
Expand All @@ -14,13 +14,13 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [23.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@master
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Thumbs.db
#bak files
~*
*.bak
*~

#temp files
*.tmp
Expand Down
7 changes: 7 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"default": true,
"MD041": false,
"MD013": {
"line_length": 120
}
}
3 changes: 3 additions & 0 deletions .npmpackagejsonlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "npm-package-json-lint-config-default"
}
37 changes: 20 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
# Contributions are warmly welcome!
# Contributions are warmly welcome

If you want to contribute please follow this guideline.
If you want to contribute, please follow this guideline.

## Steps

1. You need to install [Node.js](https://nodejs.org/en/download) and [Hugo](https://gohugo.io/installation/).
2. Fork this project.
3. Clone your fork to your PC.
4. Install dependencies, run command: `$ npm ci`
5. Create a new branch for your contributions
6. Write your code. Some helping commands (they should run inside `src` directory):
* Build page: `$ hugo`. The built page will be `/src/public/index.html`.
* Run local Hugo server to monitor your changes in real-time as you write code: `$ hugo server -D`
7. Test your code with command `$ npm test`. It should pass, otherwise fix the errors. Some commands available for automatic fix of errors:
* For ESLint (JS): `$ npm run lint:fix`
* For Stylelint (CSS): `$ npm run stylelint:fix`
* For Markdown: `$ npm run markdown:fix`
8. Commit your changes and open PR.
1. You need to install [Node.js](https://nodejs.org/en/download) and [Hugo](https://gohugo.io/installation/).
2. Fork this project.
3. Clone your fork to your PC.
4. Install dependencies, run command: `$ npm ci`
5. Create a new branch for your contributions
6. Write your code. Some helping commands (they should run inside `src` directory):
* Build page: `$ hugo`. The built page will be `/src/public/index.html`.
* Run local Hugo server to monitor your changes in real-time as you write code: `$ hugo server -D`
7. Test your code with command `$ npm test`. It should pass, otherwise fix the errors. Some commands available for
automatic fix of errors:
* For ESLint (JS): `$ npm run lint:fix`
* For Stylelint (CSS): `$ npm run stylelint:fix`
* For Markdown: `$ npm run markdown:fix`
8. Commit your changes and open PR.

### Useful links

* GitHub Guide: [Contributing to projects. Learn how to contribute to a project through forking.](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) Useful if you're not familiar with GitHub forking yet.
* [Hugo manual](https://gohugo.io/documentation/)
* GitHub
Guide: [Contributing to projects. Learn how to contribute to a project through forking.](https://docs.github.com/en/get-started/quickstart/contributing-to-projects)
Useful if you're not familiar with GitHub forking yet.
* [Hugo manual](https://gohugo.io/documentation/)
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ Dark theme:
This projects allows to generate a simple page for that with the following
features.

* single page only, just use resulting `index.html`.
All styles and JS are integrated in page.
* multilingual support with automatic preferred user language detection.
Can correctly handle cases when user has complex set of preferred
languages with different locales such as "en-GB", "en-US", etc.
* responsive design
* tests cover all major JS code
* single page only, just use resulting `index.html`.
All styles and JS are integrated in page.
* multilingual support with automatic preferred user language detection.
Can correctly handle cases when user has complex set of preferred
languages with different locales such as "en-GB", "en-US", etc.
* responsive design
* tests cover all major JS code

## Technical details

The project is made with Hugo for website generation, UIkit for UI, Jest for testing.

## How to compile

1. Configure the website options in `/src/config.toml`.
2. Adjust texts to your needs or add translations in `/src/data/`.
To order the languages use the `weight` parameter.
3. Optionally add your own CSS in `/src/layours/partials/styles.css`
4. Optionally run tests with Jest if you modify the JS code: `npm test`
5. Build the page with Hugo, run `hugo --minify` in `/src/` directory.
The generated page will be in `/src/public/index.html`.
1. Configure the website options in `/src/config.toml`.
2. Adjust texts to your needs or add translations in `/src/data/`.
To order the languages use the `weight` parameter.
3. Optionally add your own CSS in `/src/layours/partials/styles.css`
4. Optionally run tests with Jest if you modify the JS code: `npm test`
5. Build the page with Hugo, run `hugo --minify` in `/src/` directory.
The generated page will be in `/src/public/index.html`.

## Contributions

Expand Down
16 changes: 0 additions & 16 deletions lighthouse-config.js

This file was deleted.

Loading

0 comments on commit 85f28b5

Please sign in to comment.