Skip to content

Commit

Permalink
Merge pull request #60 from 3mdeb/SEO_CI
Browse files Browse the repository at this point in the history
SEO CI
  • Loading branch information
artur-rs authored Aug 4, 2023
2 parents 7d12c71 + 58bdc90 commit 5342092
Show file tree
Hide file tree
Showing 102 changed files with 1,127 additions and 475 deletions.
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = *.svg,*.pl.md,themes/3mbed/assets/*.js
ignore-words-list = "doubleclick"
16 changes: 16 additions & 0 deletions .conform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
policies:
- type: commit
spec:
header:
length: 80
imperative: false
invalidLastCharacters: .
body:
required: false
dco: true
gpg:
required: true
spellcheck:
locale: US
maximumOfOneCommit: false
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: GitHub Pages

on:
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/seo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
name: SEO CI
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
fail: true
args: --max-redirects 10 -a 403,500,503 .

seo_spy_orphan_pages:
runs-on: ubuntu-latest
name: Check orphan pages
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Checkout SEO Spy
uses: actions/checkout@v3
with:
repository: 3mdeb/seo-spy
path: seo-spy

- uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r seo-spy/requirements.txt
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
extended: true

- name: Serve site
run: |
npm install postcss-cli
hugo
hugo serve -b http://localhost:1313 --bind=0.0.0.0 &
- name: Check orphan pages
uses: 3mdeb/seo-spy-action@main
with:
domain: 'http://localhost:1313'

seo_spy_canonical_links:
runs-on: ubuntu-latest
name: Check canonical links
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true

- name: Checkout SEO Spy
uses: actions/checkout@v3
with:
repository: 3mdeb/seo-spy
path: seo-spy

- uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r seo-spy/requirements.txt
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
extended: true

- name: Serve site
run: |
npm install postcss-cli
hugo
hugo serve -b http://localhost:1313 --bind=0.0.0.0 &
- name: Check canonical links
uses: 3mdeb/seo-spy-action@main
with:
domain: 'http://localhost:1313'
args: '-c'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ resources
*.lock
jsconfig.json
hugo_stats.json
go.sum
go.sum
6 changes: 6 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
themes/3mbed/layouts/
http://localhost:1313/
https://www.embedded-world.de/en/all-about-the-exhibition
.email
.sales
https://twitter.com/dwizzzleMSFT
34 changes: 34 additions & 0 deletions .markdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
MD041:
# Heading level
level: 1
# RegExp for matching title in front matter
front_matter_title: "^\\s*title\\s*[:=]"

# MD042/no-empty-links - No empty links
MD042: true

# MD046/code-block-style - Code block style
# MD046: Rule temporarily disabled, it prevents new tabs from being formatted
# correctly - eg. docs/unified/novacustom/overview.md:9
# Block style
# style: "fenced"

# MD047/single-trailing-newline - Files should end with a single newline character
MD047: true

# MD048/code-fence-style - Code fence style
MD048:
# Code fence style
style: "backtick"

# MD049/emphasis-style - Emphasis style should be consistent
MD049:
# Emphasis style should be consistent
style: "underscore"

# MD050/strong-style - Strong style should be consistent
MD050:
# Strong style should be consistent
style: "asterisk"
54 changes: 54 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# See https://pre-commit.com/hooks.html for more hooks
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending

- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
hooks:
- id: yamllint
args: [-c=.yamllint]

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.34.0
hooks:
- id: markdownlint
- id: markdownlint-fix

- repo: https://github.com/talos-systems/conform
rev: v0.1.0-alpha.27
hooks:
- id: conform
stages:
- commit-msg

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell

- repo: local
hooks:
- id: double_slashes_url_external
name: Check double slashes in external URLs
entry: https?:\/\/[^\s]*(?<!http:)((?<!https:)\/\/).*
language: pygrep
exclude: '^.*.(jpeg|jpg|png|pdf)$'
- id: double_slashes_url_markdown
name: Check double slashes in markdown URLs
entry: (\:\s|\()[^\s]*(?<!http:)((?<!https:)\/\/)
language: pygrep
exclude: '^.*.(jpeg|jpg|png|pdf)$'

ci:
autoupdate_commit_msg: 'pre-commit: autoupdate hooks'
autofix_prs: false
16 changes: 16 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
extends: default

rules:
comments:
require-starting-space: true
ignore-shebangs: true
min-spaces-from-content: 2
document-start:
present: true
level: error
indentation:
spaces: 2
line-length: disable
truthy:
check-keys: false
69 changes: 64 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Beta deploy status:

## Local preview

1. Run local server: `./scripts/local-preview.sh http://<IP-ADDRESS>`
1. Go to [http://<IP-ADDRESS>:1313/](http://localhost:1313/) to view the changes.
1. Run local server: `./scripts/local-preview.sh http://{IP-ADDRESS}`
1. Go to [http://{IP-ADDRESS}:1313/](http://localhost:1313/) to view the changes.

> _NOTE_: Using `localhost` could end in partial resource import, therefore try
to use the local IP address of the host machine. Feel free to replace
`http://localhost:1313` with desired address IP and port.

> _NOTE-2_: If you are having problems with docker (above script), use locally
> installed hugo:
>
> 1. Install hugo: `sudo snap install hugo`
> 2. Start local server: `hugo server`
> 3. Open locally deployed website on `localhost:1313`
Expand All @@ -37,13 +37,72 @@ additional layer of control and verification in the beta/prod environment.
2. After pushing changes to your branch, set a Pull Request to `develop` branch,
instead of `main`. Reporter will verify patch and publish beta env to the
production later.
* beta website: https://beta.3mdeb.com/
* prod website: https://3mdeb.com/
* beta website: <https://beta.3mdeb.com/>
* prod website: <https://3mdeb.com/>

> **NOTE**: If you forgot about rule Ad. 1, you can change the source branch
> by rebasing you branch: `git rebase --onto <new-parent> <old-parent>`. For
> example: `git rebase --onto develop main`.
### Broken links checker

Currently we are using [lychee](https://github.com/lycheeverse/lychee) a fast,
async, stream-based link checker written in Rust. The automatic check is
triggered on each push to the master pull request.

You can also run it locally using a docker image:

```bash
$ docker run --init -it --rm -w $(pwd) -v $(pwd):$(pwd) lycheeverse/lychee
--max-redirects 10 -a 403,429,500,502,503,999 .
```

### Relative links

Please avoid using relative like:

```md
[contact](../../contact/)
```

Instead, use absolute links:

```md
[contact](https://3mdeb.com/contact/)
```

### pre-commit hooks

* [Install pre-commit](https://pre-commit.com/index.html#install), if you
followed [local build](#local-preview) procedure `pre-commit` should be
installed

* [Install go](https://go.dev/doc/install)

* Install hooks into repo:

```shell
pre-commit install --hook-type commit-msg
```

* Enjoy automatic checks on each `git commit` action!

* (Optional) Run hooks on all files (for example, when adding new hooks or
configuring existing ones):

```shell
pre-commit run --all-files
```

#### To skip verification

In some cases, it may be needed to skip `pre-commit` tests. To do that, please
use:

```shell
git commit --no-verify
```

### Grammarly - a must have for content verification

Grammarly is a great, free tool for all bloggers and anyone who needs to write
Expand Down
2 changes: 1 addition & 1 deletion archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ keywords: []
description: "3mdeb: Your Trusted Partner in Embedded Systems and Firmware Security. Enhance your product's reliability and security with our expert consulting services, firmware development, and hardware design solutions. We specialize in open-source firmware, secure boot, and IoT security. Contact us for tailored solutions to meet your embedded system needs."
# save as draft
draft: false
---
---
2 changes: 1 addition & 1 deletion assets/images/cooperation/block-line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/cooperation/copleft-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/cooperation/copright-icon2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/logo300x104.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/ml-british-flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/ml-polish-flag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is for render site varibles and plugins
# This file is for render site variables and plugins
# don't remove this file.
# The presence of this file is for compatibility with Blogdown and Forestry.
#
Expand Down
2 changes: 1 addition & 1 deletion config/_default/menus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,4 @@ weight = 10
[[footer]]
name = "Contact Us"
url = "/contact/"
weight = 15
weight = 15
Loading

0 comments on commit 5342092

Please sign in to comment.