-
-
Notifications
You must be signed in to change notification settings - Fork 2
147 lines (119 loc) · 4.72 KB
/
scaffold-test.yml
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
146
147
name: Test Scaffold
# Workflow to **validate** the **integrity** of the scaffold template itself.
on:
push:
branches:
- 1.x
pull_request:
branches:
- 1.x
- 'feature/**'
jobs:
scaffold-test-devtools:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bats-tags: ['p0', 'p1', 'p2']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Upgrade sqlite3
run: |
wget https://www.sqlite.org/2024/sqlite-autoconf-3450300.tar.gz -O /tmp/sqlite.tar.gz
tar -xzf /tmp/sqlite.tar.gz -C /tmp
cd /tmp/sqlite-autoconf-3450300
./configure CFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1" --prefix=/usr/local
make && sudo make install
sudo ldconfig
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
extensions: gd, sqlite, pdo_sqlite
- name: Check coding standards
uses: luizm/[email protected]
env:
SHFMT_OPTS: -i 2 -ci -s -d
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Setup kcov
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
- name: Install Ahoy
run: |
os=$(uname -s | tr '[:upper:]' '[:lower:]') && architecture=$(case $(uname -m) in x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac)
sudo wget -q https://github.com/ahoy-cli/ahoy/releases/download/v2.1.1/ahoy-bin-"${os}-${architecture}" -O /usr/local/bin/ahoy
sudo chown "$USER" /usr/local/bin/ahoy && chmod +x /usr/local/bin/ahoy
- name: Install dependencies
run: npm ci
working-directory: .scaffold/tests
- name: Run tests
run: |
kcov \
--include-pattern=.sh,.bash \
--bash-parse-files-in-dir=. \
--exclude-pattern=vendor,node_modules,.scaffold-coverage-html,.scaffold \
"$(pwd)"/.scaffold-coverage-html \
.scaffold/tests/node_modules/.bin/bats \
.scaffold/tests/bats --filter-tags "${{ matrix.bats-tags }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload coverage report as an artifact
uses: actions/upload-artifact@v4
with:
name: ${{github.job}}-code-coverage-report-${{ matrix.bats-tags }}
path: ./.scaffold-coverage-html
include-hidden-files: true
if-no-files-found: error
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v5
if: ${{ env.CODECOV_TOKEN != '' }}
with:
directory: ./.scaffold-coverage-html
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
scaffold-test-actions:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check coding standards with yamllint
run: yamllint --config-file .scaffold/tests/.yamllint-for-gha.yml .github/workflows
continue-on-error: ${{ vars.DREVOPS_CI_YAMLLINT_IGNORE_FAILURE == '1' }}
- name: Check coding standards with actionlint
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.6.27 -ignore 'SC2002:' -ignore 'SC2155:'
continue-on-error: ${{ vars.DREVOPS_CI_ACTIONLINT_IGNORE_FAILURE == '1' }}
scaffold-test-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Install dependencies
run: npm install
working-directory: '${{ github.workspace }}/.scaffold/docs'
- name: Build documentation site
run: npm run build
working-directory: '${{ github.workspace }}/.scaffold/docs'
- name: Run tests
run: npm run test
working-directory: '${{ github.workspace }}/.scaffold/docs'
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
publish-dir: '.scaffold/docs/build'
production-branch: 1.x
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
timeout-minutes: 1