Skip to content

feat: add log-level lib #12

feat: add log-level lib

feat: add log-level lib #12

Workflow file for this run

name: pull-request
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
CACHE_KEY: # Provide inputs.CACHE_KEY manually from UI to bust cache
description: "Cache key override"
required: false
default: "v1"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "18"
CACHE_KEY: ${{ inputs.CACHE_KEY || 'v1' }}
PROVIDER_URL: https://eth-mainnet.g.alchemy.com/v2/${{ secrets.ALCHEMY_API_KEY }}
IPFS_GATEWAY_URL: https://api.nexusmutual.io
COVER_ROUTER_URL: https://api.nexusmutual.io/v2
jobs:
version:
runs-on: ubuntu-22.04
if: github.base_ref == 'master'
outputs:
local_version: ${{ steps.local_version.outputs.value }}
registry_version: ${{ steps.registry_version.outputs.value }}
steps:
- name: GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get local version
id: local_version
run: |
version=$(cat ./package.json | jq --raw-output .version)
echo $version
echo "value=$version" >> $GITHUB_OUTPUT
- name: Get registry version
id: registry_version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
package_name="$(cat ./package.json | jq --raw-output .name)"
echo $package_name
version=$(npm view $package_name version)
echo $version
echo "value=$version" >> $GITHUB_OUTPUT
- name: Validate version
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const local_version = '${{ steps.local_version.outputs.value }}';
const registry_version = '${{ steps.registry_version.outputs.value }}';
core.info(`Repository version: ${local_version}`);
core.info(`Registry version: ${registry_version}`);
if (registry_version === local_version) {
core.setFailed('Please bump version before merging');
}
checks:
runs-on: ubuntu-22.04
needs: [version]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/cache@v3
id: cache
with:
path: ~/.npm
key: ${{ runner.os }}-${{ env.CACHE_KEY }}-${{ hashFiles('package-lock.json') }}
- name: Debug cache
run: |
echo "Cache hit: ${{ steps.cache.outputs.cache-hit }}"
echo "Cache key: ${{ runner.os }}-${{ env.CACHE_KEY }}-${{ hashFiles('package-lock.json') }}"
echo "NPM cache contents:"
ls -la ~/.npm || echo "~/.npm directory does not exist"
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "Installing dependencies..."
npm ci --ignore-scripts
- name: Verify node_modules
run: |
echo "Checking node_modules..."
ls -la node_modules || echo "node_modules directory does not exist"
echo "Checking specific type definitions:"
ls -la node_modules/@types || echo "@types directory does not exist"
- name: Build package
run: npm run build
- name: Run linter
run: npm run lint
- name: Check types and typescript
run: npm run ts:check
- name: Run tests
run: npm run test