Merge pull request #444 from vgteam/bugfix-only #541
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
jobs: | |
npmtest: | |
name: Run npm tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Read .nvmrc | |
# See <https://remarkablemark.org/blog/2021/03/11/setup-nodejs-with-nvmrc-in-github-actions/> | |
# # And <https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter> | |
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT | |
id: nvmrc | |
- name: Use Node.js from .nvmrc | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }} | |
- name: Install node modules as specified in lockfile | |
run: npm ci | |
- name: Install latest vg release | |
# See https://gist.github.com/steinwaywhw/a4cd19cda655b8249d908261a62687f8 for how we pull out the right URL | |
run: | | |
mkdir -p bin | |
curl -sSL "$(curl -sSL https://api.github.com/repos/vgteam/vg/releases/latest | grep 'browser_download_url.*vg"' | cut -d ':' -f 2,3 | tr -d '"' | sed 's/^ *//g')" >bin/vg | |
chmod +x bin/vg | |
- name: Run tests | |
run: PATH=$PATH:$(pwd)/bin CI=true npm run test | |
- name: Test build | |
run: npm run build | |