Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
Add initial action and tests
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel F. Dickinson <[email protected]>
  • Loading branch information
danielfdickinson committed Sep 10, 2023
1 parent 0d3b179 commit 68b9ac6
Show file tree
Hide file tree
Showing 42 changed files with 1,366 additions and 286 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ indent_style = space
[*.md]
trim_trailing_whitespace = false

[README*.md]
indent_size = 2
indent_style = space

[*.svg]
insert_final_newline = false
trim_trailing_whitespace = false
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/test-build-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# yamllint disable rule:key-ordering
name: test-build-audit
on: # yamllint disable-line
pull_request:
branches:
- main
types:
- assigned
- opened
- synchronize
- reopened
jobs:
# yamllint disable rule:line-length
audit-only:
runs-on: ubuntu-22.04
strategy:
matrix:
hugo-version: [0.112.7, 0.115.4, 0.117.0, latest]
post-status: [default, drafts, future]
steps:
- uses: actions/checkout@v3
- name: Run audit-build-action-hugo using config from tests/config
uses: ./
with:
base-url: "https://example.com/"
config-file: hugo.toml,variations/config-${{ matrix.post-status }}.toml,variations/config-${{ matrix.hugo-version }}.toml
hugo-version: ${{ matrix.hugo-version }}
include-drafts-audit: ${{ toJSON(matrix.post-status == 'drafts') }}
include-future-audit: ${{ toJSON(matrix.post-status == 'future') }}
source-directory: tests/config
upload-artifact:
runs-on: ubuntu-22.04
strategy:
matrix:
post-status: [default, drafts, future]
steps:
- uses: actions/checkout@v3
- name: Run hugo-action-build-audit from src dir to public
uses: ./
with:
config-file: hugo.toml,variations/config-${{ matrix.post-status }}.toml,variations/config-latest.toml
include-drafts-bundle: ${{ toJSON(matrix.post-status == 'drafts') }}
include-future-bundle: ${{ toJSON(matrix.post-status == 'future') }}
output-directory: public-${{ matrix.post-status }}
source-directory: tests/config
upload-site-as: unminified-site-${{ matrix.post-status }}
# yamllint enable rule:line-length
# yamllint enable rule:key-ordering
...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ node_modules
.env
.disabled-env
hugo-cache/
.hvm
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ repos:
hooks:
- id: editorconfig-checker
alias: ec
exclude: ^(LICENSE$|README.md$|package(-lock)?.json$|_vendor)
exclude: ^(LICENSE$|README.*\.md$|package(-lock)?.json$|_vendor)

- repo: "https://github.com/streetsidesoftware/cspell-cli"
rev: v7.3.0
Expand Down
118 changes: 106 additions & 12 deletions README.fr.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,119 @@
# Module nouveau á l'Hugo au Wild Tech 'Garden'

