From 3079b694ba3750b62c3e6a2cded205660e956e77 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 17 May 2024 18:22:39 +0800 Subject: [PATCH 1/2] ci: Add pre-commit hook and github action to check links --- .github/workflows/deploy-hugo-site.yml | 14 +++++++++++++ .pre-commit-config.yaml | 20 ++++++++++++++++++ README.md | 29 +++++++++++++++++++++++++- requirements.txt | 1 + 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml create mode 100644 requirements.txt diff --git a/.github/workflows/deploy-hugo-site.yml b/.github/workflows/deploy-hugo-site.yml index d76ec3ed..314a6f80 100644 --- a/.github/workflows/deploy-hugo-site.yml +++ b/.github/workflows/deploy-hugo-site.yml @@ -26,7 +26,21 @@ defaults: shell: bash jobs: + check-links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + with: + args: --no-progress --include-fragments --exclude-path ./themes/ --exclude-path ./layouts/ . + # Fail action on broken links + fail: true + build-and-deploy: + needs: check-links runs-on: ubuntu-latest steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..86c8a8e2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: local + hooks: + - id: lychee + name: lychee link checker + entry: lycheeverse/lychee + language: docker_image + types: [markdown] + args: + - "--no-progress" + - "--include-fragments" diff --git a/README.md b/README.md index 33908150..61d9a0ea 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,40 @@ This project stores the files for the [Espressif Developer Portal][] website. Gi [Espressif Developer Portal]: https://developer.espressif.com/ + +## Contribute and render locally + If you want to contribute to this project, it would be nice to see the rendered version. The website can be easily rendered on your local machine using the following steps: 1. Clone this repository using `git clone --recursive`. 2. Install Hugo following the [instructions](https://gohugo.io/installation/). -3. In the project folder, run `hugo server` and open the provided local web address, usually http://localhost:1313/. +3. In the project folder, run `hugo server` and open the provided local web address, usually `http://localhost:1313/`. See also the Contribution Guide articles: - [Content contribution workflow](./content/pages/contribution_guide/content-contrib-workflow/index.md) - [Content writing workflow](./content/pages/contribution_guide/content-writing-workflow/index.md) + + +## Use pre-commit + +This project has a [pre-commit][] hook that can perform the following checks: + +- Enforce coding standards and best practices in the project's codebase +- Check links using [lychee][] + - **Important**: requires Docker + - `lychee` also runs as a GitHub action on pushes to main + +[pre-commit]: https://pre-commit.com/ +[lychee]: https://github.com/lycheeverse/lychee + +If you want to use pre-commit, in your project folder, run: + +```sh +# Install requirements +pip install -r requirements.txt +# Set up git hook scripts +pre-commit install +# Remove git hook scripts (if not needed) +pre-commit uninstall +``` diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..416634f5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pre-commit From 527c66a31f7fbe544380a90b504f4030a340bb91 Mon Sep 17 00:00:00 2001 From: "kirill.chalov" Date: Fri, 17 May 2024 18:28:23 +0800 Subject: [PATCH 2/2] fix: Correct all issues in repo found by pre-commit checks --- archetypes/default.md | 1 - assets/css/schemes/espressif.css | 24 +++++++++---------- config/_default/languages.en.toml | 2 -- config/_default/params.toml | 6 ++--- content/articles/_index.md | 2 +- content/authors/_index.md | 2 +- content/blog/_index.md | 2 +- content/blog/giscus_test_post/index.md | 4 ++-- content/events/_index.md | 2 +- content/pages/about.md | 2 +- content/pages/arduino/index.md | 2 +- .../content-contrib-workflow/index.md | 2 +- content/pages/esp-idf/index.md | 2 +- content/pages/ides/index.md | 3 +-- content/pages/nuttx/index.md | 3 +-- content/pages/rust/index.md | 2 +- content/pages/zephyr/index.md | 2 +- content/tags/_index.md | 2 +- content/tutorials/_index.md | 2 +- data/authors/espressif.json | 4 ++-- data/authors/pedrominatel.json | 2 +- layouts/partials/footer.html | 2 +- layouts/partials/toc.html | 12 +++++----- 23 files changed, 41 insertions(+), 46 deletions(-) diff --git a/archetypes/default.md b/archetypes/default.md index 00e77bd7..26f317f3 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -3,4 +3,3 @@ title: "{{ replace .Name "-" " " | title }}" date: {{ .Date }} draft: true --- - diff --git a/assets/css/schemes/espressif.css b/assets/css/schemes/espressif.css index 88bb09d7..317e0134 100644 --- a/assets/css/schemes/espressif.css +++ b/assets/css/schemes/espressif.css @@ -13,22 +13,22 @@ --color-neutral-900: 18, 27, 33; /* Red */ --color-primary-0: 252, 233, 232; - --color-primary-50: 250, 211, 209; - --color-primary-100: 247, 189, 186; + --color-primary-50: 250, 211, 209; + --color-primary-100: 247, 189, 186; --color-primary-150: 245, 167, 163; - --color-primary-200: 242, 145, 140; + --color-primary-200: 242, 145, 140; --color-primary-250: 240, 123, 117; - --color-primary-300: 237, 101, 94; + --color-primary-300: 237, 101, 94; --color-primary-350: 235, 80, 71; - --color-primary-400: 232, 58, 48; + --color-primary-400: 232, 58, 48; --color-primary-450: 230, 36, 25; - --color-primary-500: 207, 32, 23; + --color-primary-500: 207, 32, 23; --color-primary-550: 184, 29, 20; - --color-primary-600: 161, 25, 18; + --color-primary-600: 161, 25, 18; --color-primary-650: 138, 21, 15; - --color-primary-700: 115, 18, 13; + --color-primary-700: 115, 18, 13; --color-primary-750: 92, 14, 10; - --color-primary-800: 69, 11, 8; + --color-primary-800: 69, 11, 8; --color-primary-850: 46, 7, 5; --color-primary-900: 23, 4, 3; --color-primary-950: 0, 0, 0; @@ -44,10 +44,10 @@ --color-secondary-800: 48, 36, 66; --color-secondary-900: 24, 18, 33; } - - /* + + /* #e7352c RED #674d8e Purple #384f7a Blue #2f4858 Grey - */ \ No newline at end of file + */ diff --git a/config/_default/languages.en.toml b/config/_default/languages.en.toml index b766499a..f5310745 100644 --- a/config/_default/languages.en.toml +++ b/config/_default/languages.en.toml @@ -26,5 +26,3 @@ title = "Developer Portal" { linkedin = "https://www.linkedin.com/company/espressif-systems/" }, { github = "https://github.com/espressif" }, ] - - \ No newline at end of file diff --git a/config/_default/params.toml b/config/_default/params.toml index ecd264fd..e87a7617 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -76,8 +76,8 @@ smartTOCHideUnfocusedChildren = false showTableOfContents = true showRelatedContent = true relatedContentLimit = 3 - showTaxonomies = true - showAuthorsBadges = true + showTaxonomies = true + showAuthorsBadges = true showWordCount = false sharingLinks = [ "linkedin", "twitter", "reddit", "whatsapp", "telegram", "facebook", "email"] showZenMode = true @@ -121,7 +121,7 @@ smartTOCHideUnfocusedChildren = false groupByYear = false cardView = true cardViewScreenWidth = false - + [firebase] apiKey = "" authDomain = "" diff --git a/content/articles/_index.md b/content/articles/_index.md index 59182fae..2125438c 100644 --- a/content/articles/_index.md +++ b/content/articles/_index.md @@ -9,7 +9,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : true -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : false diff --git a/content/authors/_index.md b/content/authors/_index.md index 97511871..8cd8731c 100644 --- a/content/authors/_index.md +++ b/content/authors/_index.md @@ -8,7 +8,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : false diff --git a/content/blog/_index.md b/content/blog/_index.md index a5415ef4..519dce12 100644 --- a/content/blog/_index.md +++ b/content/blog/_index.md @@ -10,7 +10,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : true -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : false diff --git a/content/blog/giscus_test_post/index.md b/content/blog/giscus_test_post/index.md index affc9acc..5bbd6712 100644 --- a/content/blog/giscus_test_post/index.md +++ b/content/blog/giscus_test_post/index.md @@ -18,8 +18,8 @@ Nunc tempus quis risus non vulputate. Praesent blandit sagittis massa posuere ve Mauris eleifend in augue a egestas. Donec eu ullamcorper mauris. Ut tristique elit vulputate ante suscipit, in ultrices lectus pretium. Cras sodales velit vitae massa ornare, eu imperdiet risus dictum. Etiam dui metus, feugiat vel hendrerit et, molestie a odio. Vivamus non fermentum nibh, ut cursus mi. Fusce sem sapien, ultricies eget purus et, efficitur sollicitudin erat. Etiam pharetra lacus urna, non pretium libero rutrum porta. Suspendisse aliquet nibh convallis nisi pulvinar molestie. Vivamus id arcu eu justo congue facilisis ut in urna. Donec ipsum nulla, rhoncus sit amet magna faucibus, consectetur fringilla turpis. Aliquam in egestas metus. Ut aliquet rhoncus libero ac fermentum. Pellentesque porta nisi mi, ac porta nisl congue et. -Curabitur eu laoreet neque. Sed augue velit, ultrices nec ante eget, egestas posuere tortor. Vestibulum at nulla ullamcorper, ullamcorper neque sit amet, efficitur mi. Sed ornare leo erat, in ullamcorper tellus facilisis nec. Sed imperdiet ligula eu diam aliquam gravida. Sed pretium dictum erat eu porttitor. Donec pellentesque nisi sit amet ante sodales, eu bibendum mauris pretium. Aliquam molestie lacus nec nunc dictum ultrices. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec in maximus metus. Fusce mauris lectus, eleifend sed varius in, semper eu dolor. Quisque ut nisl pulvinar, scelerisque tellus vitae, convallis ex. Cras placerat quam et mi semper aliquam. Donec volutpat nulla est, eu suscipit augue rutrum sit amet. Vestibulum dapibus sem tortor, quis feugiat magna feugiat vel. Etiam ultrices iaculis lorem, vitae fermentum metus. +Curabitur eu laoreet neque. Sed augue velit, ultrices nec ante eget, egestas posuere tortor. Vestibulum at nulla ullamcorper, ullamcorper neque sit amet, efficitur mi. Sed ornare leo erat, in ullamcorper tellus facilisis nec. Sed imperdiet ligula eu diam aliquam gravida. Sed pretium dictum erat eu porttitor. Donec pellentesque nisi sit amet ante sodales, eu bibendum mauris pretium. Aliquam molestie lacus nec nunc dictum ultrices. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec in maximus metus. Fusce mauris lectus, eleifend sed varius in, semper eu dolor. Quisque ut nisl pulvinar, scelerisque tellus vitae, convallis ex. Cras placerat quam et mi semper aliquam. Donec volutpat nulla est, eu suscipit augue rutrum sit amet. Vestibulum dapibus sem tortor, quis feugiat magna feugiat vel. Etiam ultrices iaculis lorem, vitae fermentum metus. ## Conclusion -This is a must have feature! \ No newline at end of file +This is a must have feature! diff --git a/content/events/_index.md b/content/events/_index.md index 7b785dde..f06380f2 100644 --- a/content/events/_index.md +++ b/content/events/_index.md @@ -9,7 +9,7 @@ showHeadingAnchors : false showPagination : true showReadingTime : false showTableOfContents : false -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : true diff --git a/content/pages/about.md b/content/pages/about.md index 34ee7ccf..3a6b8aa5 100644 --- a/content/pages/about.md +++ b/content/pages/about.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : false diff --git a/content/pages/arduino/index.md b/content/pages/arduino/index.md index 8db14746..8ba8fb44 100644 --- a/content/pages/arduino/index.md +++ b/content/pages/arduino/index.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : true +showTaxonomies : true showWordCount : false showSummary : false sharingLinks : false diff --git a/content/pages/contribution_guide/content-contrib-workflow/index.md b/content/pages/contribution_guide/content-contrib-workflow/index.md index 694496bb..6eaa924b 100644 --- a/content/pages/contribution_guide/content-contrib-workflow/index.md +++ b/content/pages/contribution_guide/content-contrib-workflow/index.md @@ -78,7 +78,7 @@ To contribute from the private mirror on Espressif GitLab to `espressif / develo For private contributions from anywhere, do the following: -- Create a private mirror as described in [How to create a private mirror](#how-to-create-a-private-mirror) +- Set up a private mirror as described in [How to set up a private mirror](#how-to-set-up-a-private-mirror) - In your private mirror, create a new branch and make the desired updates - Invite Espressif's reviewers to your private mirror to do the review - Once the private work on the new branch is finished, do the following in the private mirror: diff --git a/content/pages/esp-idf/index.md b/content/pages/esp-idf/index.md index d17d4ffc..ba4ece4a 100644 --- a/content/pages/esp-idf/index.md +++ b/content/pages/esp-idf/index.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : true +showTaxonomies : true showWordCount : false showSummary : false sharingLinks : false diff --git a/content/pages/ides/index.md b/content/pages/ides/index.md index 01f32afe..60cc5c07 100644 --- a/content/pages/ides/index.md +++ b/content/pages/ides/index.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : true +showTaxonomies : true showWordCount : false showSummary : false sharingLinks : false @@ -22,4 +22,3 @@ showRelatedContent : false relatedContentLimit : 3 disableComments : true --- - diff --git a/content/pages/nuttx/index.md b/content/pages/nuttx/index.md index 64f3a49e..36bb53ba 100644 --- a/content/pages/nuttx/index.md +++ b/content/pages/nuttx/index.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : true +showTaxonomies : true showWordCount : false showSummary : false sharingLinks : false @@ -22,4 +22,3 @@ showRelatedContent : false relatedContentLimit : 3 disableComments : true --- - diff --git a/content/pages/rust/index.md b/content/pages/rust/index.md index 19c89df3..5487a81b 100644 --- a/content/pages/rust/index.md +++ b/content/pages/rust/index.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : true +showTaxonomies : true showWordCount : false showSummary : false sharingLinks : false diff --git a/content/pages/zephyr/index.md b/content/pages/zephyr/index.md index 4771e3b0..35b06b83 100644 --- a/content/pages/zephyr/index.md +++ b/content/pages/zephyr/index.md @@ -11,7 +11,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : true +showTaxonomies : true showWordCount : false showSummary : false sharingLinks : false diff --git a/content/tags/_index.md b/content/tags/_index.md index 926043f6..993f1573 100644 --- a/content/tags/_index.md +++ b/content/tags/_index.md @@ -8,7 +8,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : false -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : false diff --git a/content/tutorials/_index.md b/content/tutorials/_index.md index d5c9347e..7ee2bbc5 100644 --- a/content/tutorials/_index.md +++ b/content/tutorials/_index.md @@ -9,7 +9,7 @@ showHeadingAnchors : false showPagination : false showReadingTime : false showTableOfContents : true -showTaxonomies : false +showTaxonomies : false showWordCount : false showSummary : false sharingLinks : false diff --git a/data/authors/espressif.json b/data/authors/espressif.json index 6cade778..19e074a5 100644 --- a/data/authors/espressif.json +++ b/data/authors/espressif.json @@ -1,5 +1,5 @@ { - "name": "John Lee", + "name": "John Lee", "image" : "img/authors/espressif.png", "bio": "Espressif Systems", "social": [ @@ -10,4 +10,4 @@ { "github": "https://github.com/espressif" }, { "link": "https://espressif.com/"} ] -} \ No newline at end of file +} diff --git a/data/authors/pedrominatel.json b/data/authors/pedrominatel.json index ff951707..2b1a624b 100644 --- a/data/authors/pedrominatel.json +++ b/data/authors/pedrominatel.json @@ -6,4 +6,4 @@ { "linkedin": "https://www.linkedin.com/in/pedrominatel/" }, { "github": "https://github.com/pedrominatel" } ] -} \ No newline at end of file +} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 603277ed..bb3b3df6 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -65,4 +65,4 @@ {{ if templates.Exists "partials/extend-footer.html" }} {{ partialCached "extend-footer.html" . }} {{ end }} - \ No newline at end of file + diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index e9dc950f..9789b3d8 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -19,7 +19,7 @@ -{{ if .Site.Params.smartTOC }} +{{ if .Site.Params.smartTOC }} -{{ end }} \ No newline at end of file +{{ end }}