insomnia/.github/workflows/test.yml

110 lines
3.1 KiB
YAML
Raw Normal View History

2020-04-26 20:33:39 +00:00
name: Test
2020-05-28 22:45:37 +00:00
on:
merge_group:
workflow_dispatch:
2020-05-28 22:45:37 +00:00
push:
branches:
- develop
pull_request:
types:
- opened
- synchronize
2020-04-26 20:33:39 +00:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2020-04-26 20:33:39 +00:00
jobs:
OS:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
2020-04-26 20:33:39 +00:00
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
2020-04-26 20:33:39 +00:00
with:
node-version-file: ".nvmrc"
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install packages
run: npm ci
- name: Lint
2022-02-02 11:11:13 +00:00
if: matrix.os == 'ubuntu-latest'
run: npm run lint
2021-10-14 22:16:30 +00:00
- name: Lint markdown
2022-02-02 11:11:13 +00:00
if: matrix.os == 'ubuntu-latest'
2021-08-27 03:44:01 +00:00
run: npm run lint:markdown
- name: Type checks
2022-02-02 11:11:13 +00:00
if: matrix.os == 'ubuntu-latest'
run: npm run type-check
2020-04-26 20:33:39 +00:00
- name: Run tests
run: npm test
- name: Build app for smoke tests
2022-03-16 09:36:41 +00:00
run: npm run app-build
- name: Run Smoke tests (CI)
# Partial Smoke test run, for regular CI triggers
if: "!startsWith(github.head_ref, 'release/')"
run: npm run test:build --prefix packages/insomnia-smoke-test -- --project=Smoke
- name: Run Smoke tests (Release)
# Full Smoke test run, for Release PRs
if: "startsWith(github.head_ref, 'release/')"
run: npm run test:build --prefix packages/insomnia-smoke-test
2021-10-14 22:16:30 +00:00
- name: Set Inso CLI variables
id: inso-variables
shell: bash
run: |
2022-03-17 10:05:37 +00:00
INSO_VERSION="$(jq .version packages/insomnia-inso/package.json -rj)-run.${{ github.run_number }}"
PKG_NAME="inso-${{ matrix.os }}-$INSO_VERSION"
echo "pkg-name=$PKG_NAME" >> $GITHUB_OUTPUT
echo "inso-version=$INSO_VERSION" >> $GITHUB_OUTPUT
- name: Run Inso NPM package tests
run: npm run test:bundled-inso
2021-10-14 22:16:30 +00:00
- name: Package Inso CLI binary
run: |
echo "Replacing electron binary with node binary"
node_modules/.bin/node-pre-gyp install --update-binary --directory node_modules/@getinsomnia/node-libcurl
npm run inso-package
env:
VERSION: ${{ steps.inso-variables.outputs.inso-version }}
- name: Create Inso CLI artifacts
run: npm run inso-package:artifacts
2021-10-14 22:16:30 +00:00
env:
VERSION: ${{ steps.inso-variables.outputs.inso-version }}
- name: Upload Inso CLI artifacts
uses: actions/upload-artifact@v3
with:
if-no-files-found: ignore
name: ${{ steps.inso-variables.outputs.pkg-name }}
path: packages/insomnia-inso/artifacts
2021-10-14 23:00:06 +00:00
- name: Run Inso CLI smoke tests
run: npm run test:smoke:cli
2021-10-14 23:00:06 +00:00
- name: Upload smoke test screenshots
uses: actions/upload-artifact@v3
2021-10-14 23:00:06 +00:00
if: always()
with:
if-no-files-found: ignore
name: ${{ matrix.os }}-smoke-test-screenshots-${{ github.run_number }}
path: packages/insomnia-smoke-test/screenshots