Skip to content

Commit 0c95124

Browse files
committed
Updated Scaffold's GHA and added GHA linting.
1 parent bf5eec0 commit 0c95124

File tree

7 files changed

+137
-113
lines changed

7 files changed

+137
-113
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- name: Deploy to Remote
3636
env:
3737
DEPLOY_BRANCH: ${{ env.DEPLOY_BRANCH }}
38+
HEAD_REF: ${{ github.head_ref }}
3839
run: |
39-
REF=${{ github.event.pull_request && github.head_ref || github.ref_name }}
40+
REF=${{ github.event.pull_request && env.HEAD_REF || github.ref_name }}
4041
DEPLOY_BRANCH=${DEPLOY_BRANCH:-${REF}} .devtools/deploy.sh

.github/workflows/release-docs.yml renamed to .github/workflows/scaffold-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20-
release-docs:
20+
scaffold-release-docs:
2121
environment:
2222
name: github-pages
2323
url: ${{ steps.pages.outputs.page_url }}

.github/workflows/scaffold-test.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Test Scaffold
2+
3+
# Workflow to **validate** the **integrity** of the scaffold template itself.
4+
5+
on:
6+
push:
7+
branches:
8+
- 1.x
9+
10+
pull_request:
11+
branches:
12+
- 1.x
13+
- 'feature/**'
14+
15+
jobs:
16+
scaffold-test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
26+
- name: Check coding standards
27+
uses: luizm/action-sh-checker@v0.8.0
28+
env:
29+
SHFMT_OPTS: -i 2 -ci -s -d
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
34+
- name: Setup kcov
35+
run: wget https://github.com/SimonKagstrom/kcov/releases/download/v42/kcov-amd64.tar.gz && tar -xf kcov-amd64.tar.gz && sudo mv ./usr/local/bin/kcov /usr/local/bin/kcov && kcov --version
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
working-directory: .scaffold/tests
40+
41+
- name: Run tests
42+
run: kcov --include-pattern=.sh,.bash --bash-parse-files-in-dir=. --exclude-pattern=vendor,node_modules,.scaffold-coverage-html "$(pwd)"/.scaffold-coverage-html .scaffold/tests/node_modules/.bin/bats .scaffold/tests/bats
43+
44+
- name: Upload coverage report as an artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: ${{github.job}}-code-coverage-report
48+
path: ./.scaffold-coverage-html
49+
if-no-files-found: error
50+
51+
- name: Upload coverage report to Codecov
52+
uses: codecov/codecov-action@v4
53+
if: ${{ env.CODECOV_TOKEN != '' }}
54+
with:
55+
directory: ./.scaffold-coverage-html
56+
fail_ci_if_error: true
57+
token: ${{ secrets.CODECOV_TOKEN }}
58+
env:
59+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
60+
61+
scaffold-test-actions:
62+
runs-on: ubuntu-latest
63+
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v4
67+
68+
- name: Check coding standards with yamllint
69+
run: yamllint --config-file .scaffold/tests/.yamllint-for-gha.yml .github/workflows
70+
continue-on-error: ${{ vars.DREVOPS_CI_YAMLLINT_IGNORE_FAILURE == '1' }}
71+
72+
- name: Check coding standards with actionlint
73+
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.6.27 -ignore 'SC2002:' -ignore 'SC2155:'
74+
continue-on-error: ${{ vars.DREVOPS_CI_ACTIONLINT_IGNORE_FAILURE == '1' }}
75+
76+
scaffold-test-docs:
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- name: Checkout code
81+
uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 0
84+
85+
- name: Setup Node.js
86+
uses: actions/setup-node@v4
87+
88+
- name: Install dependencies
89+
run: npm install
90+
working-directory: '${{ github.workspace }}/.scaffold/docs'
91+
92+
- name: Build documentation site
93+
run: npm run build
94+
working-directory: '${{ github.workspace }}/.scaffold/docs'
95+
96+
- name: Run tests
97+
run: npm run test
98+
working-directory: '${{ github.workspace }}/.scaffold/docs'
99+
100+
- name: Deploy to Netlify
101+
uses: nwtgck/actions-netlify@v3.0
102+
with:
103+
github-token: ${{ secrets.GITHUB_TOKEN }}
104+
publish-dir: '.scaffold/docs/build'
105+
production-branch: 1.x
106+
deploy-message: "Deploy from GitHub Actions"
107+
enable-pull-request-comment: true
108+
enable-commit-comment: true
109+
overwrites-pull-request-comment: true
110+
env:
111+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
112+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
113+
timeout-minutes: 1

.github/workflows/test-docs.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/test-scaffold.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ name: Test
22

33
on:
44
push:
5-
pull_request:
65
tags:
76
- '**'
87
branches:
98
- 1.x
9+
pull_request:
10+
branches:
11+
- 1.x
1012

1113
jobs:
1214
test:
@@ -97,5 +99,5 @@ jobs:
9799
- name: Process artifacts
98100
uses: actions/upload-artifact@v4
99101
with:
100-
name: Artifacts (${{ join(matrix.*, ', ') }})
102+
name: Artifacts (${{ matrix.name }})
101103
path: build/web/sites/simpletest/browser_output

.scaffold/tests/.yamllint-for-gha.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Yamllint configuration file used to check GitHub Actions configuration files.
2+
extends: default
3+
4+
rules:
5+
comments:
6+
min-spaces-from-content: 1
7+
document-start:
8+
present: false
9+
empty-lines:
10+
max: 1
11+
max-start: 0
12+
max-end: 0
13+
line-length:
14+
max: 255
15+
truthy:
16+
allowed-values: ['true', 'false']
17+
check-keys: false

0 commit comments

Comments
 (0)