gnls/.github/workflows/integration.yml

138 строки
3.7 KiB
YAML

name: Integration
on:
push: {branches: [main]}
pull_request: {branches: [main]}
jobs:
validate:
name: Validate
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: latest
check-latest: true
cache: pnpm
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.x
check-latest: true
- name: Install VisualStudio
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Install Tools
run: |
addpath() { export PATH="$1:$PATH" && echo "$1" >> $GITHUB_PATH ; }
case "$RUNNER_OS" in
Linux)
sudo apt update
sudo apt install -y ninja-build
;;
macOS)
brew install llvm ninja
addpath "$(brew --prefix llvm)/bin"
;;
Windows)
choco install ninja
;;
*)
echo "Unknown OS: $RUNNER_OS"
exit 1
;;
esac
- name: Check Environment
run: |
trace() { echo "::group::$@" && "$@" && echo "::endgroup::" ; }
trace node --version
trace python --version
trace clang --version
trace clang++ --version
trace clang-format --version
trace clang-tidy --version
trace ninja --version
- name: Setup Cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ hashFiles('addon/deps.json') }}
path: addon/gn
- name: Prepare Dependencies
run: pnpm install --frozen-lockfile
- name: Build Debug
run: pnpm debug
- name: Run Test
run: pnpm test
- name: Build Release
run: pnpm build
- name: Upload Archive
uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Linux' }}
with:
name: archive
path: |
README.md
CHANGELOG.md
LICENSE
package.json
build
!build/*.node
- name: Upload Addons
uses: actions/upload-artifact@v3
with:
name: addons
path: build/*.node
build:
name: Build
needs: validate
runs-on: ubuntu-latest
steps:
- name: Install Tools
run: npm install --global @vscode/vsce
- name: Download Archive
uses: actions/download-artifact@v3
with:
name: archive
path: .
- name: Download Addons
uses: actions/download-artifact@v3
with:
name: addons
path: build
- name: Generate Package
run: vsce package --out gnls.vsix
- name: Upload Package
uses: actions/upload-artifact@v3
with:
name: package
path: gnls.vsix
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Install Tools
run: npm install --global @vscode/vsce
- name: Download Package
uses: actions/download-artifact@v3
with:
name: package
path: .
- name: Publish Package
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: vsce publish --skip-duplicate --packagePath gnls.vsix