-
-
Notifications
You must be signed in to change notification settings - Fork 192
132 lines (114 loc) · 4.52 KB
/
build-website.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
# Copyright (C) 2020 Matthew Glazar
# See end of file for extended copyright information.
name: build website
on:
push:
pull_request:
types: [opened, synchronize]
jobs:
build:
name: website
runs-on: ubuntu-latest
container: ghcr.io/quick-lint/quick-lint-js-github-website-builder:v5
env:
QLJS_COLLECT_COPYRIGHT_NO_WARNINGS: 1
steps:
- name: checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: C++ configure
run: emcmake cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=NO -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -flto'
- name: C++ build
run: emmake cmake --build build --target quick-lint-js-vscode quick-lint-js-vscode-licenses
- name: C++ install
run: emmake cmake --install build --component vscode --prefix website/public/demo
- name: get yarn cache directory path
id: yarn-cache-dir-path
run: printf 'dir=%s\n' "$(yarn cache dir)" >>"${GITHUB_OUTPUT}"
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: JS configure
working-directory: website
run: yarn
- name: JS test
working-directory: website
run: yarn test
- name: build site
working-directory: website
run: yarn build
- name: bundle site
working-directory: website
run: zip -r ../website.zip www
- name: check links (dev)
run: |
# HACK(strager): We write "::1" instead of "localhost" because the
# latter listens on IPv6 but connects on IPv4 for some reason.
server_process_is_alive() {
kill -0 "${server_pid}"
}
http_server_is_running() {
curl_status=0
curl --no-progress-meter --head -o /dev/null 'http://[::1]:9001/' || curl_status="${?}"
if [ "${curl_status}" -eq 7 ]; then # 7 is 'Failed to connect to host.'
return 1
fi
return 0
}
set -x
cd website/
yarn start ::1 9001 &
server_pid="${!}"
cd ../
while server_process_is_alive && ! http_server_is_running; do
sleep 0.1
done
./website/tools/check-links.mjs http://[::1]:9001/
kill "${server_pid}"
shell: bash
- name: check links (apache2)
run: |
rsync --archive --delete website/www/ /var/www/html/
service apache2 start
./website/tools/check-links.mjs http://localhost/
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: failure()
with:
name: apache-error-log
path: /var/log/apache2/error.log
if-no-files-found: ignore
- name: upload build to workflow
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
if-no-files-found: error
name: website-${{ github.sha }}
path: website/www/
- name: upload build to long-term storage
if: ${{ github.event_name == 'push' && github.repository_owner == 'quick-lint' != null }}
uses: quick-lint/sftp-upload@1fa54164d4bdd081207a6e54ec143d8dda3a7fb8 # v3
with:
host: ${{ secrets.artifacts_host }}
local-file-globs: website.zip
private-key: ${{ secrets.artifacts_key }}
remote-directory: ${{ secrets.artifacts_root }}/builds/${{ github.sha }}/website/
user: ${{ secrets.artifacts_user }}
# quick-lint-js finds bugs in JavaScript programs.
# Copyright (C) 2020 Matthew Glazar
#
# This file is part of quick-lint-js.
#
# quick-lint-js is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# quick-lint-js is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.