-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (140 loc) · 5.13 KB
/
pr-checks.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: PR Validation
on: pull_request
env:
THEME_NAME: hugo-creator
LATEST_HUGO_VERSION: 0.102.3
SITE_FOLDER_PATH: exampleSite
jobs:
dependency-review:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
imagecompressor:
# Only run on Pull Requests within the same repository, and not from forks.
if: github.event.pull_request.head.repo.full_name == github.repository
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Compress Images
uses: calibreapp/image-actions@main
with:
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
githubToken: ${{ secrets.GITHUB_TOKEN }}
matrixBuild:
needs: [dependency-review, imagecompressor]
name: "Build (Node, Hugo) - "
runs-on: ubuntu-latest
strategy:
matrix:
node: [16]
hugo: [0.76.5, 0.95.0, 0.96.0, 0.97.3]
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Setup Node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup Hugo ${{ matrix.hugo }}
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ matrix.hugo }}
extended: true
- name: Build
run: |
pushd $SITE_FOLDER_PATH
npm ci
hugo --minify --theme "$THEME_NAME" --themesDir "../../" --baseURL "/"
popd
contentLinter:
runs-on: ubuntu-latest
needs: matrixBuild
name: "Run linting"
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
################################
# Run Linter against code base #
################################
- name: Lint ${{env.SITE_FOLDER_PATH}} Content
uses: github/super-linter@v5
env:
FILTER_REGEX_INCLUDE: ${{env.SITE_FOLDER_PATH}}/content/**
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
################################
# Run Linter against code base #
################################
- name: Lint ${{env.THEME_NAME}} Theme Archetypes Folder
uses: github/super-linter@v5
env:
FILTER_REGEX_INCLUDE: archetypes/**
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
htmlproofer:
needs: matrixBuild
name: Verify exampleSite HTML Output
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.LATEST_HUGO_VERSION }}
extended: true
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: netlify
with:
site_name: ${{ env.THEME_NAME }}
- name: "Build Hugo"
run: |
pushd $SITE_FOLDER_PATH
npm ci
hugo --minify --theme "$THEME_NAME" --themesDir "../../" --baseURL ${{ steps.netlify.outputs.url }}
popd
- name: "Check HTML Output"
run: |
pushd $SITE_FOLDER_PATH/public
sudo gem install html-proofer
htmlproofer -v
htmlproofer --allow-hash-href --disable-external true
lighthouse:
needs: matrixBuild
name: "Lighthouse Eval"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: netlify
with:
site_name: ${{ env.THEME_NAME }}
- name: Use Node.js 10.x
uses: actions/setup-node@v3
with:
node-version: 10.x
- name: Lighthouse ${{ env.THEME_NAME }} (Preview)
run: |
npm install -g @lhci/[email protected]
lhci collect --urls ${{ steps.netlify.outputs.url }} --url ${{ steps.netlify.outputs.url }}/blog/ --url ${{ steps.netlify.outputs.url }}/talk/ --url ${{ steps.netlify.outputs.url }}/person/ --url ${{ steps.netlify.outputs.url }}/series/ --url ${{ steps.netlify.outputs.url }}/episode/
lhci upload --target "temporary-public-storage"
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}