forked from quick-lint/quick-lint-js
-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (174 loc) · 9.3 KB
/
build-and-test-plugin-vscode.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# 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-and-test:
name: ${{ matrix.os.name }}
strategy:
fail-fast: false
matrix:
os:
- {runs_on: macos-10.15, name: "macOS x86_64", platform_arch: "darwin-x64", test: true, CC: /usr/local/opt/llvm/bin/clang, CXX: /usr/local/opt/llvm/bin/clang++, CFLAGS: "-isystem /usr/local/opt/llvm/include -isystem /usr/local/opt/llvm/include/c++/v1 -mmacosx-version-min=10.9 -D_LIBCPP_DISABLE_AVAILABILITY", LDFLAGS: "-L/usr/local/opt/llvm/lib -mlinker-version=278 -nostdlib++ /usr/local/opt/llvm/lib/libc++.a /usr/local/opt/llvm/lib/libc++abi.a"}
- {runs_on: stracle-macos-aarch64, name: "macOS AArch64", platform_arch: "darwin-arm64", test: true, CFLAGS: "-mmacosx-version-min=11.0"}
# NOTE(strager): We test on Linux x86_64 in the build-extension job.
- {runs_on: ubuntu-latest, name: "Linux x86_64", platform_arch: "linux-x64", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-builder:v1", CC: gcc-8, CXX: g++-8, LDFLAGS: "-static-libgcc -static-libstdc++"}
- {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:v2", 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:v1", 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:v1", 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:v1", 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@v2
- 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 (MSYS2)
if: ${{ matrix.os.msys2_packages }}
run: c:/msys64/usr/bin/pacman.exe --sync --noconfirm ${{ matrix.os.msys2_packages }}
- name: C++ configure
run: |
env | grep '^CMAKE\|^QUICK_LINT_JS' | sort
cmake ${CMAKE_C_COMPILER:+-DCMAKE_C_COMPILER="${CMAKE_C_COMPILER}"} ${CMAKE_CXX_COMPILER:+-DCMAKE_CXX_COMPILER="${CMAKE_CXX_COMPILER}"} -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=NO -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${CMAKE_SHARED_LINKER_FLAGS}" -DQUICK_LINT_JS_ENABLE_VSCODE=YES -DCMAKE_POSITION_INDEPENDENT_CODE=YES -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=YES ${CMAKE_EXTRA_FLAGS} -S . -B build
shell: bash
- 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: JS configure
if: ${{ matrix.os.test }}
run: cd plugin/vscode && yarn
- name: JS test
if: ${{ matrix.os.test }}
run: |
cd plugin/vscode
yarn test --target ${{ matrix.os.platform_arch }}
- name: upload build to workflow
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: vscode-dist-${{ matrix.os.platform_arch }}
path: plugin/vscode/dist/
build-extension:
name: VS Code .vsix
needs: build-and-test
runs-on: ubuntu-latest
# TODO(strager): Use ghcr.io/quick-lint/quick-lint-js-github-builder.
env:
QLJS_COLLECT_COPYRIGHT_NO_WARNINGS: 1
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: vscode-dist-linux-x64
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-linux-arm
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-linux-arm64
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-darwin-arm64
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-darwin-x64
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-win32-ia32
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-win32-x64
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-win32-arm
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-win32-arm64
path: ./plugin/vscode/dist/
- name: JS configure
run: cd plugin/vscode && yarn
# TODO(strager): Testing on Linux doesn't work inside a
# ghcr.io/quick-lint/quick-lint-js-github-builder Docker container. Fix
# the Docker image then move this testing on Linux into the
# build-and-test job.
# NOTE(strager): This only tests Linux x86_64, not other architectures.
- name: JS test (Linux)
run: |
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
cd plugin/vscode
yarn test --target linux-x64
kill %1
wait || :
- 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@v2
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@master
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/>.