Décrit: TBD
URL du référentiel: <https://github.com/wildtechgarden/module-starter-hugo-wtg>\
Site: <https://www.module-starter.wtg-demos.ca>\
Statut IC: [![pre-commit.ci statut](https://results.pre-commit.ci/badge/github/wildtechgarden/module-starter-hugo-wtg/main.svg)](https://results.pre-commit.ci/latest/github/wildtechgarden/module-starter-hugo-wtg/main)
Décrit: Créer un site Web Hugo et [auditer les erreurs
silencieuses](https://discourse.gohugo.io/t/audit-your-published-site-for-problems/35184/8).
Éventuellement, générer une sortie et/ou une utilisation d'artefact ou en
d'autres tâches.
URL du référentiel: <https://github.com/wildtechgarden/audit-build-action-hugo>\
Site: TBD\
Statut IC: [![pre-commit.ci statut](https://results.pre-commit.ci/badge/github/wildtechgarden/audit-build-action-hugo/main.svg)](https://results.pre-commit.ci/latest/github/wildtechgarden/audit-build-action-hugo/main)

## Matières

1. [Matières](#matières)
2. [Fonctionnalités](#fonctionnalités)
3. [Utilisation](#utilisation)
4. [Développement](#développement)
5. [Colophon](#colophon)
2. [Configuration and Utilisation](#configuration-and-utilisation)
1. [Action inputs variables](#action-inputs-variables)
2. [Action outputs variables](#action-outputs-variables)
3. [Sample usage](#sample-usage)
1. [Single hugo.toml](#single-hugotoml)
2. [With an extra configuration file](#with-an-extra-configuration-file)
3. [Développement](#développement)
4. [Colophon](#colophon)

## Fonctionnalités
## Configuration and Utilisation

TBD
### Action inputs variables

## Utilisation
| Input | Description | Required | Default |
|-------|-------------|-------|---------|
| base-url | définir baseURL due site | false | |
| build-for-downstream | Créer à utilisation d'un autre tache sans artefact (string: "true" or "false" | true | "false" |
| checkout-fetch-depth | Cherche depth (recommander utilisant 0 to fetch all history si utilisant .GitInfo or .Lastmod) | true | 0 |
| checkout-submodules | Chercher git submodules: false, true, or recursive | true | false |
| code-directory | Location des modules et référentiel | true | ${{ github.workspace }}/code |
| config-file | Hugo configuration ficher (peu t'être une list sépare des virgules, relatif aux 'source') | true | "config.toml" |
| do-minify-audit | Si présente, utiliser --minify avant que auditer | false | |
| do-minify-bundle | Si présente, utiliser --minify avant que dernier créer | false | |
| hugo-cache-directory | Location de Hugo module cache, sous le `code-directory` | true | hugo_cache
| hugo-env | Hugo environnement (production, development, etc) | true | production |
| hugo-extended | Hugo Extended | true | true |
| hugo-version | Hugo Version | true | 'latest' |
| image-formats | Image formats aux resource hash key | true | ['webp', 'svg', 'png', 'jpg', 'jpeg','gif', 'tiff', 'tif', 'bmp'] |
| include-drafts-audit | Créer avec `--buildDrafts` pendant audit | true | true |
| include-future-audit | Créer avec `--buildFuture` pendant audit | true | true |
| include-drafts-artifact | Créer avec `--buildDrafts` pendant créer aux des autres taches | true | false |
| include-future-artifact | Créer avec `--buildFuture` pendant créer aux des autres taches | true | false |
| output-directory | Location d'output de Hugo, relatif a workspace | true | public |
| repo-directory | Location de checkout aux référentiel, sous le code-directory | true | repo |
| source-directory | Location de source de site, dan le référentiel | false | |
| upload-site-as | Artefact a créer avec le site d'Hugo | false | |
| upload-site-filename | Nom de ficher a tarball de site aux artefact | true | hugo-site.tar |
| upload-site-retention | Jours de retention aux artefact de site d'Hugo | true | 1 |
| use-lfs | Utiliser LFS | true | false |

TBD
### Action outputs variables

None

### Sample usage

#### Single hugo.toml

```yaml
name: test-build-on-pr
on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
push:
branches:
- main
jobs:
build-unminified-site:
runs-on: ubuntu-22.04
steps:
- name: "Build site with Hugo and audit"
uses: wildtechgarden/audit-build-action-hugo
with:
base-url: https://www.example.com/
build-for-downstream: "true"
use-lfs: true
```
#### With an extra configuration file
Utilise `hugo.toml` comme d'abord, mais donner les parameter du site
dans `config-params.toml` (à côté de `hugo.toml` ; avec `[params]` key en haute).

Cela peut être utile pour transmettre des informations dans la version.

```yaml
name: test-build-on-pr
on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
push:
branches:
- main
jobs:
build-unminified-site:
runs-on: ubuntu-22.04
steps:
- name: "Créer un site Web Hugo et auditer"
uses: wildtechgarden/audit-build-action-hugo
with:
base-url: https://www.example.com/
build-for-downstream: "true"
config-file: hugo.toml,hugo.params.toml
use-lfs: true
```

## Développement

Expand Down
122 changes: 109 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,121 @@
# New Hugo module starter by Wild Tech 'Garden'
# GitHub action to audit a Hugo site build

Description: TBD
Repository URL: <https://github.com/wildtechgarden/module-starter-hugo-wtg>\
Site: <https://www.module-starter.wtg-demos.ca>
CI Status: [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/wildtechgarden/module-starter-hugo-wtg/main.svg)](https://results.pre-commit.ci/latest/github/wildtechgarden/module-starter-hugo-wtg/main)
Description: Build a Hugo website and [audit for silent
errors](https://discourse.gohugo.io/t/audit-your-published-site-for-problems/35184/8).
Optionally generate output and/or an artifact for use by other jobs in a
GitHub Actions Workflow (e.g. for other tests or deployment).
Repository URL: <https://github.com/wildtechgarden/audit-build-action-hugo>\
Site: TBD\
CI Status: [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/wildtechgarden/audit-build-action-hugo/main.svg)](https://results.pre-commit.ci/latest/github/wildtechgarden/audit-build-action-hugo/main)

## Contents

1. [Contents](#contents)
2. [Features](#features)
3. [Usage](#usage)
4. [Development](#development)
5. [Colophon](#colophon)
2. [Configuration and Usage](#configuration-and-usage)
1. [Action inputs variables](#action-inputs-variables)
2. [Action outputs variables](#action-outputs-variables)
3. [Sample usage](#sample-usage)
1. [Single hugo.toml](#single-hugotoml)
2. [With an extra configuration file](#with-an-extra-configuration-file)
3. [Development](#development)
4. [Colophon](#colophon)

## Features
## Configuration and Usage

TBD
### Action inputs variables

## Usage
| Input | Description | Required | Default |
|-------|-------------|-------|---------|
| base-url | Set the baseURL for the site (for this build only) | false | |
| build-for-downstream | Build for use by another action or step (aka bundle) without an artifact (string: "true" or "false" | true | "false" |
| checkout-fetch-depth | Fetch depth (recommend using 0 to fetch all history if using .GitInfo or .Lastmod) | true | 0 |
| checkout-submodules | Fetch git submodules: false, true, or recursive | true | false |
| code-directory | Directory under which repo and modules will live | true | ${{ github.workspace }}/code |
| config-file | Hugo configuration file to use for the build(s) (may be a comma-separated list of files, relative to the 'source' dir) | true | "config.toml" |
| do-minify-audit | If present, minify site using --minify before audit | false | |
| do-minify-bundle | If present, minify site using --minify before last build | false | |
| hugo-cache-directory | Where to place the Hugo module cache, under the code-directory | true | hugo_cache
| hugo-env | Hugo environment (production, development, etc) | true | production |
| hugo-extended | Hugo Extended | true | true |
| hugo-version | Hugo Version | true | 'latest' |
| image-formats | Image formats to include in resource hash key | true | ['webp', 'svg', 'png', 'jpg', 'jpeg','gif', 'tiff', 'tif', 'bmp'] |
| include-drafts-audit | Build with `--buildDrafts` during audit | true | true |
| include-future-audit | Build with `--buildFuture` during audit | true | true |
| include-drafts-artifact | Build with `--buildDrafts` when building for another stage (generating an artifact) | true | false |
| include-future-artifact | Build with `--buildFuture`when building for another stage (generating an artifact) | true | false |
| output-directory | Location of the site output by Hugo, relative to the workspace | true | public |
| repo-directory | Where to checkout the repo, under the code-directory | true | repo |
| source-directory | Where the source for the site lives, within the repo | false | |
| upload-site-as | Artifact to create containing the Hugo site | false | |
| upload-site-filename | Filename for tarball of site to upload to artifact | true | hugo-site.tar |
| upload-site-retention | Retention period in days for Hugo site artifact | true | 1 |
| use-lfs | Use LFS when checking out out repo | true | false |

TBD
### Action outputs variables

None

### Sample usage

#### Single hugo.toml

```yaml
name: test-build-on-pr
on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
push:
branches:
- main
jobs:
build-unminified-site:
runs-on: ubuntu-22.04
steps:
- name: "Build site with Hugo and audit"
uses: wildtechgarden/audit-build-action-hugo
with:
base-url: https://www.example.com/
build-for-downstream: "true"
use-lfs: true
```
#### With an extra configuration file
Create `hugo.toml` as usual, except put all site-wide parameters in
`config-params.toml` (beside `hugo.toml` in the directory structure;
includes `[params]` top-level key).

This can be useful for passing information into the build (e.g. for unit
tests).

```yaml
name: test-build-on-pr
on:
pull_request:
types:
- assigned
- opened
- synchronize
- reopened
push:
branches:
- main
jobs:
build-unminified-site:
runs-on: ubuntu-22.04
steps:
- name: "Build site with Hugo and audit"
uses: wildtechgarden/audit-build-action-hugo
with:
base-url: https://www.example.com/
build-for-downstream: "true"
config-file: hugo.toml,hugo.params.toml
use-lfs: true
```

## Development

Expand Down
Loading

0 comments on commit 68b9ac6

Please sign in to comment.