-
-
Notifications
You must be signed in to change notification settings - Fork 191
142 lines (128 loc) · 5.9 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
# 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", archive_name: "macos", 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: ubuntu-latest, name: "Linux", archive_name: "linux", CC: gcc-8, CXX: g++-8, LDFLAGS: "-static-libgcc -static-libstdc++"}
- {runs_on: windows-latest, name: "Windows", archive_name: "windows", CMAKE_FLAGS: "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded"}
runs-on: ${{ matrix.os.runs_on }}
container: ${{ fromJSON('["", "ghcr.io/quick-lint/quick-lint-js-github-builder:v1"]')[matrix.os.runs_on == 'ubuntu-latest'] }}
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: 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 ${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
- name: JS configure
run: cd plugin/vscode && yarn
- name: JS test
# NOTE(strager): We test on Linux in the build-extension job.
if: ${{ matrix.os.archive_name != 'linux' }}
run: |
cd plugin/vscode
yarn test
- name: upload build to workflow
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: vscode-dist-${{ matrix.os.archive_name }}
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
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-macos
path: ./plugin/vscode/dist/
- uses: actions/download-artifact@v2
with:
name: vscode-dist-windows
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.
- 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
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/>.