Skip to content

Commit

Permalink
Merge branch 'main' of github.com:adobe/spacecat-shared
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Jan 22, 2025
2 parents 904b1cc + 2c8fa4b commit 0e0664c
Show file tree
Hide file tree
Showing 359 changed files with 132,510 additions and 32,224 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

8 changes: 5 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ module.exports = {
rules: {},
},
{
files: ['*.test.js'],
files: ['packages/**/test/**/*.js'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
}
}
'no-console': 'off',
'func-names': 'off',
},
},
],
};
29 changes: 29 additions & 0 deletions .github/actions/lint-test-coverage/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Lint, Test, and Coverage"
description: "Runs lint and test commands, plus coverage"

inputs:
codecov_token:
description: "Codecov Token (optional)"
required: false
default: ""
upload_coverage:
description: "Whether to upload coverage to Codecov (true/false). Default false."
required: false
default: "false"

runs:
using: "composite"
steps:
- name: Lint
run: npm run lint
shell: bash

- name: Test
run: npm run test
shell: bash

- name: Upload coverage to Codecov
if: ${{ inputs.upload_coverage == 'true' }}
uses: codecov/codecov-action@v5
with:
token: ${{ inputs.codecov_token }}
32 changes: 32 additions & 0 deletions .github/actions/setup-node-npm/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Setup Node & NPM (with cache)"
description: "Checks out code, sets up Node, uses NPM cache, installs dependencies"

runs:
using: "composite"
steps:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22.12

- name: Get npm cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
shell: bash

- name: Set up NPM Cache
uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Update NPM (only if cache miss)
run: npm install -g [email protected]
shell: bash

- name: Install dependencies (only if cache miss)
run: npm ci
shell: bash
48 changes: 25 additions & 23 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
name: Build

permissions:
id-token: write
contents: write
issues: read

on: [push]

env:
Expand All @@ -10,27 +16,23 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check out
uses: actions/checkout@v4
with:
persist-credentials: 'false'

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Use Node.js 20.16.0 (LTS)
uses: actions/setup-node@v4
with:
node-version: '20.16.0'
- name: Install Dependencies
run: npm ci
- name: Linting
run: npm run lint
- name: Unit Tests
run: npm test
- name: Integration Tests
run: npm run --prefix packages/spacecat-shared-data-access test:it
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm

- name: Lint, Test, Coverage Upload
uses: ./.github/actions/lint-test-coverage

- name: Semantic Release (Dry Run)
if: github.ref != 'refs/heads/main'
run: npm run semantic-release-dry
Expand All @@ -44,14 +46,14 @@ jobs:
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Check out
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js 20.16.0 (LTS)
uses: actions/setup-node@v4
with:
node-version: '20.16.0'
- run: npm ci
persist-credentials: 'false'

- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm

- name: Semantic Release
run: npm run semantic-release
env:
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ Shared modules for Spacecat Services

## Modules
- `spacecat-shared-data-access` - Models and data access layer
- `spacecat-shared-dynamodb` - DynamoDB client for basic access
- `spacecat-shared-http-utils` - HTTP utility functions
- `spacecat-shared-utils` - Utility functions
- `spacecat-shared-rum-api-client` - Client for RUM Bundler API: [DOCS](https://github.com/adobe/spacecat-shared/blob/main/packages/spacecat-shared-rum-api-client/README.md)

## Installation
```bash
$ npm install @adobe/spacecat-shared-data-access
$ npm install @adobe/spacecat-shared-dynamodb
$ npm install @adobe/spacecat-shared-http-utils
$ npm install @adobe/spacecat-shared-utils
```
Expand Down
Loading

0 comments on commit 0e0664c

Please sign in to comment.