Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
per1234 committed Oct 17, 2023
1 parent d2e11cd commit 3116215
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 48 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/check-hugo-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,35 @@ jobs:
github.com/go-task/task/v3/cmd/task
- name: Build website
run: task website:validate
run: |
task \
--silent \
website:validate
check-dependencies:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: ${{ matrix.module.path }}/go.mod

- name: Install Task
run: |
go \
install \
github.com/go-task/task/v3/cmd/task
- name: Run hugo mod tidy
run: task website:tidy

- name: Check whether any tidying was needed
run: git diff --color --exit-code
43 changes: 28 additions & 15 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ tasks:
- task: go:fix
- task: go:format
- task: go:tidy
- task: go:tidy
vars:
GO_MODULE_PATH: ./site
- task: markdown:fix
- task: poetry:sync
- task: website:tidy

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-workflows-task/Taskfile.yml

Check warning on line 48 in Taskfile.yml

View workflow job for this annotation

GitHub Actions / Generate problem matcher output

48:121 [line-length] line too long (131 > 120 characters)
ci:validate:
Expand Down Expand Up @@ -458,38 +456,53 @@ tasks:
desc: Check whether the Hugo-based website will build
deps:
- task: docs:generate
- task: website:install-deps
dir: ./site
cmds:
- |
CGO_ENABLED=1 \
go \
install \
-tags extended \
github.com/gohugoio/hugo
- |
hugo \
--printI18nWarnings \
--printPathWarnings \
--renderToMemory \
--source ./site \
--templateMetrics \
--templateMetricsHints
website:serve:
desc: Run website locally
deps:
- task: docs:generate
website:install-deps:
desc: Install website dependencies
cmds:
- |
CGO_ENABLED=1 \
go \
install \
-tags extended \
github.com/gohugoio/hugo
website:serve:
desc: Run website locally
deps:
- task: docs:generate
- task: website:install-deps
dir: ./site
cmds:
- |
hugo \
--source ./site \
server
# Due to the theme not containing a Go package, using a tools package and go tidy in the
# github.com/per1234/inoplatforms/site module results in a "does not contain package" error.
# hugo mod tidy is smart enough to handle this situation correctly.
website:tidy:
desc: Refresh dependency metadata
dir: ./site
vars:
GO_VERSION: 1.21
cmds:
- |
hugo \
mod \
tidy \
-compat={{.GO_VERSION}}
website:validate:
desc: Validate Hugo configuration file against its JSON schema
vars:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
github.com/editorconfig-checker/editorconfig-checker v0.0.0-20231010092335-16848f20ad57
github.com/go-task/task/v3 v3.31.0
github.com/gohugoio/hugo v0.119.0
github.com/golangci/golangci-lint v1.54.2
)

Expand Down Expand Up @@ -129,7 +130,6 @@ require (
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20230805085216-e63c13218d0e // indirect
github.com/gohugoio/hugo v0.119.0 // indirect
github.com/gohugoio/locales v0.14.0 // indirect
github.com/gohugoio/localescompressed v1.0.1 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
Expand Down
Loading

0 comments on commit 3116215

Please sign in to comment.