Skip to content

Fix error reporting #766

Fix error reporting

Fix error reporting #766

Workflow file for this run

name: Test and publish
on:
workflow_dispatch:
pull_request:
push:
branches: "master"
jobs:
# Test the extension on multiple OSs.
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- name: Install NPM dependencies
run: npm install
- name: Run linter
run: npm run lint
- name: Package the extension
run: npm run package
- name: Run tests (headless)
uses: coactions/setup-xvfb@v1
id: runTests
env:
GITHUB_TOKEN: ${{ secrets.VIPER_ADMIN_TOKEN }}
with:
run: npm test --full-trace
- name: Collect coverage
if: ${{ steps.runTests.outcome == 'success' }}
run: npx nyc report --reporter=lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: ${{ steps.runTests.outcome == 'success' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage/lcov.info
# Publish the extension when we are on master and the version specified in
# package.json is not the latest published version of the extension.
publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Install NPM dependencies
run: npm install
- name: Obtain version information
run: |
LAST_PUBLISHED_VERSION="$(
npx vsce show viper-admin.prusti-assistant --json \
| jq '.versions[0].version' --raw-output
)"
CURRENT_VERSION="$(
cat package.json | jq '.version' --raw-output
)"
echo "LAST_PUBLISHED_VERSION=$LAST_PUBLISHED_VERSION" >> $GITHUB_ENV
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Package the extension
run: npm run package
- name: Publish the extension to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v0
if: env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION
with:
pat: ${{ secrets.VSCE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: prusti-assistant-${{ env.CURRENT_VERSION }}.vsix
packagePath: ''
- name: Publish the extension to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v0
if: env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
registryUrl: https://open-vsx.org
extensionFile: prusti-assistant-${{ env.CURRENT_VERSION }}.vsix
packagePath: ''
- name: Create a release for the published version
uses: softprops/action-gh-release@v1
if: env.CURRENT_VERSION != env.LAST_PUBLISHED_VERSION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release v${{ env.CURRENT_VERSION }}
tag_name: v${{ env.CURRENT_VERSION }}
files: prusti-assistant-${{ env.CURRENT_VERSION }}.vsix