refactor(diag): allow Diag_List to be moved #6357
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 and test VS Code extension | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
build: | |
name: build ${{ matrix.os.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- {runs_on: macos-12, name: "macOS x86_64", platform_arch: "darwin-x64", test: true, CC: /usr/local/opt/llvm@15/bin/clang, CXX: /usr/local/opt/llvm@15/bin/clang++, CFLAGS: "-isystem /usr/local/opt/llvm@15/include -isystem /usr/local/opt/llvm@15/include/c++/v1 -mmacosx-version-min=10.9 -D_LIBCPP_DISABLE_AVAILABILITY", LDFLAGS: "-L/usr/local/opt/llvm@15/lib -mlinker-version=278 -nostdlib++ /usr/local/opt/llvm@15/lib/c++/libc++.a /usr/local/opt/llvm@15/lib/c++/libc++abi.a", CMAKE_FLAGS: "-G Ninja", homebrew_packages: "ninja"} | |
- {runs_on: stracle-macos-aarch64, name: "macOS AArch64", platform_arch: "darwin-arm64", test: true, CFLAGS: "-mmacosx-version-min=11.0", CMAKE_FLAGS: "-G Ninja"} | |
- {runs_on: ubuntu-latest, name: "Linux x86_64", platform_arch: "linux-x64", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-baseline-builder:v1", LDFLAGS: "-static-libgcc -static-libstdc++", CMAKE_FLAGS: "-G Ninja"} | |
- {runs_on: ubuntu-latest, name: "Linux ARM", platform_arch: "linux-arm", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-cross-builder:v3", cross_compiling: true, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-linux-armhf.cmake -G Ninja", LDFLAGS: "-static-libgcc -static-libstdc++"} | |
- {runs_on: ubuntu-latest, name: "Linux AArch64", platform_arch: "linux-arm64", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-cross-builder:v3", cross_compiling: true, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-linux-aarch64.cmake -G Ninja", LDFLAGS: "-static-libgcc -static-libstdc++"} | |
- {runs_on: windows-2022, name: "Windows x86", platform_arch: "win32-ia32", test: true, CC: "c:/msys64/mingw32/bin/gcc.exe", CXX: "c:/msys64/mingw32/bin/g++.exe", CMAKE_FLAGS: "-G Ninja", chocolatey_packages: "ninja", msys2_packages: "mingw-w64-i686-gcc ninja", LDFLAGS: "-static"} | |
- {runs_on: windows-2022, name: "Windows x64", platform_arch: "win32-x64", test: true, CC: "c:/msys64/ucrt64/bin/gcc.exe", CXX: "c:/msys64/ucrt64/bin/g++.exe", CMAKE_FLAGS: "-G Ninja", chocolatey_packages: "ninja", msys2_packages: "mingw-w64-ucrt-x86_64-gcc ninja", LDFLAGS: "-static"} | |
- {runs_on: ubuntu-latest, name: "Windows ARM", platform_arch: "win32-arm", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-mingw-builder:v3", cross_compiling: true, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-mingw-armv7.cmake -G Ninja", LDFLAGS: "-static"} | |
- {runs_on: ubuntu-latest, name: "Windows ARM64", platform_arch: "win32-arm64", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-mingw-builder:v3", cross_compiling: true, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-mingw-aarch64.cmake -G Ninja", LDFLAGS: "-static"} | |
runs-on: ${{ matrix.os.runs_on }} | |
container: ${{ matrix.os.docker_container }} | |
env: | |
CMAKE_CXX_COMPILER: ${{ matrix.os.CXX }} | |
CMAKE_CXX_FLAGS: ${{ matrix.os.CFLAGS }} | |
CMAKE_C_COMPILER: ${{ matrix.os.CC }} | |
CMAKE_C_FLAGS: ${{ matrix.os.CFLAGS }} | |
CMAKE_EXE_LINKER_FLAGS: ${{ matrix.os.LDFLAGS }} | |
CMAKE_EXTRA_FLAGS: ${{ matrix.os.CMAKE_FLAGS }} | |
CMAKE_SHARED_LINKER_FLAGS: ${{ matrix.os.LDFLAGS }} | |
QLJS_COLLECT_COPYRIGHT_NO_WARNINGS: 1 | |
steps: | |
- name: checkout | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: update $PATH | |
if: ${{ matrix.os.msys2_packages }} | |
run: | | |
# For DLLs needed by GCC: | |
echo "c:/msys64/mingw32/bin" >>"${GITHUB_PATH}" | |
echo "c:/msys64/ucrt64/bin" >>"${GITHUB_PATH}" | |
shell: bash | |
- name: install dependencies (Chocolatey) | |
if: ${{ matrix.os.chocolatey_packages }} | |
run: choco install --yes ${{ matrix.os.chocolatey_packages }} | |
shell: powershell | |
- name: install dependencies (Homebrew) | |
if: ${{ matrix.os.homebrew_packages }} | |
run: brew install ${{ matrix.os.homebrew_packages }} | |
- name: install dependencies (MSYS2) | |
if: ${{ matrix.os.msys2_packages }} | |
run: c:/msys64/usr/bin/pacman.exe --sync --noconfirm ${{ matrix.os.msys2_packages }} | |
- name: build tools for cross compilation | |
if: ${{ matrix.os.cross_compiling }} | |
run: | | |
unset CC CXX | |
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF -S . -B build-tools -G Ninja | |
cmake --build build-tools --config Debug --target quick-lint-js-build-tools | |
- name: C++ configure | |
shell: "python3 {0}" | |
run: | | |
import os | |
import shlex | |
import subprocess | |
def var(name): | |
return os.environ.get(name, '') | |
command = [ | |
"cmake", | |
"-DCMAKE_BUILD_TYPE=Release", | |
"-DBUILD_TESTING=NO", | |
"-DQUICK_LINT_JS_ENABLE_VSCODE=YES", | |
"-DCMAKE_POSITION_INDEPENDENT_CODE=YES", | |
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=YES", | |
"-S", ".", "-B", "build", | |
f"-DCMAKE_C_FLAGS={var('CMAKE_C_FLAGS')}", | |
f"-DCMAKE_CXX_FLAGS={var('CMAKE_CXX_FLAGS')}", | |
f"-DCMAKE_EXE_LINKER_FLAGS={var('CMAKE_EXE_LINKER_FLAGS')}", | |
f"-DCMAKE_SHARED_LINKER_FLAGS={var('CMAKE_SHARED_LINKER_FLAGS')}", | |
] | |
c_compiler = var('CMAKE_C_COMPILER') | |
if c_compiler: command.append(f"-DCMAKE_C_COMPILER={c_compiler}") | |
cxx_compiler = var('CMAKE_CXX_COMPILER') | |
if cxx_compiler: command.append(f"-DCMAKE_CXX_COMPILER={cxx_compiler}") | |
if "${{ matrix.os.cross_compiling }}": | |
command.append(f"-DQUICK_LINT_JS_USE_BUILD_TOOLS={os.getcwd()}/build-tools") | |
command.extend(var('CMAKE_EXTRA_FLAGS').split()) | |
print(" ".join(shlex.quote(arg) for arg in command), flush=True) | |
result = subprocess.run(command) | |
exit(result.returncode) | |
- name: C++ build | |
run: cmake --build build --config Release --target quick-lint-js-vscode-node quick-lint-js-vscode-node-licenses | |
- name: C++ install | |
run: cmake --install build --component vscode-node --prefix plugin/vscode --strip | |
- name: upload build to workflow | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
if-no-files-found: error | |
name: vscode-dist-${{ matrix.os.platform_arch }} | |
path: plugin/vscode/dist/ | |
test: | |
name: test ${{ matrix.os.name }} | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- {runs_on: macos-12, name: "macOS x86_64", platform_arch: "darwin-x64"} | |
- {runs_on: stracle-macos-aarch64, name: "macOS AArch64", platform_arch: "darwin-arm64"} | |
# FIXME(strager): For some reason, tests fail with the a Docker | |
# container. | |
- {runs_on: ubuntu-latest, name: "Linux x86_64", platform_arch: "linux-x64", xvfb: true} | |
- {runs_on: windows-2022, name: "Windows x86", platform_arch: "win32-ia32"} | |
- {runs_on: windows-2022, name: "Windows x64", platform_arch: "win32-x64"} | |
# TODO(strager): Also test Linux x86 32-bit. | |
# TODO(strager): Also test Linux ARM (32-bit and 64-bit). | |
# TODO(strager): Also test Windows ARM (32-bit and 64-bit). | |
runs-on: ${{ matrix.os.runs_on }} | |
container: ${{ matrix.os.docker_container }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-linux-x64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-darwin-arm64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-darwin-x64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-win32-ia32 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-win32-x64 | |
path: ./plugin/vscode/dist/ | |
- name: configure | |
run: cd plugin/vscode && yarn | |
- name: test | |
shell: bash | |
run: | | |
run_xvfb=${{ fromJSON('[0, 1]')[matrix.os.xvfb] }} | |
if [ "${run_xvfb}" -ne 0 ]; then | |
DISPLAY=:1 | |
export DISPLAY | |
type Xvfb # Ensure Xvfb is installed. | |
Xvfb "${DISPLAY}" -screen 0 1024x768x24 & | |
sleep 0.1 # Wait for Xvfb to start. | |
printf 'Started Xvfb\n' >&2 | |
fi | |
cd plugin/vscode | |
yarn test --target ${{ matrix.os.platform_arch }} | |
if [ "${run_xvfb}" -ne 0 ]; then | |
kill %1 | |
wait || : | |
fi | |
vsix: | |
name: VS Code .vsix | |
needs: build | |
runs-on: ubuntu-latest | |
# TODO(strager): Use a stable Docker image. | |
env: | |
QLJS_COLLECT_COPYRIGHT_NO_WARNINGS: 1 | |
steps: | |
- name: checkout | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-linux-x64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-linux-arm | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-linux-arm64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-darwin-arm64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-darwin-x64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-win32-ia32 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-win32-x64 | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-win32-arm | |
path: ./plugin/vscode/dist/ | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: vscode-dist-win32-arm64 | |
path: ./plugin/vscode/dist/ | |
- name: configure | |
run: cd plugin/vscode && yarn | |
- name: create extension | |
run: cd plugin/vscode && ./node_modules/.bin/vsce package --baseImagesUrl https://raw.githubusercontent.com/quick-lint/quick-lint-js/master/plugin/vscode/ | |
- name: upload build to workflow | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
if-no-files-found: error | |
name: plugin-vscode-${{ github.sha }} | |
path: plugin/vscode/*.vsix | |
- 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: plugin/vscode/*.vsix | |
private-key: ${{ secrets.artifacts_key }} | |
remote-directory: ${{ secrets.artifacts_root }}/builds/${{ github.sha }}/vscode/ | |
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/>. |