Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds publish pipeline & test coverage collection #1

Merged
merged 4 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Node.js CI

on:
push:
tags: -'v*'

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run functionality tests
run: npm run tests:functionality

- name: Run typing tests
run: npm run tests:typing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
fail_ci_if_error: true

build:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build

publish:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'release')
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '14'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run Tests

on: [push]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run functionality tests
run: npm run tests:functionality

- name: Functionality tests passed
if: success()
run: echo "Functionality tests passed!"

- name: Run typing tests
run: npm run tests:typing

- name: Typing tests passed
if: success()
run: echo "Typing tests passed!"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.idea
dist
dist
coverage
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
collectCoverage: true,
coverageReporters: ['json', 'lcov'],
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fancy-collections",
"version": "1.0.0",
"version": "1.1.0",
"description": "A small collection of perfectly typed handy tools for everyday work with collections",
"publishConfig": {
"access": "public"
Expand All @@ -13,8 +13,8 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "npx rimraf dist && tsc -p ./tsconfig.build.json",
"typing-tests": "tsc -p tsconfig.tests.json",
"tests": "jest"
"tests:typing": "tsc -p tsconfig.tests.json",
"tests:functionality": "jest"
},
"author": "avfirsov",
"license": "MIT",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading