Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Lint

# Code quality check (Checkstyle, Google ruleset) on every PR and push.
# Code quality check (Checkstyle, project ruleset) on every PR and push.
# Deliberately non-blocking on day one for an existing codebase:
# - checkstyle:checkstyle only generates a report, it never fails on violations
# - continue-on-error keeps even setup errors from gating merges
# The report is uploaded as a workflow artifact for review.
# The report is uploaded as a workflow artifact for review, and on pushes
# to dev it is also published to GitHub Pages (rendered HTML, no download):
# the official upload-pages-artifact + deploy-pages flow creates no commits.
# Tighten later: switch the goal to checkstyle:check and set
# failOnViolation to true in pom.xml, then drop continue-on-error.

Expand Down Expand Up @@ -37,3 +39,45 @@ jobs:
path: |
target/reports/
target/checkstyle-result.xml
# On pushes to dev, publish the HTML report online via GitHub Pages.
# The site is namespaced under /checkstyle/ so future reports can
# join under their own paths without breaking URLs.
- name: Assemble the Pages site
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
run: |
mkdir -p _site/checkstyle
cp -R target/reports/. _site/checkstyle/
cat > _site/index.html <<'HTML'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=checkstyle/checkstyle.html">
<title>learn-dev reports</title>
</head>
<body>
<p><a href="checkstyle/checkstyle.html">Checkstyle report</a></p>
</body>
</html>
HTML
- name: Upload the Pages artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
uses: actions/upload-pages-artifact@v5
with:
path: _site

# Deploys the assembled site (no commits: Pages serves the artifact).
deploy-report:
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
needs: checkstyle
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,9 @@ chore(git): Ignore IntelliJ IDEA configuration files
```
Violations also print on the console as warnings, and the raw XML result
is written to `target/checkstyle-result.xml`.
- **Online**: the latest report from `dev` is
[rendered on GitHub Pages](https://www.ericbouchut.com/learn-dev/checkstyle/checkstyle.html)
(republished by the Lint workflow on each merge to `dev`, without any commit).
- **On CI**: every [Lint workflow run](https://github.com/ebouchut/learn-dev/actions/workflows/lint.yml)
uploads both as the **`checkstyle-report`** artifact.
Open a run, scroll to its **Artifacts** section, download the archive,
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,10 @@ visit [this link](https://github.com/users/ebouchut/projects/7/views/3).
artifact of each [Tests workflow run](https://github.com/ebouchut/learn-dev/actions/workflows/test.yml),
and locally `make test` writes it to `target/site/jacoco/index.html`
(see [CONTRIBUTING](CONTRIBUTING.md#test-coverage-report-jacoco) for details).
- [Code quality report (Checkstyle)](https://github.com/ebouchut/learn-dev/actions/workflows/lint.yml) —
published as the `checkstyle-report` artifact of each Lint workflow run;
[download the latest report directly](https://nightly.link/ebouchut/learn-dev/workflows/lint/dev/checkstyle-report.zip)
(a zip served by nightly.link; open `reports/checkstyle.html` inside);
- [Code quality report (Checkstyle)](https://www.ericbouchut.com/learn-dev/checkstyle/checkstyle.html) —
the latest report, rendered online via GitHub Pages (refreshed on each merge to `dev`);
also published as the `checkstyle-report` artifact of each
[Lint workflow run](https://github.com/ebouchut/learn-dev/actions/workflows/lint.yml);
locally, `./mvnw checkstyle:checkstyle` writes `target/reports/checkstyle.html`
(see [CONTRIBUTING](CONTRIBUTING.md#code-style-and-formatting) for the code style).

Expand Down Expand Up @@ -465,7 +465,7 @@ See [LICENSE](LICENSE) for details.
[lint-image]: https://github.com/ebouchut/learn-dev/actions/workflows/lint.yml/badge.svg?branch=dev&event=push
[lint-url]: https://github.com/ebouchut/learn-dev/actions/workflows/lint.yml
[lint-report-image]: https://img.shields.io/badge/-report-blue
[lint-report-url]: https://nightly.link/ebouchut/learn-dev/workflows/lint/dev/checkstyle-report.zip
[lint-report-url]: https://www.ericbouchut.com/learn-dev/checkstyle/checkstyle.html
[schema-drift-image]: https://github.com/ebouchut/learn-dev/actions/workflows/schema-drift.yml/badge.svg?branch=dev&event=push
[schema-drift-url]: https://github.com/ebouchut/learn-dev/actions/workflows/schema-drift.yml
[github-issues-image]: https://img.shields.io/github/issues/ebouchut/learn-dev
Expand Down