Skip to content

Merge pull request #25 from JetBrains-Research/v2.2.0-dev #77

Merge pull request #25 from JetBrains-Research/v2.2.0-dev

Merge pull request #25 from JetBrains-Research/v2.2.0-dev #77

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
- 'v[0-9]+.[0-9]+.[0-9]+-dev'
workflow_dispatch:
env:
coqlsp-path: "coq-lsp"
coqlsp-version: "0.1.8+8.19"
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
ocaml-compiler:
- "4.14"
runs-on: ${{ matrix.os }}
outputs:
vsixPath: ${{ steps.packageExtension.outputs.vsixPath }}
steps:
- name: Checkout tree
uses: actions/checkout@v4
# For some reason, the most significant thing for caching opam dependencies properly
# is `dune-cache: true` instead of this caching action.
- name: Restore cached opam dependencies
id: cache-opam
uses: actions/cache@v3
with:
path: ~/.opam/
key: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-${{ env.coqlsp-version }}
restore-keys: opam-${{ matrix.os }}-${{ matrix.ocaml-compiler }}-
- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true
- name: Install opam dependencies
env:
OPAMYES: true
run: |
opam install coq-lsp.0.1.8+8.19
eval $(opam env)
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: npm ci
- name: Check coq-lsp version
env:
OPAMYES: true
run: |
opam list coq-lsp
eval $(opam env)
which coq-lsp
- name: Check if coq-lsp is in PATH
run: |
eval $(opam env)
if ! command -v coq-lsp &> /dev/null
then
echo "coq-lsp could not be found"
fi
echo "coqlsppath=`which coq-lsp`" >> $GITHUB_ENV
shell: bash
- name: Test on Linux
env:
COQ_LSP_PATH: ${{ env.coqlsp-path }}
run: |
eval $(opam env)
xvfb-run -a npm run clean-test
if: runner.os == 'Linux'
- name: Test not on Linux
env:
COQ_LSP_PATH: ${{ env.coqlsp-path }}
run: |
eval $(opam env)
npm run clean-test
if: runner.os != 'Linux'
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
- name: Package Extension
id: packageExtension
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: stub
dryRun: true
- name: Upload Extension Package as Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: ${{ steps.packageExtension.outputs.vsixPath }}
create-release:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Install Dependencies
run: npm ci
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: ubuntu-latest
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VSCE_ACCESS_TOKEN }}
extensionFile: ${{ needs.build.outputs.vsixPath }}
registryUrl: https://marketplace.visualstudio.com