Skip to content

cli: add petstore lint test to fix spectral ESM bundling error #1703

cli: add petstore lint test to fix spectral ESM bundling error

cli: add petstore lint test to fix spectral ESM bundling error #1703

Workflow file for this run

name: Test CLI
on:
merge_group:
workflow_dispatch:
push:
branches:
- develop
pull_request:
types:
- opened
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Test:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install packages
run: npm ci
- name: Install node version of node-libcurl for inso tests
run: node_modules/.bin/node-pre-gyp install --update-binary --directory node_modules/@getinsomnia/node-libcurl
- name : Build Inso
run: npm run build -w insomnia-inso
- name: Run Inso unit tests
run: npm run test:unit -w insomnia-inso
- name: Start test server
run: npm run serve -w insomnia-smoke-test & npx -y wait-on http://localhost:4010
- name: Run Inso bundle e2e tests
run: npm run test:bundle -w insomnia-inso
- name: Set Inso CLI variables
id: inso-variables
shell: bash
run: |
INSO_VERSION="$(jq .version packages/insomnia-inso/package.json -rj)-run.${{ github.run_number }}"
PKG_NAME="inso-ubuntu-latest-$INSO_VERSION"
echo "pkg-name=$PKG_NAME" >> $GITHUB_OUTPUT
echo "inso-version=$INSO_VERSION" >> $GITHUB_OUTPUT
- name: Package Inso CLI binary
run: |
npm run build -w insomnia-inso
npm run package -w insomnia-inso
env:
VERSION: ${{ steps.inso-variables.outputs.inso-version }}
# local dx:
# cp -r packages/insomnia-inso/src/commands/fixtures/with-ruleset ../tempfolder
# npm run build -w insomnia-inso && npm run package -w insomnia-inso && $PWD/packages/insomnia-inso/binaries/inso lint spec ../tempfolder/path-plugin.yaml
- name: Ensure Inso binary can use spectral lint config out of project folder
run: |
cp -r packages/insomnia-inso/src/commands/fixtures/with-ruleset ../tempfolder
echo "Expected: warnings, not ES Module errors"
packages/insomnia-inso/binaries/inso lint spec ../tempfolder/path-plugin.yaml
- name: Run Inso binary e2e tests
run: npm run test:binary -w insomnia-inso
- name: Create Inso zip/tar/gz artifacts
run: npm run artifacts -w insomnia-inso
env:
VERSION: ${{ steps.inso-variables.outputs.inso-version }}
- name: Upload Inso CLI artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ${{ steps.inso-variables.outputs.pkg-name }}
path: packages/insomnia-inso/artifacts