fix(docs): refactor and improve README #5363
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/>. |